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

[Trigger] Problem with ability trigger.. Can't cast with more than one unit.

Status
Not open for further replies.
Level 6
Joined
Apr 23, 2009
Messages
94
  • Untitled Trigger 002
    • Events
      • Unit - A unit owned by Player 1 (Red) Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Fortify Wall
    • Actions
      • Wait 4.00 seconds
      • If ((Ability being cast) Equal to Fortify Wall ) then do (Destructible - Kill (Target destructible of ability being cast)) else do (Do nothing)
      • If ((Ability being cast) Equal to Fortify Wall ) then do (Unit - Create 1 Fortified Wall for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees) else do (Do nothing)
So if i cast this, and say.. 2 seconds in, i cast this same ability with a different unit, it cancels the first units "Destuctible - Kill" and it's "Unit - Create" ends up spawning in the middle of the map.. And to top it off, the second one casting steals the first casters wait time.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
  • Untitled Trigger 002
    • Events
      • Unit - A unit owned by Player 1 (Red) Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Fortify Wall
    • Actions
      • Wait 4.00 seconds
      • If ((Ability being cast) Equal to Fortify Wall ) then do (Destructible - Kill (Target destructible of ability being cast)) else do (Do nothing)
      • If ((Ability being cast) Equal to Fortify Wall ) then do (Unit - Create 1 Fortified Wall for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees) else do (Do nothing)
So if i cast this, and say.. 2 seconds in, i cast this same ability with a different unit, it cancels the first units "Destuctible - Kill" and it's "Unit - Create" ends up spawning in the middle of the map.. And to top it off, the second one casting steals the first casters wait time.

You can use waits but you must set all to variables before waiting and you must not change the variables last 4 seconds

set TARGET = Target destructible of ability being cast...
wait 4 seconds
kill TARGET
 
Level 9
Joined
Apr 25, 2009
Messages
468
I suggest you use Timers. Create a timer, make a new trigger with event "Timer expires" then do your actions there. + you must set the target destructible...
 
Level 6
Joined
Apr 23, 2009
Messages
94
I suggest you use Timers. Create a timer, make a new trigger with event "Timer expires" then do your actions there. + you must set the target destructible...

I did that, but i still get an override when more than one unit casts the spell at the same time.. Heres what it looks like now.
  • Untitled Trigger 002
    • Events
      • Unit - A unit owned by Player 1 (Red) Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Fortify Wall
    • Actions
      • Set TARGET = (Target destructible of ability being cast)
      • Set POINT = (Position of TARGET)
      • Countdown Timer - Start dfgsg as a Repeating timer that will expire in 4.00 seconds
And
  • Untitled Trigger 021
    • Events
      • Time - dfgsg expires
    • Conditions
    • Actions
      • Destructible - Kill TARGET
      • Unit - Create 1 Fortified Wall for Player 1 (Red) at POINT facing Default building facing degrees
And changing the timer from "Repeating" to "One-Shot" gives the same result.
 
Level 9
Joined
May 27, 2006
Messages
498
Uhm.
Just give the ability a casting time, like 2 sec. (in Object Editor)
Then create a trigger with event Unit starts effect of an ability and actions as in your first trigger. Just remove the wait and put the actions out of if-statements, since they're not needed when you have the condition checked.
This should work. In case it wont, you'll need to use locals.
 
Level 6
Joined
Apr 23, 2009
Messages
94
Uhm.
Just give the ability a casting time, like 2 sec. (in Object Editor)
Then create a trigger with event Unit starts effect of an ability and actions as in your first trigger. Just remove the wait and put the actions out of if-statements, since they're not needed when you have the condition checked.
This should work. In case it wont, you'll need to use locals.

You rock, thanks man. Works perfect now.
How do I give you +rep ?
 
Status
Not open for further replies.
Top