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

When a creep dies, it has a chance to revive

Status
Not open for further replies.
Level 12
Joined
Dec 11, 2014
Messages
662
  • ZombieChance2Revive
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
      • Unit - A unit owned by Player 10 (Light Blue) Dies
      • Unit - A unit owned by Player 9 (Gray) Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Zombie lvl 3
    • Actions
      • Set ZombieRespawnChance = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ZombieRespawnChance Less than or equal to 5
        • Then - Actions
        • Else - Actions
So I am not sure what do add no in "Then - Actions", if I know it I could continue my work.
I want it to revive the creep (5% chance) and it keeps on moving on.
 
Level 12
Joined
Dec 11, 2014
Messages
662
Thanks for your help. Here's the finished thing:

  • ZombieChance2Revive
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
      • Unit - A unit owned by Player 10 (Light Blue) Dies
      • Unit - A unit owned by Player 9 (Gray) Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Zombie lvl 3
    • Actions
      • Wait 0.50 seconds
      • Set ZombieRespawnChance = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ZombieRespawnChance Less than or equal to 5
        • Then - Actions
          • Set ZombiePointDied = (Position of (Dying unit))
          • Unit - Create 1 Zombie lvl 3 for (Owner of (Dying unit)) at ZombiePointDied facing (Facing of (Dying unit)) degrees
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Last created unit) is in creeps_team1_first) Equal to True
            • Then - Actions
              • Unit Group - Add (Entering unit) to creeps_team1_second
              • Unit Group - Remove (Entering unit) from creeps_team1_first
              • Unit - Order (Entering unit) to Move To (Center of team1 wp2 <gen>)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Last created unit) is in creeps_team1_second) Equal to True
                • Then - Actions
                  • Unit Group - Add (Entering unit) to creeps_team1_third
                  • Unit Group - Remove (Entering unit) from creeps_team1_second
                  • Unit - Order (Entering unit) to Move To (Center of Death Zone 1 <gen>)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Last created unit) is in creeps_team2_first) Equal to True
                    • Then - Actions
                      • Unit Group - Add (Entering unit) to creeps_team2_second
                      • Unit Group - Remove (Entering unit) from creeps_team2_first
                      • Unit - Order (Entering unit) to Move To (Center of team2 wp2 <gen>)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Last created unit) is in creeps_team2_second) Equal to True
                        • Then - Actions
                          • Unit Group - Remove (Entering unit) from creeps_team2_second
                          • Unit Group - Add (Entering unit) to creeps_team2_third
                          • Unit - Order (Entering unit) to Move To (Center of Death Zone 2 <gen>)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Last created unit) is in creeps_team3_first) Equal to True
                            • Then - Actions
                              • Unit Group - Add (Entering unit) to creeps_team3_second
                              • Unit Group - Remove (Entering unit) from creeps_team3_first
                              • Unit - Order (Entering unit) to Move To (Center of team3 wp2 <gen>)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ((Last created unit) is in creeps_team3_second) Equal to True
                                • Then - Actions
                                  • Unit Group - Add (Entering unit) to creeps_team3_third
                                  • Unit Group - Remove (Entering unit) from creeps_team3_second
                                  • Unit - Order (Entering unit) to Move To (Center of Death Zone 3 <gen>)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • ((Last created unit) is in creeps_team4_first) Equal to True
                                    • Then - Actions
                                      • Unit Group - Add (Entering unit) to creeps_team4_second
                                      • Unit Group - Remove (Entering unit) from creeps_team4_first
                                      • Unit - Order (Entering unit) to Move To (Center of team4 wp2 <gen>)
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • ((Last created unit) is in creeps_team4_second) Equal to True
                                        • Then - Actions
                                          • Unit Group - Add (Entering unit) to creeps_team4_third
                                          • Unit Group - Remove (Entering unit) from creeps_team4_second
                                          • Unit - Order (Entering unit) to Move To (Center of Death Zone 4 <gen>)
                                        • Else - Actions
                                          • Do nothing
        • Else - Actions
          • Do nothing
      • Custom script: call RemoveLocation (udg_ZombiePointDied)
