• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Custom Spell Trigger

Status
Not open for further replies.
Level 1
Joined
Sep 8, 2017
Messages
4
I built a custom spell that uses a spell like blizzard and picks all the units within that area and creates a gryphon rider off set from that unit, the gryphon is ordered to move towards a point past the target unit and spawn a dummy unit that is modeled as a storm hammer which will drop in height over time and when it hits the target, then it should make the unit be stunned for a duration and take damage. Right now I have this
upload_2017-9-8_3-23-50.png

From testing I can see the gryphon is spawned and goes to its point. After it flies over the target, the target begins to attack me. No damage is dealt to the target, the storm hammer dummy never is spawned and the gryphon never despawns. Thanks in advance for any help
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
You are using waits. Most functions like "Casting Unit", "Last Created Unit" do not return the correct values after you used a wait.
I would try to avoid using waits, as they are very inaccurate and lead to these problems, if you do not save your variables correctly.
In general you should not have any waits in spells. They are good enough for cinematics in most cases though.
 
Level 1
Joined
Sep 8, 2017
Messages
4
Thanks for your reply, so instead of using waits what else should I do? There is no way to correctly label created units since the amount of units created depends on how many units are in the range of the spell. I thought I could make a forloop instead from 1-number of units in range of ability. And then use the loop number to label my units with a unit array variable. And then picking targets I'd have to create a system where targets already hit have a custom value. The problem with that would be it'd create their birds one at a time and do the waits rather than doing them all at once like I wanted. What do you suggest?
You are using waits. Most functions like "Casting Unit", "Last Created Unit" do not return the correct values after you used a wait.
I would try to avoid using waits, as they are very inaccurate and lead to these problems, if you do not save your variables correctly.
In general you should not have any waits in spells. They are good enough for cinematics in most cases though.
 
Level 1
Joined
Sep 8, 2017
Messages
4
I solved my issue using multiple for loops. Here is the trigger
  • Rain Hammers
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Rain Hammers
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of (Ability being cast) for (Casting unit)) Equal to 1
        • Then - Actions
          • Set Area[1] = 200.00
          • Set Damage[0] = 100
          • Set Stun = 1.00
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Ability being cast) for (Casting unit)) Equal to 2
            • Then - Actions
              • Set Area[1] = 250.00
              • Set Damage[0] = 250
              • Set Stun = 1.50
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of (Ability being cast) for (Casting unit)) Equal to 3
                • Then - Actions
                  • Set Area[1] = 300.00
                  • Set Damage[0] = 400
                  • Set Stun = 2.00
                • Else - Actions
      • Set UnitInRange = (Number of units in (Units within Area[1] of (Target point of ability being cast) matching ((Owner of (Matching unit)) Not equal to (Owner of (Casting unit)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitInRange Equal to 0
        • Then - Actions
          • Sound - Play GryphonRiderPissed3 <gen> at 100.00% volume, located at (Target point of ability being cast) with Z offset 240.00
        • Else - Actions
          • Set CreatedUnit[0] = (Casting unit)
          • Sound - Play GryphonRiderYesAttack1 <gen> at 100.00% volume, located at (Target point of ability being cast) with Z offset 240.00
          • For each (Integer A) from 1 to UnitInRange, do (Actions)
            • Loop - Actions
              • Set TargetUnit[(Integer A)] = (Random unit from (Units within Area[1] of (Target point of ability being cast) matching (((Custom value of (Matching unit)) Not equal to 10) and ((Owner of (Matching unit)) Not equal to (Owner of CreatedUnit[0])))))
              • Set DamageReader[(Integer A)] = (Life of TargetUnit[(Integer A)])
              • Set Angle = -45.00
              • Set RandomPoint = ((Position of TargetUnit[(Integer A)]) offset by 400.00 towards (Angle + 180.00) degrees)
              • Unit - Create 1 Dummy Bird for Neutral Passive at ((Position of TargetUnit[(Integer A)]) offset by 400.00 towards Angle degrees) facing (Position of TargetUnit[(Integer A)])
              • Set CreatedUnit[(Integer A)] = (Last created unit)
              • Unit - Order CreatedUnit[(Integer A)] to Move To (RandomPoint offset by (0.00, 0.00))
              • Unit - Set the custom value of TargetUnit[(Integer A)] to 1
          • Wait 0.77 seconds
          • Sound - Play GryphonRiderReady1 <gen> at 100.00% volume, located at (Target point of ability being cast) with Z offset 240.00
          • For each (Integer A) from 1 to UnitInRange, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Storm Bolt for Neutral Passive at (Position of CreatedUnit[(Integer A)]) facing (Position of (Picked unit))
              • Set CreatedUnit2[(Integer A)] = (Last created unit)
              • Animation - Change CreatedUnit2[(Integer A)] flying height to (Current flying height of TargetUnit[(Integer A)]) at (((Current flying height of CreatedUnit2[(Integer A)]) - (Current flying height of TargetUnit[(Integer A)])) / 0.50)
          • Wait 0.50 seconds
          • For each (Integer A) from 1 to UnitInRange, do (Actions)
            • Loop - Actions
              • Unit - Remove CreatedUnit2[(Integer A)] from the game
              • Unit - Pause TargetUnit[(Integer A)]
              • Unit - Cause CreatedUnit[0] to damage TargetUnit[(Integer A)], dealing (Real(Damage[0])) damage of attack type Spells and damage type Normal
              • Sound - Play ThunderBoltMissileDeath <gen> at 100.00% volume, attached to TargetUnit[(Integer A)]
              • Floating Text - Create floating text that reads (String((Integer((DamageReader[(Integer A)] - (Life of TargetUnit[(Integer A)])))))) above TargetUnit[(Integer A)] with Z offset 0.00, using font size 10.00, color (0.00%, 0.00%, 100.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
              • Special Effect - Create a special effect attached to the overhead of TargetUnit[(Integer A)] using Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
              • Set SpecialEffect[(Integer A)] = (Last created special effect)
          • Wait 0.27 seconds
          • For each (Integer A) from 1 to UnitInRange, do (Actions)
            • Loop - Actions
              • Unit - Remove CreatedUnit[(Integer A)] from the game
          • Wait (Stun - 0.27) seconds
          • For each (Integer A) from 1 to UnitInRange, do (Actions)
            • Loop - Actions
              • Unit - Unpause TargetUnit[(Integer A)]
              • Special Effect - Destroy SpecialEffect[(Integer A)]
              • Unit - Set the custom value of TargetUnit[(Integer A)] to 0
Thanks for telling me how to put in my trigger :)
 
Last edited:
Status
Not open for further replies.
Top