• 🏆 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!

[Trigger] Need some help

Status
Not open for further replies.
Level 6
Joined
Sep 27, 2008
Messages
258
Ok so i always read that
  • Wait X seconds
this is bad or not good to use but i don't know how not to use it so i need help fixing that with this
  • Wolf Fang
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Wolf Fang Fist
    • Actions
      • Set Caster[3] = (Triggering unit)
      • Set CasterLoc[2] = (Position of Caster[3])
      • Set integer_variable[3] = (Level of (Ability being cast) for Caster[3])
      • Set Target[1] = (Target unit of ability being cast)
      • Unit - Pause Target[1]
      • Unit - Pause Caster[3]
      • Unit - Make Caster[3] Invulnerable
      • Unit - Make Target[1] Invulnerable
      • Special Effect - Create a special effect at CasterLoc[2] using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
      • Animation - Play Caster[3]'s attack animation
      • Special Effect - Create a special effect at CasterLoc[2] using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
      • Floating Text - Create floating text that reads Wolf at TargetPoint[1] with Z offset 30.00, using font size 20.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Set WolfFang_FT = (Last created floating text)
      • Special Effect - Destroy (Last created special effect)
      • Wait 0.45 seconds
      • Animation - Play Caster[3]'s attack animation
      • Special Effect - Create a special effect at CasterLoc[2] using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
      • Floating Text - Change text of WolfFang_FT to Fang using font size 20.00
      • Special Effect - Destroy (Last created special effect)
      • Wait 0.55 seconds
      • Animation - Play Caster[3]'s attack animation
      • Special Effect - Create a special effect at CasterLoc[2] using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
      • Floating Text - Change text of WolfFang_FT to Fist using font size 20.00
      • Special Effect - Destroy (Last created special effect)
      • Unit - Unpause Target[1]
      • Unit - Unpause Caster[3]
      • Unit - Make Caster[3] Vulnerable
      • Unit - Make Target[1] Vulnerable
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • integer_variable[3] Greater than 0
        • Then - Actions
          • Unit - Cause Caster[3] to damage Target[1], dealing ((Real(integer_variable[3])) x 400.00) damage of attack type Spells and damage type Normal
        • Else - Actions
      • Set KBA_Caster = Caster[3]
      • Set KBA_TargetUnit = Target[1]
      • Set KBA_StartingPosition = CasterLoc[2]
      • Set KBA_Level = (Level of (Ability being cast) for Caster[3])
      • Set KBA_Speed = 10.00
      • Set KBA_DistancePerLevel = 250.00
      • Set KBA_SpecialEffects[1] = Objects\Spawnmodels\Orc\OrcSmallDeathExplode\OrcSmallDeathExplode.mdl
      • Set KBA_SpecialEffects[2] = Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
      • Set KBA_DestroyTrees = True
      • Wait 0.20 seconds
      • Trigger - Run Cast A Knockback <gen> (checking conditions)
      • Floating Text - Destroy WolfFang_FT
      • Custom script: call DestroyTextTag( udg_Combo_FT )
      • Custom script: call RemoveLocation (udg_CasterLoc[2])
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
You can create a second trigger that runs loop with time event (lets say every 0.05 sec).

You want to wait 0.45 sec?
Instead of this:
  • Wait 0.45 seconds
Do this:
  • Set Time[Index] = 0.45
And in loop:
  • Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set Time[Index] = (Time[Index] - 0.05)
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Time[Index] Less or equal to 0.00
        • Then - Actions
          • <your actions>
        • Else - Actions
Index means proper indexing for real variable Time[Index] for making it MUI. However I see that your spell isn't MUI at all..

For multiple actions divided in time you can use Time[Index] followed by integer variable, which would be an additional condition.
Lets say, when Int[Index] = 1 and Time[] reaches 0.00, you do actions:
  • If (All conditions are true) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Time[Index] Less or equal to 0.00
    • Then - Actions
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Time[Index] Less or equal to 0.00
          • Int[Index] = 1
        • Then - Actions
          • <your actions>
          • Animation - Play Caster[3]'s attack animation
          • Special Effect - Create a special effect at CasterLoc[2] using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
          • Floating Text - Change text of WolfFang_FT to Fang using font size 20.00
          • Special Effect - Destroy (Last created special effect)
          • Set Time[Index] = 0.55
          • Set Int[Index] = 2
Then you want to wait 0.55 so we set Timer[Index] again, but this time to 0.55, and integer variable Int[Index] to 2.
When that reaches 0.00 you follow this with next part of actions.
  • If (All conditions are true) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Time[Index] Less or equal to 0.00
    • Then - Actions
      • If (All conditions are true) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Time[Index] Less or equal to 0.00
          • Int[Index] = 1
        • Then - Actions
          • <your actions>
          • Animation - Play Caster[3]'s attack animation
          • Special Effect - Create a special effect at CasterLoc[2] using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
          • Floating Text - Change text of WolfFang_FT to Fang using font size 20.00
          • Special Effect - Destroy (Last created special effect)
          • Set Time[Index] = 0.55
          • Set Int[Index] = 2
        • Else - Actions
          • <next part of actions>
Ofcourse your loop needs to end somewhere, your job to do this.

Hashtables can help here too, they are much safer. Click here for great Hash tutorial. I bet tons of people sent you this link, but wyrmlord shows there an egzample how to trigger proper MUI Healing over Time spell, you can learn from it.
 
Last edited:
Level 6
Joined
Sep 27, 2008
Messages
258
so if i make a trigger that only unit A uses for one of his spells an there is only 1 unit A on the map which uses waits
will it bug the trigger really badly?
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
If you make triggers only for one unit, you spell is not spammed by it, there is nothing wrong with Waits, furthermore TriggerSleepAction() gives your Warcraft3 small break which reduces lag.

You can even check democampaign in warcraft3 folder how blizzard uses waits for many triggers - but its only for one occasion, for one unit.
 
Level 6
Joined
Sep 27, 2008
Messages
258
thats good to know now i won't have to redo my triggers

i will give you rep when i can Spinnaker but says i need to spread it around more...
 
Status
Not open for further replies.
Top