I just need someone to confirm if it works , I will go test if the respawn works but I need to check if I made it right, it's my first time playing around with variables and Custom Scrips for removing leaks. Ty for your feedback <3 :grin:

Edit: Ignore the long if-then-else i made, it's for creeps to keep moving ,after they respawn ,if they are in a certain Group
 
a.) Don't use waits while not using Locals such as Triggering Unit
b.) Entering Unit will not work here, store the Last Created into a variable and reference that variable for efficiency.
c.) Don't use Do Nothing, it is bloat.
d.) Lastly, you may use arrays to make those nested ifs more readable and make it easier to loop through them. Set one of those groups to array, change the size to <max>, then reference them instead of those groups. Afterwards, For Each <custom integer variable> from 1 to <max groups>, do <Unit in Group Check>.
 
Level 12
Joined
Dec 11, 2014
Messages
662
a.) Don't use waits while not using Locals such as Triggering Unit
b.) Entering Unit will not work here, store the Last Created into a variable and reference that variable for efficiency.
c.) Don't use Do Nothing, it is bloat.
d.) Lastly, you may use arrays to make those nested ifs more readable and make it easier to loop through them. Set one of those groups to array, change the size to <max>, then reference them instead of those groups. Afterwards, For Each <custom integer variable> from 1 to <max groups>, do <Unit in Group Check>.

1) I removed wait
2) The "Entering unit" i overlooked because I just copy-pasted it from another trigger. Should the variable type be "Unit group"?
3) Should I just then leave it empty?
4) I will see what I can do, I don't know much about arrays and such. I will report back when I tried to do it.
Thnx for your help
 
Level 12
Joined
Nov 3, 2013
Messages
989
Think of it like this "a unit dies" reference the dying unit but "triggering unit" will also work because it's the unit that died that makes the trigger run.

Unit casts spell? Casting unit = Triggering Unit, Unit enters map? Entering unit = Triggering Unit.

Triggering Unit also works with waits
 
Level 12
Joined
Dec 11, 2014
Messages
662
Alright I think I changed everything.

  • ZombieChance2Revive
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
      • Unit - A unit owned by Player 10 (Light Blue) Dies
      • Unit - A unit owned by Player 9 (Gray) Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Zombie lvl 3
    • Actions
      • Wait 0.50 seconds
      • Set ZombieRespawnChance = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ZombieRespawnChance Less than or equal to 5
        • Then - Actions
          • Set ZombiePointDied = (Position of (Triggering unit))
          • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
          • Set Creep_Unit = (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Last created unit) is in UnitGroup1ForAll[1]) Equal to True
            • Then - Actions
              • Unit Group - Add Creep_Unit to UnitGroup1ForAll[2]
              • Unit Group - Remove Creep_Unit from UnitGroup1ForAll[1]
              • Unit - Order Creep_Unit to Move To (Center of team1 wp2 <gen>)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Last created unit) is in UnitGroup1ForAll[2]) Equal to True
                • Then - Actions
                  • Unit Group - Add Creep_Unit to UnitGroup1ForAll[3]
                  • Unit Group - Remove Creep_Unit from UnitGroup1ForAll[2]
                  • Unit - Order Creep_Unit to Move To (Center of Death Zone 1 <gen>)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Last created unit) is in UnitGroup1ForAll[4]) Equal to True
                    • Then - Actions
                      • Unit Group - Add Creep_Unit to UnitGroup1ForAll[5]
                      • Unit Group - Remove Creep_Unit from UnitGroup1ForAll[4]
                      • Unit - Order Creep_Unit to Move To (Center of team2 wp2 <gen>)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Last created unit) is in UnitGroup1ForAll[5]) Equal to True
                        • Then - Actions
                          • Unit Group - Remove Creep_Unit from UnitGroup1ForAll[5]
                          • Unit Group - Add Creep_Unit to UnitGroup1ForAll[6]
                          • Unit - Order Creep_Unit to Move To (Center of Death Zone 2 <gen>)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Last created unit) is in UnitGroup1ForAll[7]) Equal to True
                            • Then - Actions
                              • Unit Group - Add Creep_Unit to UnitGroup1ForAll[8]
                              • Unit Group - Remove Creep_Unit from UnitGroup1ForAll[7]
                              • Unit - Order Creep_Unit to Move To (Center of team3 wp2 <gen>)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ((Last created unit) is in UnitGroup1ForAll[8]) Equal to True
                                • Then - Actions
                                  • Unit Group - Add Creep_Unit to UnitGroup1ForAll[9]
                                  • Unit Group - Remove Creep_Unit from UnitGroup1ForAll[8]
                                  • Unit - Order Creep_Unit to Move To (Center of Death Zone 3 <gen>)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • ((Last created unit) is in UnitGroup1ForAll[10]) Equal to True
                                    • Then - Actions
                                      • Unit Group - Add Creep_Unit to UnitGroup1ForAll[11]
                                      • Unit Group - Remove Creep_Unit from UnitGroup1ForAll[10]
                                      • Unit - Order Creep_Unit to Move To (Center of team4 wp2 <gen>)
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • ((Last created unit) is in UnitGroup1ForAll[11]) Equal to True
                                        • Then - Actions
                                          • Unit Group - Add Creep_Unit to UnitGroup1ForAll[12]
                                          • Unit Group - Remove Creep_Unit from UnitGroup1ForAll[11]
                                          • Unit - Order Creep_Unit to Move To (Center of Death Zone 4 <gen>)
                                        • Else - Actions
        • Else - Actions
      • Custom script: call RemoveLocation (udg_ZombiePointDied)
