1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

When a creep dies, it has a chance to revive

Discussion in 'World Editor Help Zone' started by DaneTheBeast, Feb 12, 2015.

  1. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    • 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.
     
  2. Mythic

    Mythic

    Media Manager

    Joined:
    Apr 24, 2012
    Messages:
    8,274
    Resources:
    144
    Models:
    122
    Icons:
    6
    Skins:
    1
    Maps:
    5
    Spells:
    6
    Reforged HD Icons:
    1
    Tutorials:
    3
    Resources:
    144
    Create Unit at Point? Just remember to remove leaks. That is, if you want it to revive where it died.
     
  3. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    • Unit - Create 1 Zombie lvl 3 for (Owner of (Dying unit)) at (Position of (Dying unit)) facing (Facing of (Dying unit)) degrees


    Will this work?
     
  4. chasin225

    chasin225

    Joined:
    Jun 15, 2010
    Messages:
    218
    Resources:
    0
    Resources:
    0
    yes, but dont forget to remove the leaks
     
  5. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Thanks for your help. Here's the finished thing:

    Creep Respawn 100%
    • 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
     
  6. Mythic

    Mythic

    Media Manager

    Joined:
    Apr 24, 2012
    Messages:
    8,274
    Resources:
    144
    Models:
    122
    Icons:
    6
    Skins:
    1
    Maps:
    5
    Spells:
    6
    Reforged HD Icons:
    1
    Tutorials:
    3
    Resources:
    144
    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>.
     
  7. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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
     
  8. Mythic

    Mythic

    Media Manager

    Joined:
    Apr 24, 2012
    Messages:
    8,274
    Resources:
    144
    Models:
    122
    Icons:
    6
    Skins:
    1
    Maps:
    5
    Spells:
    6
    Reforged HD Icons:
    1
    Tutorials:
    3
    Resources:
    144
    b.) Nope, Unit. Last Created Unit.

    Welcome. Hope it works. Oh, and I totally forgot, use Triggering Unit over Dying Unit. Also, be sure to remove the location leak.
     
  9. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Should it be replaced even here? Everywhere?

    • Conditions
      • (Unit-type of (Dying unit)) Equal to Zombie lvl 3
     
  10. Mythic

    Mythic

    Media Manager

    Joined:
    Apr 24, 2012
    Messages:
    8,274
    Resources:
    144
    Models:
    122
    Icons:
    6
    Skins:
    1
    Maps:
    5
    Spells:
    6
    Reforged HD Icons:
    1
    Tutorials:
    3
    Resources:
    144
    Yup. Triggering Unit is a local and is usable with waits as I mentioned earlier.
     
  11. Death Adder

    Death Adder

    Joined:
    Nov 3, 2013
    Messages:
    919
    Resources:
    0
    Resources:
    0
    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
     
  12. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Alright I think I changed everything.

    Zombie
    • 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

    Pathing
    • 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>)

    Pathing2
    • 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>)

    Pathing3
    • 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 Creeps4 Team 1
    • 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
     
  13. Mythic

    Mythic

    Media Manager

    Joined:
    Apr 24, 2012
    Messages:
    8,274
    Resources:
    144
    Models:
    122
    Icons:
    6
    Skins:
    1
    Maps:
    5
    Spells:
    6
    Reforged HD Icons:
    1
    Tutorials:
    3
    Resources:
    144
    With the arrays you should use loops, click New Action and press F three times if I remember correctly.
     
  14. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I never messed around with then so I am not 100% sure how to use them properly, ill see if I can figure it out
     
  15. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hmm, I can't see to use For each (integer VARIABLE) from 1 to 10 do (actions) because my arrays aren't integer, and if they were I couldnt put units into them. Something I am missing?
     
    Last edited: Feb 13, 2015
  16. Death Adder

    Death Adder

    Joined:
    Nov 3, 2013
    Messages:
    919
    Resources:
    0
    Resources:
    0
    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
     
  17. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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: Feb 13, 2015
  18. Mythic

    Mythic

    Media Manager

    Joined:
    Apr 24, 2012
    Messages:
    8,274
    Resources:
    144
    Models:
    122
    Icons:
    6
    Skins:
    1
    Maps:
    5
    Spells:
    6
    Reforged HD Icons:
    1
    Tutorials:
    3
    Resources:
    144
    There is no Last Created Unit here, only Triggering/Entering Unit.
     
  19. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    • 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
     
  20. Mythic

    Mythic

    Media Manager

    Joined:
    Apr 24, 2012
    Messages:
    8,274
    Resources:
    144
    Models:
    122
    Icons:
    6
    Skins:
    1
    Maps:
    5
    Spells:
    6
    Reforged HD Icons:
    1
    Tutorials:
    3
    Resources:
    144
    I'll assume this trigger is for the starting point? May I see the other triggers now?