Respawn

assassin1221

New Member
Reaction score
0
Okay, well I was playing around in the triggers for a RPG map, I want certain units to respawn in a certain region. Is there any way to do this? I had tried some unit groups using them--didn't work-- I had tried few others one can't remember. But, if anyone know or any advice on what I can do for this it would be nice.

If you don't get what I mean here a example:

Region A--Contains Footmen

Region B--Contains Knights

If I kill a unit in Region B I don't want the unit to go to Region A, I want it to respawn in Region B.

I have seen some videos about trying to do

Events > 'create new event' > Unit > Player Owned Unit Event > A unit of player XX Dies

But this runs it for every single monster that will die and I don't want that. I have tried looking in conditions to see if they are way to stop it and do what I want, but I couldn't find one.
 

inevit4ble

Well-Known Member
Reaction score
38
If you dont run a "A unit dies" event then you got to spawn the creeps periodically i believe. You can check the amount of creeps alive as to whether or not the trigger must spawn another in its designated region.
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
Use variables like "Unit[1] = Footman", "Region[1] = Region A" when a unit dies, start a loop and check witch unit died.
Use the same loop integer, for getting the region you need. Now save the integer of loop in a variable, I prefer you use a pseudo local one, same for the local random location in region that your unit will spawn. Add your wait action and then VOILA you unit will spawn there !

This is one solution, the other one is pure Jass
 

assassin1221

New Member
Reaction score
0
Thanks guys, altho I have some trouble with your NOobImbaPro, I can't make my var region = to another region. But, I have came up a wait with how inevit4ble told me to do it.


DG
Events
Time - Every 0.10 seconds of game time
Conditions
(Number of living Satyr Shadowdancer units owned by Player 11 (Dark Green)) Not equal to 11
Actions
Wait 7.00 seconds
If ((Number of living Satyr Shadowdancer units owned by Player 11 (Dark Green)) Not equal to 11) then do (Unit - Create 1 Satyr Shadowdancer for Player 11 (Dark Green) at (Center of (Playable map area)) facing (Position of (Triggering unit))) else do (Do nothing)
Unit - Move (Last created unit) instantly to (Random point in Respawn <gen>)
Unit - Set Rally-Point for (Last created unit) to (Random point in Respawn <gen>)



Would that work right?
 

inevit4ble

Well-Known Member
Reaction score
38
I dont think it will work because of the wait, because it will keep checking and restarting the wait. rather make it check every 7 sec instead and take away the wait
 

assassin1221

New Member
Reaction score
0
Good point, and well I tested it and saw it flawed now it should work.
Trigger:
  • DG
    • Events
      • Time - Every 7.00 seconds of game time
    • Conditions
      • (Number of living Satyr Shadowdancer units owned by Player 11 (Dark Green)) Not equal to 11
    • Actions
      • If ((Number of living Satyr Shadowdancer units owned by Player 11 (Dark Green)) Not equal to 11) then do (Unit - Create 1 Satyr Shadowdancer for Player 11 (Dark Green) at (Center of (Playable map area)) facing (Position of (Triggering unit))) else do (Do nothing)
      • Unit - Move (Last created unit) instantly to (Random point in Respawn &lt;gen&gt;)
      • Unit - Set Rally-Point for (Last created unit) to (Random point in Region1)



Oh and NoobImbaPro, I might just not be understanding what you mean... Could you give me a little more? I would like to have experience with more then one way so I have more then one way of doing things.
 

TomTTT

New Member
Reaction score
44
What he means is a loop with arrays. Lets say you want 10 footmen in region 1 and 5 knights in region 2. What do you do?
You can set variables with matching arrays, and then run a loop, like this:
Trigger:
  • Set UnitType[1] = Footman
    • Set UnitAmount[1] = 10
    • Set SpawnRegion[1] = Region1
    • Set UnitType[2] = Knight
    • Set UnitAmount[2] = 5
    • Set SpawnRegion[2] = Region2

And now lets say make it every few seconds, and thats the point:
Trigger:
  • Periodic
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Create UnitAmount[(Integer A)] UnitType[(Integer A)] at SpawnRegion[(Integer A)]