made a variable type Unit.
made a unit group array with value 1000.

I still think there can be some adjustments (Not sure which x'D). With changing that I changed the pathing triggers of creeps

  • creepmove1 team1
    • Events
      • Unit - A unit enters Creep Spawn 1 <gen>
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 9 (Gray)
    • Actions
      • Unit - Order (Entering unit) to Move To (Center of team1 wp1 <gen>)
  • creepmove2 team1
    • Events
      • Unit - A unit enters team1 wp1 <gen>
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 9 (Gray)
      • ((Triggering unit) is in UnitGroup1ForAll[1]) Equal to True
    • Actions
      • Unit Group - Add (Entering unit) to UnitGroup1ForAll[2]
      • Unit Group - Remove (Entering unit) from UnitGroup1ForAll[1]
      • Unit - Order (Entering unit) to Move To (Center of team1 wp2 <gen>)
  • creepmove3 team1
    • Events
      • Unit - A unit enters team1 wp2 <gen>
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 9 (Gray)
      • ((Triggering unit) is in UnitGroup1ForAll[2]) Equal to True
    • Actions
      • Unit Group - Add (Entering unit) to UnitGroup1ForAll[3]
      • Unit Group - Remove (Entering unit) from UnitGroup1ForAll[2]
      • Unit - Order (Entering unit) to Move To (Center of Death Zone 1 <gen>)
Edit: and also, I needed to change this trigger aswel:
  • send creeps team1
    • Events
      • Unit - A unit enters Spawn Team1 <gen>
    • Conditions
      • ((Entering unit) is A peon-type unit) Equal to False
      • ((Entering unit) is A structure) Equal to False
    • Actions
      • Set Income[(Player number of (Owner of (Entering unit)))] = (Income[(Player number of (Owner of (Entering unit)))] + (Point-value of (Entering unit)))
      • -------- Creep for Team 2 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LifesTeam2 Greater than 0
          • ((Player 3 (Teal) slot status) Equal to Is playing) or ((Player 4 (Purple) slot status) Equal to Is playing)
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Entering unit)) for Player 10 (Light Blue) at (Center of Creep Spawn 2 <gen>) facing Default building facing degrees
          • Unit - Change color of (Last created unit) to (Color of (Owner of (Entering unit)))
          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[4]
        • Else - Actions
      • -------- Creep for Team 3 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LifesTeam3 Greater than 0
          • ((Player 5 (Yellow) slot status) Equal to Is playing) or ((Player 6 (Orange) slot status) Equal to Is playing)
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Entering unit)) for Player 11 (Dark Green) at (Center of Creep Spawn 3 <gen>) facing Default building facing degrees
          • Unit - Change color of (Last created unit) to (Color of (Owner of (Entering unit)))
          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[7]
        • Else - Actions
      • -------- Creep for Team 4 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LifesTeam4 Greater than 0
          • ((Player 7 (Green) slot status) Equal to Is playing) or ((Player 8 (Pink) slot status) Equal to Is playing)
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Entering unit)) for Player 12 (Brown) at (Center of Creep Spawn 4 <gen>) facing Default building facing degrees
          • Unit - Change color of (Last created unit) to (Color of (Owner of (Entering unit)))
          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[10]
        • Else - Actions
      • -------- Remove original Unit --------
      • Unit - Remove (Entering unit) from the game
 
