EDIT: I realized what was wrong, in the first trigger i had used last created unit instead of Picked unit.
I'm having trouble with my Respawn Trigger. Currently when i test in game, it gives me a Red texted error off to the left side, saying that starcraft was unable to run my respawn trigger. There are 2 triggers in total, but the game says it is unable to run the first one. Here are both.
Respawn 1
Events
Timer - Elapsed time is 0.01 Game Time seconds
Local Variables
Conditions
Actions
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 0 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Variable - Set integerRespawn = (integerRespawn + 1)
Unit - Set (Last created unit) custom value 0 to (Real(integerRespawn))
Variable - Set pointRespawnCivilian[integerRespawn] = (Position of (Picked unit))
HERE IS THE SECOND TRIGGER (the one that actually respawns units)
Respawn 2
Events
Unit - Any Unit dies
Local Variables
Conditions
(Owner of (Triggering unit)) == 0
Actions
General - Wait 10.0 Game Time seconds
Unit - Create 1 (Unit type of (Triggering unit)) for player 0 at pointRespawnCivilian[(Integer((Custom value 0 of (Triggering unit))))] facing -1.0 degrees (Ignore Placement)
Unit - Set (Last created unit) custom value 0 to (Custom value 0 of (Triggering unit))
I'd skip the first trigger entirely, use the second trigger to track the point where the unit died since it its not quite 'dead' yet when that event fires. I'm also wondering if referring the unit type of Triggering Unit will work since that variable might have its reference cleared in the interim 10 second wait(normally this wouldn't be an issue but the unit is being killed and far as I know when units are pulled from the game the engine dereferences anything like variables that point at them), I'd setup two local variables perhaps instead to capture the unit's type and location before that pause and reference them for the respawn instead.
For the 1st trigger, you can just change the event to map initialization. and for the action "Unit - Set (Last created unit) custom value 0 to (Real(integerRespawn))" change Last created unit, to Picked unit.
For the 2nd trigger you need a unit type local variable. This is because certain things are lost when you use a wait action, like "triggering unit". So set the "triggering unit" to the local variable, and use that variable in place of "triggering unit". Might also Create another real type variable to hold the custom value of the triggering unit, since that too will be lost because of the wait.
Edit: @BumpInTheNight: The 1st trigger is there to "remember" the spot the unit starts out. If you where to save its point in the 2nd trigger, it would revive right where it died instead of where it started out.
thats what im using in my map actually for Heros. But thats rly meant for heroes and not creeps or something of that sort. I think whats hes aiming more for is the creep scenario. Where he set a bunch of units in the terrain editor and that they re-spawn after they die. Though triggers with the "General - Custom Script: UnitRevive(lv_dieingUnit) ;" might work for that too. I wonder if it interferes with loot drops tho, someone should probably test that.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
EDIT: I realized what was wrong, in the first trigger i had used last created unit instead of Picked unit.
I'm having trouble with my Respawn Trigger. Currently when i test in game, it gives me a Red texted error off to the left side, saying that starcraft was unable to run my respawn trigger. There are 2 triggers in total, but the game says it is unable to run the first one. Here are both.
Respawn 1
Events
Timer - Elapsed time is 0.01 Game Time seconds
Local Variables
Conditions
Actions
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 0 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Variable - Set integerRespawn = (integerRespawn + 1)
Unit - Set (Last created unit) custom value 0 to (Real(integerRespawn))
Variable - Set pointRespawnCivilian[integerRespawn] = (Position of (Picked unit))
HERE IS THE SECOND TRIGGER (the one that actually respawns units)
Respawn 2
Events
Unit - Any Unit dies
Local Variables
Conditions
(Owner of (Triggering unit)) == 0
Actions
General - Wait 10.0 Game Time seconds
Unit - Create 1 (Unit type of (Triggering unit)) for player 0 at pointRespawnCivilian[(Integer((Custom value 0 of (Triggering unit))))] facing -1.0 degrees (Ignore Placement)
Unit - Set (Last created unit) custom value 0 to (Custom value 0 of (Triggering unit))
I'd skip the first trigger entirely, use the second trigger to track the point where the unit died since it its not quite 'dead' yet when that event fires. I'm also wondering if referring the unit type of Triggering Unit will work since that variable might have its reference cleared in the interim 10 second wait(normally this wouldn't be an issue but the unit is being killed and far as I know when units are pulled from the game the engine dereferences anything like variables that point at them), I'd setup two local variables perhaps instead to capture the unit's type and location before that pause and reference them for the respawn instead.
For the 1st trigger, you can just change the event to map initialization. and for the action "Unit - Set (Last created unit) custom value 0 to (Real(integerRespawn))" change Last created unit, to Picked unit.
For the 2nd trigger you need a unit type local variable. This is because certain things are lost when you use a wait action, like "triggering unit". So set the "triggering unit" to the local variable, and use that variable in place of "triggering unit". Might also Create another real type variable to hold the custom value of the triggering unit, since that too will be lost because of the wait.
Edit: @BumpInTheNight: The 1st trigger is there to "remember" the spot the unit starts out. If you where to save its point in the 2nd trigger, it would revive right where it died instead of where it started out.
@gizmachu: Go
Oh heh didn't catch that, right okay I see now :)
@gizmachu: Go
Heres the respawn trigger that i use for whenever its needed
Of course u can modify to your liking or take from to add to yours but this works :)
Ah almost forgot Trigger Credits go to OneTwo
@TheRupturedD:
thats what im using in my map actually for Heros. But thats rly meant for heroes and not creeps or something of that sort. I think whats hes aiming more for is the creep scenario. Where he set a bunch of units in the terrain editor and that they re-spawn after they die. Though triggers with the "General - Custom Script: UnitRevive(lv_dieingUnit) ;" might work for that too. I wonder if it interferes with loot drops tho, someone should probably test that.