So imagine that these last lines repeat twice, each time (Integer A) is different. It all repeats once as Integer A is 1, and then again as Integer A = 2.
And you got it.
It gets really useful when having a lot more variables, such as in TD.
 

assassin1221

New Member
Reaction score
0
Thanks man! Okay well, how do you get it to go into a sub division? I don't work with these much... But, I know what you mean.

When I do Set UnitType[1] = XX (my guy)
I don't get a sub division to pop up like how I see yours.
 

TheOverWhelm

Member
Reaction score
16
I'm confused about this, it seems overly dynamic?
Can't he just do a
Unit Dies
Unit is in Rect AA==true
Create Unit of Type GetTriggerUnit() at Rect AA?
 

assassin1221

New Member
Reaction score
0
I have not seen a condition like that

"Unit is in Rect AA==true"

I have been looking for one before I came posting here, but never found one like it.
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
"Unit is in Rect AA==true"

And if your footman dies not in region A what the heck will you do??
 

inevit4ble

Well-Known Member
Reaction score
38
Trigger:
  • Untitled Trigger 002
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
          • (Unit-type of (Triggering unit)) Equal to Knight
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Combat Zone &lt;gen&gt; contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 1 (Red) at (Center of Combat Zone &lt;gen&gt;) facing Default building facing degrees
        • Else - Actions
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 1 (Red) at (Center of Non Combat zone &lt;gen&gt;) facing Default building facing degrees


Wouldnt that work?
 

assassin1221

New Member
Reaction score
0
but if my unit dies in a different region, it wouldn't work? I mean since the triggering unit is not contain in unit Combat Zone <gen> the condition is not true and therefore wouldn't run the trigger?
 

assassin1221

New Member
Reaction score
0
What he means is a loop with arrays. Lets say you want 10 footmen in region 1 and 5 knights in region 2. What do you do?
You can set variables with matching arrays, and then run a loop, like this:
Trigger:
  • Set UnitType[1] = Footman
    • Set UnitAmount[1] = 10
    • Set SpawnRegion[1] = Region1
    • Set UnitType[2] = Knight
    • Set UnitAmount[2] = 5
    • Set SpawnRegion[2] = Region2

And now lets say make it every few seconds, and thats the point:
Trigger:
  • Periodic
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Create UnitAmount[(Integer A)] UnitType[(Integer A)] at SpawnRegion[(Integer A)]


So imagine that these last lines repeat twice, each time (Integer A) is different. It all repeats once as Integer A is 1, and then again as Integer A = 2.
And you got it.
It gets really useful when having a lot more variables, such as in TD.

haha, I am lost how to do it... I want to test it too see which one is easier.... But I can't put it together -.- (can't seem to get it)

Think you can put it in the right order in a full trigger?
 

TheOverWhelm

Member
Reaction score
16
What about just doing a..
Create 10 footman
add 10 footman to FootmanRectAGroup


Unit Dies
Unit in FootmanRectAGroup
Wait 10 sec
Create 01 footman in RectA

TomTTT's system also works just fine.
 

inevit4ble

Well-Known Member
Reaction score
38
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
        • Then - Actions
          • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Center of FootmanSpawn &lt;gen&gt;) facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Knight
        • Then - Actions
          • Unit - Create 1 Knight for (Owner of (Triggering unit)) at (Center of KnightSpawn &lt;gen&gt;) facing Default building facing degrees
        • Else - Actions


Y wouldn't something simpler work? You would just need to set your wait or timer cause this will spawn the unit right away.
 

assassin1221

New Member
Reaction score
0
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
        • Then - Actions
          • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Center of FootmanSpawn &lt;gen&gt;) facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Knight
        • Then - Actions
          • Unit - Create 1 Knight for (Owner of (Triggering unit)) at (Center of KnightSpawn &lt;gen&gt;) facing Default building facing degrees
        • Else - Actions


Y wouldn't something simpler work? You would just need to set your wait or timer cause this will spawn the unit right away.

As in Equal to Footmen, you can't equal it just to a footman without vars... You can do Footman <gen> 0062, unless I am missing something.
But when you do a var it would be equal to No Unit, not a selected unit.

Nvm, I was in wrong condition that why, I thought I changed it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top