Level 12
Joined
Nov 3, 2013
Messages
989
you make an integer variable that isn't an array, it will act as the index for your other array variables.

Instead of arrayVariable[1], arrayVariable[2], arrayVariable[3] and so on you get arrayVariable[integerVariable]

for integerVar 1 to 10 do
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
((Last created unit) is in UnitGroup1ForAll[integerVar]) Equal to True
 
Level 12
Joined
Dec 11, 2014
Messages
662
you make an integer variable that isn't an array, it will act as the index for your other array variables.

Instead of arrayVariable[1], arrayVariable[2], arrayVariable[3] and so on you get arrayVariable[integerVariable]

for integerVar 1 to 10 do
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
((Last created unit) is in UnitGroup1ForAll[integerVar]) Equal to True

Thanks for explaining, I am trying to understand and learn, here is what I did:

  • New Movement
    • Events
      • Unit - A unit enters Creep Spawn 2 <gen>
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 10 (Light Blue)
    • Actions
      • For each (Integer LearningInteger) from 4 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Last created unit) is in UnitGroup1ForAll[LearningInteger]) Equal to True
            • Then - Actions
              • Unit - Order (Triggering unit) to Move To CheckpointsAll[LearningInteger]
            • Else - Actions
Edit: the creeps spawn and just stand in place. I am really not sure if I did this right, seems i didnt
 
Last edited:
Level 12
Joined
Dec 11, 2014
Messages
662
There is no Last Created Unit here, only Triggering/Entering Unit.

  • New Movement
    • Events
      • Unit - A unit enters Creep Spawn 2 <gen>
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 10 (Light Blue)
    • Actions
      • For each (Integer LearningInteger) from 5 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Entering unit) is in UnitGroup1ForAll[LearningInteger]) Equal to True
            • Then - Actions
              • Unit - Order (Entering unit) to Move To CheckpointsAll[LearningInteger]
            • Else - Actions
Creeps still stand in place where they spawn.
Edit: Ok, I found the problem, when creeps were spawned they were set under the wrong number. But now they move to the first checkpoint and wont keep moving
 
