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

[Solved] Unit move order after revive

Status
Not open for further replies.
Level 7
Joined
Sep 19, 2012
Messages
204
Hey guys. Me again ^^

I got a Unit that uses the Kaboom ability to blow up the enemies and then revives.

My problem now is that my trigger, that should send them towards the enemy after they got revived, doesnt work.
Any idea?

  • Kaboom Effect and Heal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Kaboom! ()
          • (Ability being cast) Equal to Kaboom! (Nuclear)
    • Actions
      • Unit Group - Add (Casting unit) to Temp_Whispgrp
  • whisp move
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Temp_Whispgrp and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 6 (Orange)
            • Then - Actions
              • Set temp_point = (Position of Throne Hall 0010 <gen>)
              • Unit - Order (Picked unit) to Attack-Move To temp_point
              • Custom script: call RemoveLocation (udg_temp_point)
              • Unit Group - Remove (Picked unit) from Temp_Whispgrp
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Picked unit)) Equal to Player 12 (Brown)
                • Then - Actions
                  • Set temp_point = (Position of Throne Hall 0009 <gen>)
                  • Unit - Order (Picked unit) to Attack-Move To temp_point
                  • Custom script: call RemoveLocation (udg_temp_point)
                  • Unit Group - Remove (Picked unit) from Temp_Whispgrp
                • Else - Actions
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
Are you sure that the first trigger works? Maybe add a text message to see if the first trigger works.
You order them to attack move. Can they even attack? Your units need to have an attack to be able to attack-move.
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
Could you add this text message above the first if in the second trigger. Then you would know how many units are in the group.
  • Game - Display to (All players) the text: (String((Number of units in Temp_Wispgrp)))
How are you reviving these units?

Do they start moving and stop then or are they not moving at all?
 
Level 7
Joined
Sep 19, 2012
Messages
204
Could you add this text message above the first if in the second trigger. Then you would know how many units are in the group.
  • Game - Display to (All players) the text: (String((Number of units in Temp_Wispgrp)))
How are you reviving these units?

Do they start moving and stop then or are they not moving at all?

just checked as you said...adding them seems to work

i revive them with the help of the reincarnation ability.
They get spawned, move along the lane, blow up, get revived and then...well... they bake in the sun...
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
Ah I think I could have found it. If the second trigger runs while they are dead it does not work and they are removed from the group. How long have you set your reincarnation ability?
You could add a condition if the unit is alive, so the unit gets not removed if it's still dead.
 
Level 7
Joined
Sep 19, 2012
Messages
204
Ah I think I could have found it. If the second trigger runs while they are dead it does not work and they are removed from the group. How long have you set your reincarnation ability?
You could add a condition if the unit is alive, so the unit gets not removed if it's still dead.

still doesnt work...as far as i know units that have this ability and it is not on cooldown dont really count as "dead" while they are waiting to be revived. :/
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
the function is unit alive returns false for units with reincarnation just checked it.

Create a new boolean variable Boolean and use these functions instead of your Unit-Order function.
  • Custom script: set udg_Boolean = IssuePointOrderLocBJ( GetEnumUnit(), "attack", udg_temp_point )
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Boolean Equal to True
    • Then - Actions
      • Game - Display to (All players) the text: true
    • Else - Actions
      • Game - Display to (All players) the text: false
I don't know if you know JASS, but all order functions in JASS return whether they are succesful or not.
With this code we could see, whether the order function works or not.
You could also use this to put the remove unit from group into the then-block so the unit only gets removed, if the order was succesful.
 
Level 8
Joined
Jan 28, 2016
Messages
486
still doesnt work...as far as i know units that have this ability and it is not on cooldown dont really count as "dead" while they are waiting to be revived. :/

You should try what @Jampion suggested again, as that very method works perfectly for me. I've posted my triggers below.

  • Test 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Kaboom! (Goblin Sapper)
    • Actions
      • Unit Group - Add (Triggering unit) to TempGroup
  • Test 2
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set TempLocation = (Position of Scout Tower 0001 <gen>)
              • Unit - Order (Picked unit) to Attack-Move To TempLocation
              • Custom script: call RemoveLocation( udg_TempLocation )
              • Unit Group - Remove (Picked unit) from TempGroup
            • Else - Actions
 
Level 7
Joined
Sep 19, 2012
Messages
204
the function is unit alive returns false for units with reincarnation just checked it.

Create a new boolean variable Boolean and use these functions instead of your Unit-Order function.
  • Custom script: set udg_Boolean = IssuePointOrderLocBJ( GetEnumUnit(), "attack", udg_temp_point )
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Boolean Equal to True
    • Then - Actions
      • Game - Display to (All players) the text: true
    • Else - Actions
      • Game - Display to (All players) the text: false
I don't know if you know JASS, but all order functions in JASS return whether they are succesful or not.
With this code we could see, whether the order function works or not.
You could also use this to put the remove unit from group into the then-block so the unit only gets removed, if the order was succesful.

You should try what @Jampion suggested again, as that very method works perfectly for me. I've posted my triggers below.

  • Test 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Kaboom! (Goblin Sapper)
    • Actions
      • Unit Group - Add (Triggering unit) to TempGroup
  • Test 2
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set TempLocation = (Position of Scout Tower 0001 <gen>)
              • Unit - Order (Picked unit) to Attack-Move To TempLocation
              • Custom script: call RemoveLocation( udg_TempLocation )
              • Unit Group - Remove (Picked unit) from TempGroup
            • Else - Actions

