Why won't this trigger work?

Arkan

Nobody rides for free
Reaction score
92
My revival trigger, it works when you die the first time, but when you die a second time you won't respawn, and the camera will pan you to the center of the map instead of the base as it does when you die the first time, really weird...

Code:
function Trig_Revival_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
endfunction

function Trig_Revival_Actions takes nothing returns nothing
local unit dying=GetTriggerUnit()
local player p=GetOwningPlayer(dying)
local location l
set udg_DeadTimer[GetConvertedPlayerId(p)]=GetHeroLevel(dying)*5
loop
    exitwhen udg_DeadTimer[GetConvertedPlayerId(p)]==0
        call MultiboardSetItemValueBJ(udg_MB,5,udg_Playerrow[GetPlayerId(p)],"|cffAFEEEE"+I2S(udg_DeadTimer[GetConvertedPlayerId(p)])+"|r")
        call PolledWait(1)
        set udg_DeadTimer[GetConvertedPlayerId(p)]=udg_DeadTimer[GetConvertedPlayerId(p)]-1
endloop
if(IsPlayerInForce(p,udg_NorthPlayers)==true)then
set l=udg_NRegen
call PanCameraToTimedLocForPlayer(p,udg_NRegen,1)
else
set l=udg_SRegen
call PanCameraToTimedLocForPlayer(p,udg_SRegen,1)
endif
call MultiboardSetItemValueBJ(udg_MB,5,udg_Playerrow[GetPlayerId(p)],"")
call BJDebugMsg(GetUnitName(dying))
call ReviveHeroLoc(dying,l,true)
set dying=null
set p=null
call RemoveLocation(l)
set l=null
endfunction

//===========================================================================
function InitTrig_Revival takes nothing returns nothing
    set gg_trg_Revival = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Revival, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Revival, Condition( function Trig_Revival_Conditions ) )
    call TriggerAddAction( gg_trg_Revival, function Trig_Revival_Actions )
endfunction

udg_DeadTimer is an integer array.
And the reason I use a global integer instead of a local is because I want players to be able to write -revive and that will set the global to 0.
 
Hmm.. appearently it works if I remove "call RemoveLocation(l)". But doesn't that mean that it will leak?
 
Your regions are stored in global variables.

Which basically means two things:
- it isn't leaking, since they are permanently stored
- if you destroy them, they are gone...
 
Yeah, but I thought the local location l would be a "copy" of the real global location, so I thought I could destroy the "copy", but it destroyed the global aswell. Whatever, it works now and it should be leak free so I guess everything is alright.
 
Handle variables are pointers. So long as you are using natives, and don't use Create____() or Location(X,Y), then you aren't creating any new objects, and thus don't need to destroy anything. Some BJ functions create objects, however.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    It is weird seeing a way more realistic users online number
  • The Helper The Helper:
    Happy Tuesday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top