Level 12
Joined
Dec 11, 2014
Messages
662
I'll assume this trigger is for the starting point? May I see the other triggers now?

  • Actions
    • Set CheckpointsAll[1] = (Center of Creep Spawn 1 <gen>)
    • Set CheckpointsAll[2] = (Center of team1 wp1 <gen>)
    • Set CheckpointsAll[3] = (Center of team1 wp2 <gen>)
    • Set CheckpointsAll[4] = (Center of Death Zone 1 <gen>)
    • Set CheckpointsAll[5] = (Center of Creep Spawn 2 <gen>)
    • Set CheckpointsAll[6] = (Center of team2 wp1 <gen>)
    • Set CheckpointsAll[7] = (Center of team2 wp2 <gen>)
    • Set CheckpointsAll[8] = (Center of Death Zone 2 <gen>)
    • Set CheckpointsAll[9] = (Center of Creep Spawn 3 <gen>)
    • Set CheckpointsAll[10] = (Center of team3 wp1 <gen>)
    • Set CheckpointsAll[11] = (Center of team3 wp2 <gen>)
    • Set CheckpointsAll[12] = (Center of Death Zone 3 <gen>)
    • Set CheckpointsAll[13] = (Center of Creep Spawn 4 <gen>)
    • Set CheckpointsAll[14] = (Center of team4 wp1 <gen>)
    • Set CheckpointsAll[15] = (Center of team4 wp2 <gen>)
    • Set CheckpointsAll[16] = (Center of Death Zone 4 <gen>)
  • If Team1 Sends Creeps
    • Events
      • Unit - A unit enters Spawn Team1 <gen>
    • Conditions
      • ((Entering unit) is A peon-type unit) Equal to False
      • ((Entering unit) is A structure) Equal to False
    • Actions
      • Set Income[(Player number of (Owner of (Entering unit)))] = (Income[(Player number of (Owner of (Entering unit)))] + (Point-value of (Entering unit)))
      • -------- Creep for Team 2 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LifesTeam2 Greater than 0
          • ((Player 3 (Teal) slot status) Equal to Is playing) or ((Player 4 (Purple) slot status) Equal to Is playing)
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Entering unit)) for Player 10 (Light Blue) at CheckpointsAll[5] facing 225.00 degrees
          • Unit - Change color of (Last created unit) to (Color of (Owner of (Entering unit)))
          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[6]
        • Else - Actions
      • -------- Creep for Team 3 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LifesTeam3 Greater than 0
          • ((Player 5 (Yellow) slot status) Equal to Is playing) or ((Player 6 (Orange) slot status) Equal to Is playing)
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Entering unit)) for Player 11 (Dark Green) at CheckpointsAll[9] facing Default building facing degrees
          • Unit - Change color of (Last created unit) to (Color of (Owner of (Entering unit)))
          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[9]
        • Else - Actions
      • -------- Creep for Team 4 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LifesTeam4 Greater than 0
          • ((Player 7 (Green) slot status) Equal to Is playing) or ((Player 8 (Pink) slot status) Equal to Is playing)
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Entering unit)) for Player 12 (Brown) at CheckpointsAll[13] facing Default building facing degrees
          • Unit - Change color of (Last created unit) to (Color of (Owner of (Entering unit)))
          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[13]
        • Else - Actions
      • -------- Remove original Unit --------
      • Unit - Remove (Entering unit) from the game
Edit#1: I thought that the "New Movement" Trigger could do for all checkpoints, but after adding "creep enters team2checkpoint1" and "creep enters team2checkpoint2" to the events it's still the same, can it all be in 1 trigger?
Edit#2: alright, I think I found out how to do it, I wll try and make it now, this "new movement" trigger is useless, idk what I was thinking, I need to use these integer variables for the zombie respawn, that was the whole point. Ill say when I tried it.
Edit#3: New zombie respawn (final, I hope)
  • ZombieChance2Revive
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
      • Unit - A unit owned by Player 10 (Light Blue) Dies
      • Unit - A unit owned by Player 9 (Gray) Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Zombie lvl 3
    • Actions
      • Wait 0.50 seconds
      • Set ZombieRespawnChance = (Random integer number between 1 and 100)
      • Set ZombieEffect = (Position of (Triggering unit))
      • Set ZombiePointDied = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ZombieRespawnChance Less than or equal to 5
        • Then - Actions
          • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
          • Special Effect - Create a special effect at ZombieEffect using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set Creep_Unit = (Last created unit)
          • For each (Integer LearningInteger) from 1 to 16, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Last created unit) is in UnitGroup1ForAll[LearningInteger]) Equal to True
                • Then - Actions
                  • Unit - Order (Last created unit) to Move To CheckpointsAll[LearningInteger]
                • Else - Actions
        • Else - Actions
      • Custom script: call RemoveLocation (udg_ZombiePointDied)
      • Custom script: call RemoveLocation (udg_ZombieEffect)
Now I need to get in and fully test it, once again, if you see anything you think is wrong let me know
 
