Alright, im trying to get a respawn trigger for an AoS that will respawn any pre-placed units where they were originally. it also has to be able to last longer than the decay time (edited to 30 seconds. respawn needs to be ~10-15 minutes) and spawn them for their original owner, not just neutral hostile.
After hours of trying it for myself and searching through tutorials and such, ive got it working... mostly.
The first few times the unit dies it works perfectly, but than just stops working for no explainable reason.
Here's what I've got so far.
This is run on Map Initiation with my, well, Initiation trigger.
Than for the actual revive trigger i have
I know almost nothing of jass, so the above trigger is 98% done in GUI than just converted. i than just made Revive_Custom a local.
Heres the GUI version of that
I have no idea whats wrong with it, to me it all seems perfect... but it just stops reviving certain units after a few deaths. also the 10 second respawn is only set like that for testing... cuz im not waiting 10-15 mins each test to see if it works
After hours of trying it for myself and searching through tutorials and such, ive got it working... mostly.
The first few times the unit dies it works perfectly, but than just stops working for no explainable reason.
Here's what I've got so far.
This is run on Map Initiation with my, well, Initiation trigger.
Trigger:
- Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Triggering unit) is A structure) Equal to (==) False) and (((Triggering unit) is A Hero) Equal to (==) False))) and do (Actions)
- Loop - Actions
- Set Revive_Int = (Revive_Int + 1)
- Unit - Set the custom value of (Picked unit) to Revive_Int
- Set Revive_Unit[Revive_Int] = (Picked unit)
- Set Revive_Player[Revive_Int] = (Owner of Revive_Unit[Revive_Int])
- Custom script: set udg_Revive_X[udg_Revive_Int] = GetUnitX(GetEnumUnit())
- Custom script: set udg_Revive_Y[udg_Revive_Int] = GetUnitY(GetEnumUnit())
- Loop - Actions
Than for the actual revive trigger i have
JASS:
function Trig_Creep_Revive_Copy_Conditions takes nothing returns boolean
if ( not ( GetUnitUserData(GetDyingUnit()) > 0 ) ) then
return false
endif
return true
endfunction
function Trig_Creep_Revive_Copy_Actions takes nothing returns nothing
local integer Revive_Custom
set Revive_Custom = GetUnitUserData(GetTriggerUnit())
call TriggerSleepAction( 10.00 )
set udg_TempPoint1 = GetRectCenter(GetEntireMapRect())
set udg_TempPoint2 = OffsetLocation(udg_TempPoint1, udg_Revive_X[Revive_Custom], udg_Revive_Y[Revive_Custom])
call CreateNUnitsAtLoc( 1, GetUnitTypeId(udg_Revive_Unit[Revive_Custom]), udg_Revive_Player[Revive_Custom], udg_TempPoint2, GetRandomReal(0, 360.00) )
call SetUnitUserData( GetLastCreatedUnit(), Revive_Custom )
call RemoveLocation (udg_TempPoint1)
call RemoveLocation (udg_TempPoint2)
endfunction
//===========================================================================
function InitTrig_Creep_Revive_Copy takes nothing returns nothing
set gg_trg_Creep_Revive_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Creep_Revive_Copy, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Creep_Revive_Copy, Condition( function Trig_Creep_Revive_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Creep_Revive_Copy, function Trig_Creep_Revive_Copy_Actions )
endfunction
I know almost nothing of jass, so the above trigger is 98% done in GUI than just converted. i than just made Revive_Custom a local.
Heres the GUI version of that
Trigger:
- Creep Revive
- Events
- Unit - A unit Dies
- Conditions
- (Custom value of (Dying unit)) Greater than (>) 0
- Actions
- Set Revive_Custom = (Custom value of (Triggering unit))
- Wait 10.00 seconds
- Set TempPoint1 = (Center of (Entire map))
- Set TempPoint2 = (TempPoint1 offset by (Revive_X[Revive_Custom], Revive_Y[Revive_Custom]))
- Unit - Create 1 (Unit-type of Revive_Unit[Revive_Custom]) for Revive_Player[Revive_Custom] at TempPoint2 facing (Random real number between 0.00 and 360.00) degrees
- Unit - Set the custom value of (Last created unit) to Revive_Custom
- Custom script: call RemoveLocation (udg_TempPoint1)
- Custom script: call RemoveLocation (udg_TempPoint2)
- Events
I have no idea whats wrong with it, to me it all seems perfect... but it just stops reviving certain units after a few deaths. also the 10 second respawn is only set like that for testing... cuz im not waiting 10-15 mins each test to see if it works