I am currently working on trying to get a unit re-spawner to work. However, I cannot find the right event (or condition) to commence the action.
Here is my situation.
That is what I have to far. Now, here is the part that I cant figure out.
"Last of the 6 marines dies >> 1 zealot is spawned at a point"
All that I can find, is when 1 unit dies, which leads to an unlimited amount of units being formed. Any help would be greatly appreciated. I am a complete beginner by the way (this is my first map, and first post), so any thing would be awesome.
one way to avoid a loop would be to use remove unit instead of kill unit. This will prevent the 'unit dies' event form going off. I'm not sure if that will fix it, but it may be worth a shot.
Sorry, I seem to have misinformed you. The problem does not occur when the zealot is removed. However, when each marine dies, I get a zealot, instead of once they ALL die. This means I have 6 zealots instead of 1.
hmm, I'd have to know a bit more about the map as a whole to be able to determine what I think is best. If the player only has those 6 marines in the whole map, you could use a 'unit is valid' condition. When the unit is valid is false, all of the marines are gone.
Alternatively you could make a global variable to count the marines that have died. From the any unit dies trigger, variable modify add 1 to the global variable, then once it reaches 6, create the zealot and reset the variable to 0.
player A has 6 marines. Once all marines (6) dies, create 1 zealot
Solution.
Add all 6 marines to a unit group (lets say group called 6 MARINES).
Make a trigger that runs when any unit dies. Then do an If Then Else Statement that says if the number of living units in 6 MARINES < 1 THEN create 1 zealot.
From what I can see, the easiest method of respawning the zealot would be simple, when unit population = 0, then make a new zealot. Is there a way I could do this?. I cant find it in the list.
You can just generate the unit group of all living units of player x and check the size of the group. The guy with the facepalm avatar gave you a better method for it though.
Alright, so, here is what I have got. Also, thanks for the info on unit groups, that has really given my map a push in the right direction.
However, I am still having problems with my original question. I felt that the best way would to simply show you, so there are some screen shots attached.
The first one is my trigger list, nothing special.
Then I have the control one (hellions this time) which are equivalent to the marines in my first post.
Then I have the Selector_Initial, this spawns the zealot as the game starts.
Then I have the Selector_respawn, this respawns the zealot once all the hellions and zealots are dead.
However, here is where my problem lies. From what I can see, it should work fine. But at first (about 10 games) zealots spawn (multiple) what seems to be at random whenever hellions dies.( i run them at a wall of cannons for now). But for the last 5 trials, the zealot (single) always spawns at the death of the 3rd hellion.
Finaly, we have my victory_defeat trigger
It looks right to me, but whenever ANY unit dies, on the entire map, it give the victory screen. I have no idea why.
So, I think that I am useing the unit dies command incorrectly. Is there something else that needs to be done, other that what I have in my triggers?
For your victory/defeat trigger: You use the local var as the unit for the event, but there is no local var before the event is fired, so it probably uses "any unit dies" instead. Same goes for "Triggering Unit enters Region 02".
Also, whenever you create multiple units (6 Hellions, ...) and use "Add last created unit to Control 1" it will only add the last created (not all 6) unit to the group. Use a loop instead or the function "Add unit group to unit group" and as parameter "Last created units"
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I am currently working on trying to get a unit re-spawner to work. However, I cannot find the right event (or condition) to commence the action. Here is my situation.
"1 zealot moves onto region >> Creates 6 marines >> Zealot dies"
That is what I have to far. Now, here is the part that I cant figure out.
"Last of the 6 marines dies >> 1 zealot is spawned at a point"
All that I can find, is when 1 unit dies, which leads to an unlimited amount of units being formed. Any help would be greatly appreciated. I am a complete beginner by the way (this is my first map, and first post), so any thing would be awesome.
@PBobbert:
one way to avoid a loop would be to use remove unit instead of kill unit. This will prevent the 'unit dies' event form going off. I'm not sure if that will fix it, but it may be worth a shot.
@qerodar: Go
Sorry, I seem to have misinformed you. The problem does not occur when the zealot is removed. However, when each marine dies, I get a zealot, instead of once they ALL die. This means I have 6 zealots instead of 1.
@PBobbert:
hmm, I'd have to know a bit more about the map as a whole to be able to determine what I think is best. If the player only has those 6 marines in the whole map, you could use a 'unit is valid' condition. When the unit is valid is false, all of the marines are gone.
Alternatively you could make a global variable to count the marines that have died. From the any unit dies trigger, variable modify add 1 to the global variable, then once it reaches 6, create the zealot and reset the variable to 0.
Heres how i see your problem
player A has 6 marines. Once all marines (6) dies, create 1 zealot
Solution.
Add all 6 marines to a unit group (lets say group called 6 MARINES).
Make a trigger that runs when any unit dies. Then do an If Then Else Statement that says if the number of living units in 6 MARINES < 1 THEN create 1 zealot.
From what I can see, the easiest method of respawning the zealot would be simple, when unit population = 0, then make a new zealot. Is there a way I could do this?. I cant find it in the list.
You can just generate the unit group of all living units of player x and check the size of the group. The guy with the facepalm avatar gave you a better method for it though.
Alright, so, here is what I have got. Also, thanks for the info on unit groups, that has really given my map a push in the right direction.
However, I am still having problems with my original question. I felt that the best way would to simply show you, so there are some screen shots attached.
The first one is my trigger list, nothing special. Then I have the control one (hellions this time) which are equivalent to the marines in my first post. Then I have the Selector_Initial, this spawns the zealot as the game starts. Then I have the Selector_respawn, this respawns the zealot once all the hellions and zealots are dead.
However, here is where my problem lies. From what I can see, it should work fine. But at first (about 10 games) zealots spawn (multiple) what seems to be at random whenever hellions dies.( i run them at a wall of cannons for now). But for the last 5 trials, the zealot (single) always spawns at the death of the 3rd hellion.
Finaly, we have my victory_defeat trigger
It looks right to me, but whenever ANY unit dies, on the entire map, it give the victory screen. I have no idea why.
So, I think that I am useing the unit dies command incorrectly. Is there something else that needs to be done, other that what I have in my triggers?
Any help would be awesome.
Basically what I have found is that all of my conditional statements are being ignored.
For your victory/defeat trigger: You use the local var as the unit for the event, but there is no local var before the event is fired, so it probably uses "any unit dies" instead. Same goes for "Triggering Unit enters Region 02". Also, whenever you create multiple units (6 Hellions, ...) and use "Add last created unit to Control 1" it will only add the last created (not all 6) unit to the group. Use a loop instead or the function "Add unit group to unit group" and as parameter "Last created units"