Last edited:
Level 12
Joined
Nov 3, 2013
Messages
989
that doesn't really have anything to do with replacing a series of else if with an else if inside loop though

((Last created unit) is in UnitGroup1ForAll[LearningInteger]) Equal to True

Unit Group - Add Creep_Unit to UnitGroup1ForAll[learningInteger]
Unit Group - Remove Creep_Unit from UnitGroup1ForAll[learningInteger - 1]

I don't really see how this would work though, since it's not going to be in any group before the first else if.
 
Level 12
Joined
Dec 11, 2014
Messages
662
that doesn't really have anything to do with replacing a series of else if with an else if inside loop though

((Last created unit) is in UnitGroup1ForAll[LearningInteger]) Equal to True

Unit Group - Add Creep_Unit to UnitGroup1ForAll[learningInteger]
Unit Group - Remove Creep_Unit from UnitGroup1ForAll[learningInteger - 1]

I don't really see how this would work though, since it's not going to be in any group before the first else if.

Hmmm.... :vw_wtf:

The created unit won't be in any group? Is that what you are saying?
Eidt: would this work?
  • Then - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Triggering unit) is in UnitGroup1ForAll[2]) Equal to True
      • Then - Actions
        • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
        • Set Creep_Unit = (Last created unit)
        • Animation - Play (Last created unit)'s birth animation
        • Unit - Order (Last created unit) to Move To CheckpointsAll[2]
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Triggering unit) is in UnitGroup1ForAll[3]) Equal to True
          • Then - Actions
            • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
            • Set Creep_Unit = (Last created unit)
            • Animation - Play (Last created unit)'s birth animation
            • Unit - Order (Last created unit) to Move To CheckpointsAll[3]
          • Else - Actions
This would check if the unit that died was in a group, and if it was in a certain group it would order it to move to the appropriate checkpoint and this would continue for other UnitGroup1ForAll
Edit: It seems to work, I will try and add "wait" so he doesnt move while the animation plays.
Edit#2: The animation doesn't even play, why is that?
 
Last edited:
Level 12
Joined
Dec 11, 2014
Messages
662
Alright. I tested it and now I finally got it to work.
  • ZombieChance2Revive
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
      • Unit - A unit owned by Player 10 (Light Blue) Dies
      • Unit - A unit owned by Player 9 (Gray) Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Zombie lvl 3
    • Actions
      • Wait 0.50 seconds
      • Set ZombieRespawnChance = (Random integer number between 1 and 100)
      • Set ZombieEffect = (Position of (Triggering unit))
      • Set ZombiePointDied = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ZombieRespawnChance Less than or equal to 5
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is in UnitGroup1ForAll[2]) Equal to True
            • Then - Actions
              • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
              • Set Creep_Unit = (Last created unit)
              • Unit Group - Add (Last created unit) to UnitGroup1ForAll[2]
              • Special Effect - Create a special effect at ZombieEffect using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
              • Special Effect - Destroy (Last created special effect)
              • Animation - Play (Last created unit)'s birth animation
              • Unit - Order (Last created unit) to Move To CheckpointsAll[2]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Triggering unit) is in UnitGroup1ForAll[3]) Equal to True
                • Then - Actions
                  • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                  • Set Creep_Unit = (Last created unit)
                  • Unit Group - Add (Last created unit) to UnitGroup1ForAll[3]
                  • Special Effect - Create a special effect at ZombieEffect using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Animation - Play (Last created unit)'s birth animation
                  • Unit - Order (Last created unit) to Move To CheckpointsAll[3]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Triggering unit) is in UnitGroup1ForAll[4]) Equal to True
                    • Then - Actions
                      • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                      • Set Creep_Unit = (Last created unit)
                      • Unit Group - Add (Last created unit) to UnitGroup1ForAll[4]
                      • Special Effect - Create a special effect at ZombieEffect using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Animation - Play (Last created unit)'s birth animation
                      • Unit - Order (Last created unit) to Move To CheckpointsAll[4]
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Triggering unit) is in UnitGroup1ForAll[6]) Equal to True
                        • Then - Actions
                          • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                          • Set Creep_Unit = (Last created unit)
                          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[6]
                          • Special Effect - Create a special effect at ZombieEffect using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Animation - Play (Last created unit)'s birth animation
                          • Unit - Order (Last created unit) to Move To CheckpointsAll[6]
                        • Else - Actions
        • Else - Actions
      • Custom script: call RemoveLocation (udg_ZombiePointDied)
      • Custom script: call RemoveLocation (udg_ZombieEffect)
