• 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.

[Trigger] A replacement for waits? Help!

Status
Not open for further replies.
Level 6
Joined
Feb 21, 2008
Messages
205
  • Golem spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Elemental Rift
    • Actions
      • Set Blink_targetunit[30] = (Target unit of ability being cast)
      • Set Blinking_unit[30] = (Triggering unit)
      • Special Effect - Create a special effect attached to the chest of Blinking_unit[30] using Abilities\Spells\Undead\Cripple\CrippleTarget.mdl
      • Countdown Timer - Start Countdown_timer[30] as a One-shot timer that will expire in 0.15 seconds
      • Wait (Remaining time for Countdown_timer[30]) seconds
      • Set Blink_strike_point[30] = (Position of (Triggering unit))
      • Set Blink_strike_target[30] = ((Target point of ability being cast) offset by (0.00, 50.00))
      • Unit - Pause Blinking_unit[30]
      • Unit - Move Blinking_unit[30] instantly to Blink_strike_target[30], facing 180.00 degrees
      • Animation - Play Blinking_unit[30]'s attack animation
      • Countdown Timer - Start Countdown_timer2[30] as a One-shot timer that will expire in 0.50 seconds
      • Wait (Remaining time for Countdown_timer2[30]) seconds
      • Unit - Cause Blinking_unit[30] to damage Blink_targetunit[30], dealing 100.00 damage of attack type Spells and damage type Normal
      • Unit - Move Blinking_unit[30] instantly to Blink_strike_point[30]
      • Unit - Unpause Blinking_unit[30]
      • Countdown Timer - Start Countdown_timer3[30] as a One-shot timer that will expire in 0.50 seconds
      • Wait (Remaining time for Countdown_timer3[30]) seconds
      • Special Effect - Destroy (Last created special effect)
So, what this spell does:

A unit moves from his position, instantly to behind the target enemy unit, plays the attack animation, then deals 100 damage to the enemy, to then blink back. It works superb, But... it doesn't work at all when I have several units cast this spell, and I have no idea how to make it work with several instances. I believe ( I know ) the waits in this trigger is the problem. Since those wont work when I have to run this trigger several times at the same time. So what shall I do? Tried to search around, but couldn't find what I was looking for. (Ignore the waits /countdown timers, I found out that those were completely wrong to use).

Help!
 
You can't seriously use Timers to replace wait actions in GUI, especially if you want your trigger to be MUI.
When you put
  • Countdown Timer - Start Countdown_timer[30] as a One-shot timer that will expire in 0.15 seconds
  • Wait (Remaining time for Countdown_timer[30]) seconds
It's like
  • Wait (0.15) seconds
Timers are just slightly faster and better to use (but the difference is seen at the expiration time).

A way to make your spell MUI is to use "Triggering unit" in the whole trigger instead of setting it into a variable. Unfortunatly, you should do same for "Target unit of ability cast" and the others but they are not often MUI (meaning that after a wait, they will return null while "Triggering unit" will always return the good unit).

Another way is to use hashtables or variables array. There are tutorials on them (here for instance).
 
Level 11
Joined
Sep 12, 2008
Messages
657
i manged to fix it.. i didnt try it thought..
variables:
Blink_Count = Integer
Blink_Strike_Point = point array
Blink_Strike_Target = point array
Blink_Effect = Speical Effect Array
Blink_BlinkingUnit = Unit array
Blink_TargetUnit = Unit array

  • Golem Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Golem Spell
    • Actions
      • Set Blink_Count = (Blink_Count + 1)
      • Set Blink_TargetUnit[Blink_Count] = (Target unit of ability being cast)
      • Set Blink_BlinkingUnit[Blink_Count] = (Triggering unit)
      • Special Effect - Create a special effect attached to the chest of Blink_BlinkingUnit[Blink_Count] using Abilities/Spells/Undead/Cripple/CrippleTarget.mdl
      • Set Blink_Effect[Blink_Count] = (Last created special effect)
      • Wait 0.15 seconds
      • Set Blink_Strike_Point[Blink_Count] = (Position of (Triggering unit))
      • Set Blink_Strike_Target[Blink_Count] = ((Target point of ability being cast) offset by (0.00, 50.00))
      • Unit - Pause Blink_BlinkingUnit[Blink_Count]
      • Unit - Move (Target unit of ability being cast) instantly to Blink_Strike_Target[Blink_Count]
      • Animation - Play Blink_BlinkingUnit[Blink_Count]'s attack animation
      • Wait 0.50 seconds
      • Unit - Cause Blink_BlinkingUnit[Blink_Count] to damage Blink_TargetUnit[Blink_Count], dealing 100.00 damage of attack type Spells and damage type Normal
      • Unit - Move Blink_BlinkingUnit[Blink_Count] instantly to Blink_Strike_Point[Blink_Count]
      • Unit - Unpause Blink_BlinkingUnit[Blink_Count]
      • Wait 0.50 seconds
      • Special Effect - Destroy Blink_Effect[Blink_Count]
      • Custom script: call RemoveLocation(udg_Blink_Strike_Point[udg_Blink_Count])
      • Custom script: call RemoveLocation(udg_Blink_Strike_Target[udg_Blink_Count])
quick edit:
it might lag your game if casted way too much times, beware of that.
if you want me to remake it with hashtables, tell me, and ill happily do it.
 
