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

Status
Not open for further replies.
Level 3
Joined
Jul 26, 2013
Messages
41
  • Phantom Strikes
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Phantom Strikes
    • Actions
      • Set PS_Caster = (Triggering unit)
      • Trigger - Turn on Phantom Strikes 1 <gen>
      • Trigger - Turn on Phantom Strikes level up <gen>
  • Phantom Strikes level up
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Level of Phantom Strikes for PS_Caster) Equal to 2
    • Actions
      • Trigger - Turn on Phantom Strikes 2 <gen>
      • Trigger - Turn on Phantom Strikes level up 2 <gen>
      • Trigger - Turn off (This trigger)
  • Phantom Strikes level up 2
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Level of Phantom Strikes for PS_Caster) Equal to 3
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on Phantom Strikes 3 <gen>
  • Phantom Strikes 1
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
      • (PS_Caster is alive) Equal to True
    • Actions
      • Set PS_loc = (Position of PS_Caster)
      • Set PS_eg = (Units within 800.00 of PS_loc matching ((((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of PS_Caster)) Equal to True)) and (((Matching unit) is hidden)
      • Set PS_Target = (Random unit from PS_eg)
      • Set PS_loc2 = (Position of PS_Target)
      • Unit - Create 1 Rogue Dummy for (Owner of PS_Caster) at (PS_loc2 offset by 100.00 towards (Random angle) degrees) facing PS_loc2
      • Set PS_Dummy1 = (Last created unit)
      • Unit - Order PS_Dummy1 to Attack PS_Target
      • Animation - Change PS_Dummy1's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Animation - Change PS_Dummy1's animation speed to 200.00% of its original speed
      • Animation - Change PS_Dummy1 turn speed to 1.00
      • Wait 0.40 seconds
      • Unit - Remove PS_Dummy1 from the game
      • Custom script: call RemoveLocation(udg_PS_loc)
      • Custom script: call RemoveLocation(udg_PS_loc2)
      • Custom script: call DestroyGroup(udg_PS_eg)
  • Phantom Strikes 2
    • Events
      • Time - Every 2.50 seconds of game time
    • Conditions
      • (PS_Caster is alive) Equal to True
    • Actions
      • Set PS_loc = (Position of PS_Caster)
      • Set PS_eg = (Units within 800.00 of PS_loc matching ((((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of PS_Caster)) Equal to True)) and (((Matching unit) is hidden)
      • Set PS_Target = (Random unit from PS_eg)
      • Set PS_loc2 = (Position of PS_Target)
      • Unit - Create 1 Rogue Dummy for (Owner of PS_Caster) at (PS_loc2 offset by 100.00 towards (Random angle) degrees) facing PS_loc2
      • Set PS_Dummy2 = (Last created unit)
      • Unit - Order PS_Dummy2 to Attack PS_Target
      • Animation - Change PS_Dummy2's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Animation - Change PS_Dummy2's animation speed to 200.00% of its original speed
      • Animation - Change PS_Dummy2 turn speed to 1.00
      • Wait 0.40 seconds
      • Unit - Remove PS_Dummy2 from the game
      • Custom script: call RemoveLocation(udg_PS_loc)
      • Custom script: call RemoveLocation(udg_PS_loc2)
      • Custom script: call DestroyGroup(udg_PS_eg)
  • Phantom Strikes 3
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • (PS_Caster is alive) Equal to True
    • Actions
      • Set PS_loc = (Position of PS_Caster)
      • Set PS_eg = (Units within 800.00 of PS_loc matching ((((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of PS_Caster)) Equal to True)) and (((Matching unit) is hidden)
      • Set PS_Target = (Random unit from PS_eg)
      • Set PS_loc2 = (Position of PS_Target)
      • Unit - Create 1 Rogue Dummy for (Owner of PS_Caster) at (PS_loc2 offset by 100.00 towards (Random angle) degrees) facing PS_loc2
      • Set PS_Dummy3 = (Last created unit)
      • Unit - Order PS_Dummy3 to Attack PS_Target
      • Animation - Change PS_Dummy3's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Animation - Change PS_Dummy3's animation speed to 200.00% of its original speed
      • Animation - Change PS_Dummy3 turn speed to 1.00
      • Wait 0.40 seconds
      • Unit - Remove PS_Dummy3 from the game
      • Custom script: call RemoveLocation(udg_PS_loc)
      • Custom script: call RemoveLocation(udg_PS_loc2)
      • Custom script: call DestroyGroup(udg_PS_eg)
I have that badass mofo trigger and it keeps spawning the dummyes on the middle of the map if there are no valid targets nearby, that would be my main problem so far. I'm sure you will pin point alot more so leave it in the reply. Thank you.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
that is, because you never check if the group is actually empty, and performing the Random unit from PS_eg will return null if group is empty and PS_loc2 will be at the middle of map

The wait kills your trigger when it comes to working.
You can just Apply timed life to unit(there is action in GUI) and have no wait for it
Using that however, make sure the unit in object editor is set to cant raise, does not decay so it is removed from game when it dies

When you create rouge, you can instead of creating it at Random Angle create him at Angle Between Points(PS_loc, PS_loc2), that should make the rouge face the target right away

Is this spell supposed to work with multiple units casting it at once? Because currently it wont, but if you dont need it to be MUI/MPI, its not issue
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
in betwen these lines
  • Set PS_eg = (Units within 800.00 of PS_loc matching ((((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of PS_Caster)) Equal to True)) and (((Matching unit) is hidden)
  • Set PS_Target = (Random unit from PS_eg)
add something like

if number of units in PS_eg < 1 skip remaining actions

edit// What edo494 said ^
 
Level 3
Joined
Jul 26, 2013
Messages
41
Thanks for the quick reply. It is intended for just 1 unit to have this skill. Also, is there a problem if I have just 2 variables for locations? do I need a location variable for each of the 3 dummyes?
 
Level 3
Joined
Jul 26, 2013
Messages
41
that is, because you never check if the group is actually empty, and performing the Random unit from PS_eg will return null if group is empty and PS_loc2 will be at the middle of map

The wait kills your trigger when it comes to working.
You can just Apply timed life to unit(there is action in GUI) and have no wait for it
Using that however, make sure the unit in object editor is set to cant raise, does not decay so it is removed from game when it dies

When you create rouge, you can instead of creating it at Random Angle create him at Angle Between Points(PS_loc, PS_loc2), that should make the rouge face the target right away

Is this spell supposed to work with multiple units casting it at once? Because currently it wont, but if you dont need it to be MUI/MPI, its not issue

Does this look good...?
  • Phantom Strikes 1
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
      • (PS_Caster is alive) Equal to True
    • Actions
      • Set PS_loc = (Position of PS_Caster)
      • Set PS_eg = (Units within 800.00 of PS_loc matching ((((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of PS_Caster)) Equal to True)) and (((Matching unit) is hidden)
      • If ((Number of units in PS_eg) Equal to 0) then do (Skip remaining actions) else do (Do nothing)
      • Set PS_Target = (Random unit from PS_eg)
      • Set PS_loc2 = (Position of PS_Target)
      • Unit - Create 1 Rogue Dummy for (Owner of PS_Caster) at (PS_loc2 offset by 100.00 towards (Random angle) degrees) facing PS_loc2
      • Unit - Create 1 Rogue Dummy for (Owner of PS_Caster) at (PS_loc2 offset by 70.00 towards (Angle from PS_loc to PS_loc2) degrees) facing (Angle from PS_loc to PS_loc2) degrees
      • Set PS_Dummy1 = (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to PS_Dummy1
      • Unit - Order PS_Dummy1 to Attack PS_Target
      • Animation - Change PS_Dummy1's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Animation - Change PS_Dummy1's animation speed to 200.00% of its original speed
      • Animation - Change PS_Dummy1 turn speed to 1.00
      • Custom script: call RemoveLocation(udg_PS_loc)
      • Custom script: call RemoveLocation(udg_PS_loc2)
      • Custom script: call DestroyGroup(udg_PS_eg)
P.S. I didn't really find the Angle as you said it, and I know there are 2 Dummyes atm in the trigger.

EDIT: Can't Raise, Does not Decay doesn't work pretty good. The Dummy is a HERO and he just dies after the expiration time instead of just disssapearing (I can see the dummys death animation\sound and him rising up in the air)
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
well it is good now, you wont fail to clear the handles, and its not issue really, you give unit plenty time to turn and hit him most likely

The locations now are problem, because PS_loc2 offset by 100 silently creates new Location, you should do something like:
  • Set PS_loc = (PS_loc2 offset by 100.00 towards (Random angle) degrees)
  • Unit - Create 1 Rogue Dummy for (Owner of PS_Caster) at (PS_loc2 offset by 100.00 towards (Random angle) degrees) facing PS_loc2
  • Custom script: call RemoveLocation(udg_PS_loc)
  • Set PS_loc = (PS_loc2 offset by 70.00 towards (Random angle) degrees)
  • Unit - Create 1 Rogue Dummy for (Owner of PS_Caster) at (PS_loc2 offset by 70.00 towards (Angle from PS_loc to PS_loc2) degrees) facing (Angle from PS_loc to PS_loc2) degrees
  • Custom script: call RemoveLocation(udg_PS_loc)

Im using PS_loc again, so you dont need to declare third location, and you dont use PS_loc after declaring PS_loc2

The last udg_PS_loc removing can be ommited if you keep yours in place, because removing the same location 2 times makes no difference

However, now you are leaking group with the if block, make the multiple if-then-else and check if number of units is less equal to 0(as you do), if it is Custom script: call DestroyGroup(udg_PS_eg)
and then Skip remaining actions

also if we go to a bit strictier optimizations

  • (((Matching unit) is A structure) Not equal to True)

can be changed to

  • (((Matching unit) is A structure) equal to False)
 
Level 3
Joined
Jul 26, 2013
Messages
41
  • Phantom Strikes 1
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
      • (PS_Caster is alive) Equal to True
    • Actions
      • Set PS_loc = (Position of PS_Caster)
      • Set PS_eg = (Units within 800.00 of PS_loc matching ((((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of PS_Caster)) Equal to True)) and (((Matching unit) is hidden) No
      • If ((Number of units in PS_eg) Equal to 0) then do (Skip remaining actions) else do (Do nothing)
      • Set PS_Target = (Random unit from PS_eg)
      • Set PS_loc2 = (Position of PS_Target)
      • Set PS_loc3 = (PS_loc2 offset by 50.00 towards (Angle from PS_loc to PS_loc2) degrees)
      • Unit - Create 1 Rogue Dummy for (Owner of PS_Caster) at PS_loc3 facing PS_loc2
      • Set PS_Dummy1 = (Last created unit)
      • Unit - Order PS_Dummy1 to Attack PS_Target
      • Animation - Change PS_Dummy1's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Animation - Change PS_Dummy1's animation speed to 250.00% of its original speed
      • Animation - Change PS_Dummy1 turn speed to 1.00
      • Hero - Set (Last created unit) Hero-level to (Hero level of PS_Caster), Hide level-up graphics
      • Hero - Create (Item-type of (Item carried by PS_Caster in slot 1)) and give it to (Last created unit)
      • Hero - Create (Item-type of (Item carried by PS_Caster in slot 2)) and give it to (Last created unit)
      • Hero - Create (Item-type of (Item carried by PS_Caster in slot 3)) and give it to (Last created unit)
      • Hero - Create (Item-type of (Item carried by PS_Caster in slot 4)) and give it to (Last created unit)
      • Hero - Create (Item-type of (Item carried by PS_Caster in slot 5)) and give it to (Last created unit)
      • Hero - Create (Item-type of (Item carried by PS_Caster in slot 6)) and give it to (Last created unit)
      • Wait 0.40 seconds
      • Unit - Remove PS_Dummy1 from the game
      • Custom script: call RemoveLocation(udg_PS_loc)
      • Custom script: call RemoveLocation(udg_PS_loc2)
      • Custom script: call RemoveLocation(udg_PS_loc3)
      • Custom script: call DestroyGroup(udg_PS_eg)
This is what I've managed to do in the end.. it looks good ingame and I guess all leaks are solved, the problem would be the 0.4 wait but I didn't manage to fix it with expiration time
 
Status
Not open for further replies.
Top