Trigger destroys all other triggers [+rep will be given]

Reflexar

New Member
Reaction score
12
When this trigger is turned on it makes all other triggers in my map not to work, nothing happens. Can you please tell me why?

JASS:
scope RandomTaggers initializer initial
globals 
    force TAGGERS = CreateForce()
    unit array RUNNER
    private integer RUNNER_ID = 'runn'
    integer TAGGER_ID = 'infe'
endglobals

private function AddPlayerToTaggers takes integer pn returns nothing
    if IsPlayerInForce( Player(pn), TAGGERS) == false and GetPlayerSlotState(Player(pn)) == PLAYER_SLOT_STATE_PLAYING then
        call ForceAddPlayer( TAGGERS, Player(pn))
        call DisplayTextToForce(GetPlayersAll(), "Player " +I2S(pn + 1) + " Was chosen as Tagger")
        call RemoveUnit(RUNNER[pn])
        call CreateUnit( Player(pn), TAGGER_ID, GetStartLocationX(GetPlayerStartLocation(Player(10))), GetStartLocationY(GetPlayerStartLocation(Player(10))), 270.00)
    else
        call AddPlayerToTaggers(GetRandomInt(0, 9))
    endif
endfunction

private function initial takes nothing returns nothing
    local integer i = 0
    local integer pn = GetRandomInt(0, 9)
    loop
        exitwhen i>9
        if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
        set RUNNER<i> = CreateUnit( Player(i), RUNNER_ID, GetStartLocationX(GetPlayerStartLocation(Player(i))), GetStartLocationY(GetPlayerStartLocation(Player(i))), 270.00)
        endif
        set i = i + 1
    endloop
    
    call AddPlayerToTaggers(pn)
    set pn = GetRandomInt(0, 9)
    call AddPlayerToTaggers(pn)
    
endfunction
endscope</i>


Kind Regards, Reflexar
 

DrEvil

FCRI Associate!
Reaction score
111
I think you have an infinite loop going on :

If your testing and you only have your slot ( player properties ) open and none others.

It keeps looping til Player(pn) == playing :


And therefore crashes the thread maybe ? ( Because it loops through integers and if they are not in the group or not playing it doesn't work )
Causing other triggers not to initialize ?


Just all a guess though ,
Open another player slot and see if it doesn't work.
 

Reflexar

New Member
Reaction score
12
Turns out it works with more than one player.

Thank you dr.evil! you really helped me :D

rest in peace!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top