Thanks for your help guys...i just discovered the stupidity of my Problem... the trigger works just fine except for one thing: it only works if the Unit gets blown up by Kaboom, not if it gets killed by an enemy.
Problem Solved

thx jampion again ^^ thx for repeatedly trying to help.


EDIT: Forget what i just said...i added a trigger to add the dying units to the group...still doesnt work properly... single units do what they should but when it gets to a group of units always at least one doesnt move after revive...
 
Last edited:

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
Thanks for your help guys...i just discovered the stupidity of my Problem... the trigger works just fine except for one thing: it only works if the Unit gets blown up by Kaboom, not if it gets killed by an enemy.

The only trigger where you add the wisps to the wisp group is the trigger Kaboom Effect and Heal, which only fires when kaboom is used. So normal kills will result in the wisps standing around.

You can check it using this trigger. All wisps will be revived afterwards and won't move.
If wisps are close to enemy units they might move though.
  • KILL
    • Events
      • Player - Player 1 (Red) types a chat message containing kill as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 6 (Orange)) and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
The problem here is, that you cannot use a unit dies, because units with reincarnation do not "die".
You need a different way to detect when wisps die for the first time to add them to the wisps group.

Also attack move towards the enemy base will cause the wisps to move through the forest.
 
Level 7
Joined
Sep 19, 2012
Messages
204
yea that they move through the forest is ok...i just didnt set a proper system to check where they need to go...ill do that when they start to movbe at all Oo

mmm...ill think about it tomorrow...maybe i find a way to detect when they die....

thx again for your help!
 
Level 7
Joined
Sep 19, 2012
Messages
204
Thanks for your Help jampion! I finally found a way to make it work. For everybody who is interested:
  • Whisp Death Add
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacked unit)) Equal to Celestial Whisp
          • (Unit-type of (Attacked unit)) Equal to Nuclear Whisp
    • Actions
      • Hashtable - Save Handle Of(Attacked unit) as 1 of 1 in (Last created hashtable)
      • Trigger - Add to Whisp Death <gen> the event (Unit - (Load 1 of 1 in (Last created hashtable))'s life becomes Less than (4.05 / 10.00))
  • Whisp Death
    • Events
    • Conditions
    • Actions
      • Unit Group - Add (Triggering unit) to Temp_Whispgrp
  • Region Var Setup
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set MoveRegions_Var[1] = Death Mid Spawn <gen>
      • Set MoveRegions_Var[2] = Saint Mid Spawn <gen>
      • -------- ---------------------- --------
      • Set MoveRegions_Var[3] = Death Bot <gen>
      • Set MoveRegions_Var[4] = Bot D <gen>
      • Set MoveRegions_Var[5] = Bot <gen>
      • Set MoveRegions_Var[6] = Bot S <gen>
      • Set MoveRegions_Var[7] = Saint Bot <gen>
      • -------- ---------------------- --------
      • Set MoveRegions_Var[8] = Death Top <gen>
      • Set MoveRegions_Var[9] = Top D <gen>
      • Set MoveRegions_Var[10] = Top <gen>
      • Set MoveRegions_Var[11] = Top S <gen>
      • Set MoveRegions_Var[12] = Saint Top <gen>
      • -------- ---------------------- --------
      • Set MoveRegions_Var[13] = Death Mid <gen>
      • Set MoveRegions_Var[14] = Mid <gen>
      • Set MoveRegions_Var[15] = Saint Mid <gen>
This i did with every Region in my Movement setup:
  • Mid
    • Events
      • Unit - A unit enters Mid <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 12 (Brown)
        • Then - Actions
          • Unit - Set the custom value of (Entering unit) to 15
          • Set temp_point = (Center of Saint Mid <gen>)
          • Unit - Order (Entering unit) to Attack-Move To temp_point
          • Custom script: call RemoveLocation (udg_temp_point)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Entering unit)) Equal to Player 6 (Orange)
            • Then - Actions
              • Unit - Set the custom value of (Entering unit) to 13
              • Set temp_point = (Center of Death Mid <gen>)
              • Unit - Order (Entering unit) to Attack-Move To temp_point
              • Custom script: call RemoveLocation (udg_temp_point)
            • Else - Actions
  • whisp move
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Temp_Whispgrp and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • (Owner of (Picked unit)) Equal to Player 6 (Orange)
            • Then - Actions
              • Set temp_point = (Center of MoveRegions_Var[(Custom value of (Picked unit))])
              • Unit - Order (Picked unit) to Attack-Move To temp_point
              • Custom script: call RemoveLocation (udg_temp_point)
              • Unit Group - Remove (Picked unit) from Temp_Whispgrp
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is alive) Equal to True
                  • (Owner of (Picked unit)) Equal to Player 12 (Brown)
                • Then - Actions
                  • Set temp_point = (Center of MoveRegions_Var[(Custom value of (Picked unit))])
                  • Unit - Order (Picked unit) to Attack-Move To temp_point
                  • Custom script: call RemoveLocation (udg_temp_point)
                  • Unit Group - Remove (Picked unit) from Temp_Whispgrp
                • Else - Actions
 
Status
Not open for further replies.
Top