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

[General] Alternative to local casters and waits?

Status
Not open for further replies.
Level 5
Joined
Dec 25, 2018
Messages
110
I am using tons of local units with waits in my triggers, everything works fine but I am wondering if it might generate some problems in a long run?
I heard some bad things about wait function.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
It is hard to answer without seeing some example triggers, because it depends on how you used them.
 
Level 5
Joined
Dec 25, 2018
Messages
110
Example:
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability being cast) Equal to Spell1
  • Actions
    • Custom script: local unit udg_tempUnit
    • Set tempUnit = (Triggering unit)
    • Unit - Set Unit: tempUnit's Real Field: Animation - Run Speed ('urun') to Value: 50.00
    • Unit - Set Unit: tempUnit's Real Field: Animation - Walk Speed ('uwal') to Value: 50.00
    • Unit - Add Invulnerable (Neutral) to tempUnit
    • Wait 5.00 seconds
    • Unit - Set Unit: tempUnit's Real Field: Animation - Run Speed ('urun') to Value: 250.00
    • Unit - Set Unit: tempUnit's Real Field: Animation - Walk Speed ('uwal') to Value: 250.00
    • Unit - Remove Invulnerable (Neutral) from tempUnit
    • Wait 0.01 seconds
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • SecondStage Not equal to 1
      • Then - Actions
        • Set tempLoc = (Position of tempUnit)
        • Unit - Create 1 Dummy for (Owner of tempUnit) at tempLoc facing Default building facing degrees
        • Unit - Add Stun to (Last created unit)
        • Unit - Set level of Stun for (Last created unit) to 3
        • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt tempUnit
        • Custom script: call RemoveLocation (udg_tempLoc)
      • Else - Actions
    • Custom script: set udg_tempUnit = null
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
In this example you can just use "Triggering Unit", because its a completely safe event response. Things like "last created unit" or "target unit", "target unit of ability being cast" needs to be stored in variables if you need to use them after a wait.
 
Level 5
Joined
Dec 25, 2018
Messages
110
Perhaps that example was too simple, how about this one?:
  • Tormented Soul Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chaser spell
    • Actions
      • Custom script: local unit udg_Caster
      • Custom script: local player p=GetOwningPlayer(GetSpellTargetUnit())
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) has buff Poisoned ) Not equal to True
          • Or - Any (Conditions) are true
            • Conditions
              • (Target unit of ability being cast) Not equal to CurrentAbilityTarget[(Player number of (Owner of (Triggering unit)))]
              • AliveHeroes Less than or equal to 1
        • Then - Actions
          • Custom script: if GetLocalPlayer()==p then
          • Custom script: call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
          • Custom script: call SetCineFilterStartColor(0,0,0,0)
          • Custom script: call SetCineFilterEndColor(255,0,0,255)
          • Custom script: call SetCineFilterDuration(0.20)
          • Custom script: call DisplayCineFilter(true)
          • Custom script: endif
          • Set tempUnit = (Target unit of ability being cast)
          • Set CurrentAbilityTarget[(Player number of (Owner of (Triggering unit)))] = (Target unit of ability being cast)
          • Set tempLoc = ((Position of (Triggering unit)) offset by 256.00 towards (Facing of (Triggering unit)) degrees)
          • Special Effect - Create a special effect at tempLoc using Abilities\Spells\Items\RitualDagger\RitualDaggerTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Create 1 chaser for (Owner of (Triggering unit)) at tempLoc facing (Facing of (Triggering unit)) degrees
          • Unit - Change color of (Last created unit) to (Color of (Owner of tempUnit))
          • Unit - Add a 7.00 second Generic expiration timer to (Last created unit)
          • Unit - Pause (Last created unit)
          • Set Caster = (Last created unit)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at tempLoc facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add SPELL3 to (Last created unit)
          • Unit - Order (Last created unit) to Night Elf Druid Of The Talon - Faerie Fire tempUnit
          • Custom script: call RemoveLocation (udg_tempLoc)
          • Wait 0.40 seconds
          • Custom script: if GetLocalPlayer()==p then
          • Custom script: call SetCineFilterStartColor(255,0,0,255)
          • Custom script: call SetCineFilterEndColor(0,0,0,0)
          • Custom script: call SetCineFilterDuration(0.20)
          • Custom script: call DisplayCineFilter(true)
          • Custom script: endif
          • Wait 1.50 seconds
          • Unit - Unpause Caster
          • Special Effect - Create a special effect attached to the overhead of Caster using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
          • Set effectArray2[(Player number of (Owner of Caster))] = (Last created special effect)
          • Unit - Order Caster to Attack CurrentAbilityTarget[(Player number of (Owner of Caster))]
          • Wait 0.80 seconds
          • Unit - Set Caster movement speed to ((Current movement speed of Caster) + 25.00)
          • Wait 0.80 seconds
          • Unit - Set Caster movement speed to ((Current movement speed of Caster) + 50.00)
          • Wait 0.80 seconds
          • Unit - Set Caster movement speed to ((Current movement speed of Caster) + 50.00)
          • Wait 0.80 seconds
          • Unit - Set Caster movement speed to ((Current movement speed of Caster) + 60.00)
          • Wait 0.80 seconds
          • Unit - Set Caster movement speed to ((Current movement speed of Caster) + 70.00)
          • Wait 0.80 seconds
          • Special Effect - Destroy effectArray2[(Player number of (Owner of Caster))]
          • Unit - Set Caster movement speed to ((Current movement speed of Caster) + 80.00)
          • Custom script: set udg_Caster = null
        • Else - Actions
          • Unit - Remove SPELL2 from (Triggering unit)
          • Unit - Add SPELL2 to (Triggering unit)
 
Could you elabroate on this matter? Who said what exactly and why? Is there some public post, where one could read it up?
I mentioned it a while ago on the HIVE Discord and William (MindWorX) told me something along the line of it not working as of the latest patch. Sadly I can't find the conversation because it happened a few months ago.
 
Shadowing still works for me.

  • Start
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Trigger - Run Test <gen> (ignoring conditions)
      • Trigger - Run Test <gen> (ignoring conditions)
  • Test
    • Events
    • Conditions
    • Actions
      • Custom script: local string udg_Text
      • Set Text = (String((Execution count of (This trigger))))
      • Game - Display to (All players) the text: Text
      • Wait 2.00 seconds
      • Game - Display to (All players) the text: Text
With the global shadowed, it prints: 1, 2, 1, 2
Without the shadowing it prints: 1, 2, 2, 2

@MindWorX
 

Attachments

  • Shadowing Test.w3m
    12.4 KB · Views: 11
Level 5
Joined
Dec 25, 2018
Messages
110
Afaik variable shadowing (using global as local) no longer works as of latest patch (confirmed to me by a mod). Also you should not use waits in triggers that you want to be MUI.
I thought that declaring caster as local unit makes it MUI even if trigger has waits.
 
Status
Not open for further replies.
Top