Quote:
No need to reply i fix my problem
And i made my first real JASS like script lol
the Fixed trigger is add to the bottem of this post
|
Ok im trying to create a creep respawn effect.
Heres what i do ...
in the Map Init trigger i find and fill an array with the creeps locations and assign the Index for the creep to the creeps Custom Value
This does fill the array with the mobs locations
So then when a creep dies i wait 10 sec and make a new creep at the location stored in the array and assign the new creep the same Index
But the problem seems(and i would even go so far as to say IS) that the variables are being over writen as new creeps die
When i kill just one mob then wait for the respawn it works
So If anyone can tell me how to get around this or another way of having creeps respawn at there start locations i would love to hear about it
also this is for a RPG style map so there will be a LOT of Creeps

JASS:
function Trig_Spawn_Actions takes nothing returns nothing
local integer index
local integer unit_type
set index = GetUnitUserData(GetDyingUnit())
set unit_type = GetUnitTypeId(GetDyingUnit())
call TriggerSleepAction( 10.00 )
call CreateNUnitsAtLoc( 1, unit_type, Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Spawn_Location[index], bj_UNIT_FACING )
call SetUnitUserData( GetLastCreatedUnit(), index )
call DisplayTextToForce( GetPlayersAll(), GetUnitName(GetLastCreatedUnit()) )
endfunction
function InitTrig_Spawn takes nothing returns nothing
set gg_trg_Spawn = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Spawn, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Spawn, function Trig_Spawn_Actions )
endfunction
All i did was changed the scope of the variables so that any new instances of this trigger would have there oun
or at least thats what i think i did this is the first bit of real scripting i have dont for War3 :P im so proud :)