The Animation still doesn't work and this is not the finished trigger, the one you see is pretty much if the creep is meant for team1 and team2's first checkpoint, I will update it after I finish it for all 4 teams.
 
Level 12
Joined
Nov 3, 2013
Messages
989
Hmmm.... :vw_wtf:

The created unit won't be in any group? Is that what you are saying?

No, it's just that at the time you had
  • ((Last created unit) is in UnitGroup1ForAll[LearningInteger]) Equal to True
instead of
  • ((Triggering unit) is in UnitGroup1ForAll[LearningInteger]) Equal to True
Some other stuff;

You've got two variables pointing to the same location.

You're not using the variable "Creep_Unit".

Usually only buildings and some ability effect models have a "birth" animation, the unit would obviously have to have an animation called that for it to be able to play it.
 
Level 12
Joined
Dec 11, 2014
Messages
662
No, it's just that at the time you had
  • ((Last created unit) is in UnitGroup1ForAll[LearningInteger]) Equal to True
instead of
  • ((Triggering unit) is in UnitGroup1ForAll[LearningInteger]) Equal to True
Some other stuff;

You've got two variables pointing to the same location.

You're not using the variable "Creep_Unit".

Usually only buildings and some ability effect models have a "birth" animation, the unit would obviously have to have an animation called that for it to be able to play it.

Thanks. I will make so it's only 1 variable.
I will remove the "Creep_Unit"
The unit that needs to revive is the zombie. in WE on the left side changing the animations you can see he has "Birth" that lasts 2.333 seconds where he stants up, but I can't get it to work because the creeps eithers is ordered to move or it will attack the buildings around it.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
"For each (Integer variable) from X to Y" is a loop that runs from number X until it reaches number Y. The number of current loop is saved into the integer variable you set in the action.

E.g. "For each (Integer loop_var) from 1 to 10":
1st iteration: loop_var variable has value 1
2nd iteration: loop_var variable has value 2
..
..
..
last (10th) iteration: loop_var variable has value 10.

You can use the loop_var variable as an index for an array when using loops. E.g. my_array[loop_var] will access different "layer" of the array with each iteration of the loop.
 
Level 12
Joined
Dec 11, 2014
Messages
662
"For each (Integer variable) from X to Y" is a loop that runs from number X until it reaches number Y. The number of current loop is saved into the integer variable you set in the action.

E.g. "For each (Integer loop_var) from 1 to 10":
1st iteration: loop_var variable has value 1
2nd iteration: loop_var variable has value 2
..
..
..
last (10th) iteration: loop_var variable has value 10.

You can use the loop_var variable as an index for an array when using loops. E.g. my_array[loop_var] will access different "layer" of the array with each iteration of the loop.

