event problem

J

justin9020

Guest
Can anyone show me how to get this code to run on the event of a neutral-hostile death.It'd be much appreciated. Ive been reading through many tutorials but still getting used to this JASS stuff.

Code:
function Trig_Creep_Revive_Actions takes nothing returns nothing
    local integer i = GetUnitUserData(GetTriggerUnit())
    call TriggerSleepAction( 30.00 )
    call CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Types[i], udg_Creep_Positions[i], bj_UNIT_FACING )
    call SetUnitUserData( GetLastCreatedUnit(), i )
endfunction

//===========================================================================
function InitTrig_Creep_Revive takes nothing returns nothing
    set gg_trg_Creep_Revive = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Creep_Revive, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Creep_Revive, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Creep_Revive, function Trig_Creep_Revive_Actions )
endfunction
 

Grundy

Ultra Cool Member
Reaction score
35
if you think the event isnt working just put this line in the actions: call BJDebugMsg( "Event worked!" ) and then you will see that theres nothing wrong with the event, it runs that trigger every time a neutral hostile creep dies, in fact it runs the trigger twice every time a neutral hostile creep dies because it runs both events. so i guess the problem with the events is that you have too many events. get rid of the BJ event. if your creeps aren't respawning its because of your actions not the events. probably has something to do with that i. do you ever set the FIRST creeps unituserdata? it could be at 0 and when you set integer i to that then it is using 0 for everything. and if you dont have a creep_types[0] then thats why its not spawning anything.
 

emjlr3

Change can be a good thing
Reaction score
395
that will run on the correct event, what the problem is is this

call CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Types, udg_Creep_Positions, bj_UNIT_FACING ) returns a unit, GetLastCreatedUnit() does not work with that do this instead
Code:
set bj_lastCreatedUnit = CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Types[i], udg_Creep_Positions[i], bj_UNIT_FACING )
    call SetUnitUserData(bj_lastCreatedUnit, i)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top