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

Dummy caster help

Status
Not open for further replies.
Level 2
Joined
May 22, 2006
Messages
14
I have a trigger so that every time a unit casts Anti-Magic Shell, a dummy pops up, casts AMS on the caster and then disapears, so its as if you cast it on yourself and the target at the same time.

Events
Unit - A unit owned by Player 1 (Red) Is issued an order targeting an object

Conditions
(Issued order) Equal to (Order(antimagicshell))

Actions
Unit - Create 1 Dummy Caster for Player 1 (Red) at (Position of (Triggering unit)) facing Default building facing degrees
Wait 0.20 seconds
Unit - Order (Last created unit) to Undead Banshee - Anti-magic Shell (Triggering unit)
Unit - Remove (Last created unit) from the game

This works perfectly until the very end, when both my units that I want have the buff, but the dummy isn't removed! I've tried playing around with this but no matter what way I change it, either I get 2 dummys, all my units get removed or best of all my game crashes.

Any help is welcome.
 
Level 13
Joined
Nov 4, 2006
Messages
1,239
try using a little delay between casting and removing the unit which is 0.01 sec longer then the casting time of AMS and use a variable for the dummy

other possibility: use a second trigger, sth like
event: a unit enters playable map area
condition: triggering unit unit-type is equal to dummy
action:wait 1 sec
remove triggering unit from the game
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
Well, simply declare a lical variable using this custom script,
say your unit variable is called dummy; write it this way: local unit dummy
There is a bug that checks local variables be4 globals so it should make the spell mui. On the bottom of actions, add a custom line: set dummy = null to prevent memory leaks. This is tricky but should work.
 
Level 2
Joined
May 22, 2006
Messages
14
Thanks everybody I got it working now. For those interested final trigger was :

  • Events
    • Unit - A unit owned by Player 1 (Red) Is issued an order targeting an object
  • Conditions
    • (Issued order) Equal to (Order(antimagicshell))
    • (Unit-type of (Triggering unit)) Equal to Medic
  • Actions
    • Unit - Create 1 Dummy Caster for Player 1 (Red) at (Position of (Ordered unit)) facing Default building facing degrees
    • Set Unit = (Last created unit)
    • Unit - Order Unit to Undead Banshee - Anti-magic Shell (Triggering unit)
    • Wait 1.00 seconds
    • Unit - Remove Unit from the game
    • Set Unit = No unit
 
Level 3
Joined
Feb 16, 2008
Messages
20
I just want to say that I also add a phoenix hitpoint regeneration rate (-25) to my low-hit points dummy units. :grin:
 
Status
Not open for further replies.
Top