Thanks for the info.
Here is the whole trigger that works for me. The only thing that might be added is to change color of created unit, since the original unit that is sent is a different color.
  • ZombieChance2Revive
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
      • Unit - A unit owned by Player 10 (Light Blue) Dies
      • Unit - A unit owned by Player 9 (Gray) Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Zombie lvl 3
    • Actions
      • Wait 0.50 seconds
      • Set ZombieRespawnChance = (Random integer number between 1 and 100)
      • Set ZombiePointDied = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ZombieRespawnChance Less than or equal to 5
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is in UnitGroup1ForAll[2]) Equal to True
            • Then - Actions
              • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
              • Unit Group - Add (Last created unit) to UnitGroup1ForAll[2]
              • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Order (Last created unit) to Move To CheckpointsAll[2]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Triggering unit) is in UnitGroup1ForAll[3]) Equal to True
                • Then - Actions
                  • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                  • Unit Group - Add (Last created unit) to UnitGroup1ForAll[3]
                  • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Order (Last created unit) to Move To CheckpointsAll[3]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Triggering unit) is in UnitGroup1ForAll[4]) Equal to True
                    • Then - Actions
                      • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                      • Unit Group - Add (Last created unit) to UnitGroup1ForAll[4]
                      • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Order (Last created unit) to Move To CheckpointsAll[4]
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Triggering unit) is in UnitGroup1ForAll[6]) Equal to True
                        • Then - Actions
                          • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[6]
                          • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Unit - Order (Last created unit) to Move To CheckpointsAll[6]
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Triggering unit) is in UnitGroup1ForAll[7]) Equal to True
                            • Then - Actions
                              • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                              • Unit Group - Add (Last created unit) to UnitGroup1ForAll[7]
                              • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                              • Special Effect - Destroy (Last created special effect)
                              • Unit - Order (Last created unit) to Move To CheckpointsAll[7]
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ((Triggering unit) is in UnitGroup1ForAll[8]) Equal to True
                                • Then - Actions
                                  • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                                  • Unit Group - Add (Last created unit) to UnitGroup1ForAll[8]
                                  • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                                  • Special Effect - Destroy (Last created special effect)
                                  • Unit - Order (Last created unit) to Move To CheckpointsAll[8]
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • ((Triggering unit) is in UnitGroup1ForAll[10]) Equal to True
                                    • Then - Actions
                                      • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                                      • Unit Group - Add (Last created unit) to UnitGroup1ForAll[10]
                                      • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                                      • Special Effect - Destroy (Last created special effect)
                                      • Unit - Order (Last created unit) to Move To CheckpointsAll[10]
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • ((Triggering unit) is in UnitGroup1ForAll[11]) Equal to True
                                        • Then - Actions
                                          • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                                          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[11]
                                          • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                                          • Special Effect - Destroy (Last created special effect)
                                          • Unit - Order (Last created unit) to Move To CheckpointsAll[11]
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • ((Triggering unit) is in UnitGroup1ForAll[12]) Equal to True
                                            • Then - Actions
                                              • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                                              • Unit Group - Add (Last created unit) to UnitGroup1ForAll[12]
                                              • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                                              • Special Effect - Destroy (Last created special effect)
                                              • Unit - Order (Last created unit) to Move To CheckpointsAll[12]
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • ((Triggering unit) is in UnitGroup1ForAll[14]) Equal to True
                                                • Then - Actions
                                                  • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                                                  • Unit Group - Add (Last created unit) to UnitGroup1ForAll[14]
                                                  • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                                                  • Special Effect - Destroy (Last created special effect)
                                                  • Unit - Order (Last created unit) to Move To CheckpointsAll[14]
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • ((Triggering unit) is in UnitGroup1ForAll[15]) Equal to True
                                                    • Then - Actions
                                                      • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                                                      • Unit Group - Add (Last created unit) to UnitGroup1ForAll[15]
                                                      • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                                                      • Special Effect - Destroy (Last created special effect)
                                                      • Unit - Order (Last created unit) to Move To CheckpointsAll[15]
                                                    • Else - Actions
                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                        • If - Conditions
                                                          • ((Triggering unit) is in UnitGroup1ForAll[16]) Equal to True
                                                        • Then - Actions
                                                          • Unit - Create 1 Zombie lvl 3 for (Owner of (Triggering unit)) at ZombiePointDied facing (Facing of (Triggering unit)) degrees
                                                          • Unit Group - Add (Last created unit) to UnitGroup1ForAll[16]
                                                          • Special Effect - Create a special effect at ZombiePointDied using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                                                          • Special Effect - Destroy (Last created special effect)
                                                          • Unit - Order (Last created unit) to Move To CheckpointsAll[16]
                                                        • Else - Actions
        • Else - Actions
      • Custom script: call RemoveLocation (udg_ZombiePointDied)
 
Status
Not open for further replies.
Top