• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

'Target Unit of Ability being cast'

Status
Not open for further replies.
Level 5
Joined
Aug 8, 2012
Messages
154
Hey there!

So this is my trigger:

  • Breeding
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Breed
    • Actions
      • Set Breedchance = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to (Unit-type of (Target unit of ability being cast))
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Breedchance Greater than or equal to 6
            • Then - Actions
              • Unit - Pause (Triggering unit)
              • Unit - Pause (Target unit of ability being cast)
              • Unit - Make (Target unit of ability being cast) face (Facing of (Triggering unit)) over 1.00 seconds
              • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Unit - Unpause (Target unit of ability being cast)
              • Unit - Unpause (Triggering unit)
              • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cff32cd32Breeding ...
              • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
            • Else - Actions
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffff0000Breeding ...
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffff0000Breeding ...
My problem is that the last 'Unpause' for 'Target unit of ability being cast' does not work, nor did any special effects I placed at the point of the target unit (I took those out). For some reason, the first pause does, but by the time it gets to the unpausing, the trigger has forgotten what unit 'target unit of ability being cast' is. I cannot just save the unit as a variable because lots of units could be doing this ability at the same time (don't even ask, I know the trigger/ability looks a bit weird :L).

So say I saved the target unit as a variable, 'Breedee' and used that in this trigger. If this trigger ran again at the same time, surely the 'Breedee' variable would only apply to the latest running of the trigger, so any of them that started before would not have the 'Breedee' variable saved to them, and all the new units spawned would appear at the last one to finish breeding, and the first 'Breedee's would be stuck as paused units. Is that right?

And yes, I know this trigger leaks like the titanic, it's only a hypothetical thing I whipped up for my map, if it actually worked I would clean it up after, but right now I am more focused on the actual function of the trigger being successful! xD
 
Level 5
Joined
Aug 8, 2012
Messages
154
Firstly, use
  • tags!
  • Secondly, those Waits you have in there are ruining everything. AFAIK waits can't be used inside if/then/else functions.
  • You can solve the multi instanceability problem by using local variables - there's a tutorial on that topic, look it up in the tutorials section.[/QUOTE]
  • Ahh thank you! I fiddled around with the different tags, but I didn't know about the trigger ones! :)
  • I will look up those local variable tutorials now, cheers!
  • Edit: Getting really confused by the Jass in this [URL="http://www.hiveworkshop.com/forums/jass-ai-scripts-tutorials-280/local-variables-34049/"]http://www.hiveworkshop.com/forums/jass-ai-scripts-tutorials-280/local-variables-34049/[/URL] tutorial. Whenever I put something like 'local unit = breedee' like it says, it comes up with an error saying 'expected a code statement'... :(
  • Edit 2: i was just being stupid, ignore me! :L
 
Last edited:
Level 5
Joined
Aug 8, 2012
Messages
154
Hmmm. I'm not sure how to get rid of the waits in this trigger while still fulfilling the purpose and features of the trigger itself. I need both units to be paused for 10 seconds, and for special effects and animations to be played during that time. I have done the local unit variables, but they still overlap when multiple units do it at the same time, presumably due to those nasty waits? I have no idea!

Is there another way to do what I want without the use of waits?

Cheers!

Edit:

  • Breeding
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Breed
    • Actions
      • Custom script: local unit udg_Breedee
      • Custom script: local location udg_Temp_Point
      • Custom script: local location udg_temp_point
      • Set Breedee = (Target unit of ability being cast)
      • Set Temp_Point = (Position of (Target unit of ability being cast))
      • Set temp_point = (Position of (Triggering unit))
      • Set Breedchance = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to (Unit-type of (Target unit of ability being cast))
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Breedchance Greater than or equal to 6
            • Then - Actions
              • Unit - Pause (Triggering unit)
              • Unit - Pause Breedee
              • Unit - Make Breedee face (Facing of (Triggering unit)) over 1.00 seconds
              • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Animation - Play (Triggering unit)'s attack animation
              • Wait 2.00 seconds
              • Unit - Unpause Breedee
              • Unit - Unpause (Triggering unit)
              • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
              • Special Effect - Create a special effect at Temp_Point using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cff32cd32Breeding ...
              • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
            • Else - Actions
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffff0000Breeding ...
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffff0000Breeding ...
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call RemoveLocation(udg_temp_point)
      • Custom script: set udg_Breedee = null
      • Custom script: set udg_Temp_Point = null
I can see some of the reasons that it does not work, I just don't know how to fix it :(
 
Last edited:
Level 5
Joined
Aug 8, 2012
Messages
154
But if I take the waits out, how will it function the way I want it too, with the delays between special effects, and the delay before the new unit is created?

I am rather confused by what you put about the 'if/then/elses' because I can't visualize what you mean (more to do with how newbie I am at triggers rather than what you actually wrote;))... I don't suppose you could make a very simple/small test trigger just to show what you mean? You don't have to, but it would be very appreciated :)

Cheers!
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
  • Breeding
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Breed
    • Actions
      • Custom script: local unit udg_Breedee
      • Custom script: local location udg_Temp_Point
      • Custom script: local location udg_temp_point
      • Set Breedee = (Target unit of ability being cast)
      • Set Temp_Point = (Position of (Target unit of ability being cast))
      • Set temp_point = (Position of (Triggering unit))
      • Set Breedchance = (Random integer number between 1 and 10)
      • Set Check = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to (Unit-type of (Target unit of ability being cast))
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Breedchance Greater than or equal to 6
            • Then - Actions
              • Set Check = True
            • Else - Actions
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffff0000Breeding ...
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffff0000Breeding ...
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Check equal to False
        • Then - Actions
          • Custom script: call RemoveLocation(udg_Temp_Point)
          • Custom script: call RemoveLocation(udg_temp_point)
          • Custom script: set udg_Breedee = null
          • Custom script: set udg_Temp_Point = null
          • Skip remaining actions
        • Else - Actions
          • Unit - Pause (Triggering unit)
          • Unit - Pause Breedee
          • Unit - Make Breedee face (Facing of (Triggering unit)) over 1.00 seconds
          • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Animation - Play (Triggering unit)'s attack animation
          • Wait 2.00 seconds
          • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Animation - Play (Triggering unit)'s attack animation
          • Wait 2.00 seconds
          • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Animation - Play (Triggering unit)'s attack animation
          • Wait 2.00 seconds
          • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Animation - Play (Triggering unit)'s attack animation
          • Wait 2.00 seconds
          • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Animation - Play (Triggering unit)'s attack animation
          • Wait 2.00 seconds
          • Unit - Unpause Breedee
          • Unit - Unpause (Triggering unit)
          • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\Devour\DevourEffectArt.mdl
          • Special Effect - Create a special effect at Temp_Point using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cff32cd32Breeding ...
          • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call RemoveLocation(udg_temp_point)
      • Custom script: set udg_Breedee = null
      • Custom script: set udg_Temp_Point = null
Here's what I meant with the if/then/elses.

Now just replace all instances of (triggering unit) with a new local variable.

If you still don't come right, I'll make a test map and trigger it the way I would in one of my maps.
 
Status
Not open for further replies.
Top