Level 6
Joined
Feb 21, 2008
Messages
205
No freaking idea what hashtables is. But am super grateful for you're help, will try it out now.

Cheers dude=)

Edit: When I started the map I got an error from the custom scripts. I used common sense and placed 2 [] in em. Like this:

  • Custom script: call RemoveLocation([udg_Blink_Strike_Point][udg_Blink_Count])
  • Custom script: call RemoveLocation([udg_Blink_Strike_Target][udg_Blink_Count])
Seemed like that stopped the errors. But it doesn't work yet, and I think I found a slight error here.

  • Unit - Move (Target unit of ability being cast) instantly to Blink_strike_target[Blink_Count], facing 180.00 degrees
I want to move the blink_blinkingunit rather don't I? Not the "target unit of ability being cast). Anyways, Will change it now to see if it works.

Edit 2: Nvm about the custom script thing I said, checked some other triggers on the forum and they don't have the ekstra [], so stuck atm : <
 
Last edited:
Level 11
Joined
Sep 12, 2008
Messages
657
allright, change the trget unit of ability behing cast to the triggerunit/blinking_unit.

hashtable: its like saving a code, then reusing it later on the game,
its like saving each unit in the game as its own number, then re-use it later, to set up each unit diffrently.. its like my counter, just no lags, and leakless..
im working on it right now for you..
 
Level 6
Joined
Feb 21, 2008
Messages
205
hmm, well not all of them are needed I think. The first one is to create the special effect before the blinks to them, so people can see where he blinked from, because.. hmm.. the spell kinda draws a line in the air if u know what am saying.

The next one is to let him actually finish the animation of attack, so it looks visually good.

The last one is to keep the special effect while blinking back aswell.

Ofc, all of these can be removed, as I told my friend. But then again, then it would be a simple ranged damaging ability that deals 100 damage.
 
Level 11
Joined
Sep 12, 2008
Messages
657
Allright, this is the code


Creating And Setting Hashtables
  • Setting Hashtables
    • Events
      • Time - Elapsed game time is 0.05 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Blink_Hashtable = (Last created hashtable)
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Picked unit) as 1 of (Key (Picked unit)) in Blink_Hashtable
Just to make sure EVERY unit gets inside here.
  • Setting Hashtables 2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Hashtable - Save Handle Of(Triggering unit) as 1 of (Key (Picked unit)) in Blink_Hashtable
Golem Spell Cast
  • Golem Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Asassin Instant Hit
    • Actions
      • Set Blink_Count = (Load 1 of (Key (Triggering unit)) from Blink_Hashtable)
      • Set Blink_BlinkingUnit[Blink_Count] = (Triggering unit)
      • Set Blink_TargetUnit[Blink_Count] = (Target unit of ability being cast)
      • Set Blink_Strike_Point[Blink_Count] = (Position of (Triggering unit))
      • Set Blink_Strike_Target[Blink_Count] = (Position of (Target unit of ability being cast))
      • Special Effect - Create a special effect attached to the chest of Blink_BlinkingUnit[Blink_Count] using Abilities/Spells/Undead/Cripple/CrippleTarget.mdl
      • Set Blink_Effect[Blink_Count] = (Last created special effect)
      • Unit - Pause Blink_BlinkingUnit[Blink_Count]
      • Unit - Move Blink_BlinkingUnit[Blink_Count] instantly to Blink_Strike_Target[Blink_Count]
      • Animation - Play Blink_BlinkingUnit[Blink_Count]'s attack animation
      • Unit Group - Add Blink_TargetUnit[Blink_Count] to Blink_Group
      • Set Blink_WaitDuration1[Blink_Count] = 0.50
      • Set Blink_WaitDuration2[Blink_Count] = 0.50
Golem spell loop 1
  • Golem Spell 2
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Blink_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Blink_WaitDuration1[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)] Equal to 0.00
            • Then - Actions
              • Unit - Cause Blink_BlinkingUnit[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)] to damage Blink_TargetUnit[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)], dealing 100.00 damage of attack type Spells and damage type Normal
              • Unit - Unpause Blink_BlinkingUnit[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)]
              • Unit - Move Blink_BlinkingUnit[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)] instantly to Blink_Strike_Point[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)]
            • Else - Actions
              • Set Blink_WaitDuration1[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)] = (Blink_WaitDuration1[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)] - 0.05)
Golem spell loop 2
  • Golem Spell Effect
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Blink_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Blink_WaitDuration2[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)] Equal to 0.00
            • Then - Actions
              • Special Effect - Destroy Blink_Effect[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)]
              • Unit Group - Remove (Picked unit) from Blink_Group
            • Else - Actions
              • Set Blink_WaitDuration2[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)] = (Blink_WaitDuration2[(Load (Key (Picked unit)) of 1 from Blink_Hashtable)] - 0.05)


Allright, just play with the wait durations in cast trigger.

demo map: http://www.hiveworkshop.com/forums/pastebin.php?id=eiwent
 
Level 6
Joined
Feb 21, 2008
Messages
205
Hmm, at first hand, it seems to work. Except from there's no spell effect, but I guess am just being silly, I'll fix that myself. But there's another problem, When I tested 8ish golems at once. They 2 of them paused themself and never unpaused
 
Status
Not open for further replies.
Top