GetLocalPlayer Disconnects

Strilanc

Veteran Scripter
Reaction score
42
The multiboard BJs create handles, so you shouldn't use them for only the local player. Leaderboard is probably fine.
 

cleeezzz

The Undead Ranger.
Reaction score
268
dammit, but the only thing local on the multiboards is the Title and Display? thats bad? how does dota do it then, it has local Title text as well.

>I have no personal experience as to if using GetOwningPlayer() inside GetLocalPlayer() blocks... worth a try I guess!

well its similar to GetLocalPlayer() == GetTriggerPlayer and that works.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
dammit, but the only thing local on the multiboards is the Title and Display? thats bad? how does dota do it then, it has local Title text as well.

>I have no personal experience as to if using GetOwningPlayer() inside GetLocalPlayer() blocks... worth a try I guess!

well its similar to GetLocalPlayer() == GetTriggerPlayer and that works.

You can just change the strings inside the GetLocalPlayer() if-thens, and then after the GetLocalPlayer() block, change the text to the localized string.
 

cleeezzz

The Undead Ranger.
Reaction score
268
this better? read comments in code though and answer please

JASS:
scope KD initializer Init

globals
    private integer c = 0
endglobals

struct KDS
    //! runtextmacro PUI()
    player p
    timer t
    method onDestroy takes nothing returns nothing
        set .p = null
        call ReleaseTimer(.t)
        set .t = null
    endmethod
endstruct

private function Conditions takes nothing returns boolean
    return GetUnitPointValue(GetTriggerUnit()) == 100
endfunction

private function Add takes nothing returns nothing
    set c = c + Kills[GetPlayerId(GetEnumPlayer())]
endfunction

private function End takes nothing returns nothing
    local KDS d = GetCSData(GetExpiredTimer())
    set MKCount[GetPlayerId(d.p)] = 0
    set KDS[Hero[GetPlayerId(d.p)]] = 0
    call d.destroy()
endfunction

private function Actions takes nothing returns nothing
    local multiboarditem mbi = null
    local integer kid = GetPlayerId(GetOwningPlayer(GetKillingUnit()))
    local integer did = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
    local integer bounty = 0
    local integer i = 0
    local string s
    local KDS d = KDS[Hero[kid]]
    if (GetPlayerSlotState(GetOwningPlayer(GetTriggerUnit())) == PLAYER_SLOT_STATE_PLAYING or GetPlayerSlotState(GetOwningPlayer(GetTriggerUnit())) == PLAYER_SLOT_STATE_EMPTY) and IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) and GetUnitPointValue(GetTriggerUnit()) == 100 then
        if GetPlayerSlotState(GetOwningPlayer(GetKillingUnit())) == PLAYER_SLOT_STATE_PLAYING or GetPlayerSlotState(GetOwningPlayer(GetKillingUnit())) == PLAYER_SLOT_STATE_EMPTY then   
            set Deaths[did] = ( Deaths[did] + 1 )
            set TDeaths[did] = ( TDeaths[did] + 1 )
            set mbi = MultiboardGetItem(Norm_MB, spots[did], 2)
            call MultiboardSetItemValue(mbi, I2S(Deaths[did]) )
            call MultiboardReleaseItem(mbi)
            set mbi = MultiboardGetItem(Stat_MB[did], 5, 1)
            call MultiboardSetItemValue(mbi, I2S(Deaths[did]) )
            call MultiboardReleaseItem(mbi)
            set mbi = MultiboardGetItem(Stat_MB[did], 7, 1)
            call MultiboardSetItemValue(mbi, I2S(TDeaths[did]) )
            call MultiboardReleaseItem(mbi)
            set Kills[kid] = Kills[kid] + 1
            set TKills[kid] = TKills[kid] + 1
            set mbi = MultiboardGetItem(Norm_MB, spots[kid], 1)
            call MultiboardSetItemValue( mbi, I2S(Kills[kid]) )
            call MultiboardReleaseItem(mbi)
            set mbi = MultiboardGetItem(Stat_MB[kid], 4, 1)
            call MultiboardSetItemValue( mbi, I2S(Kills[kid]) )
            call MultiboardReleaseItem(mbi)
            set mbi = MultiboardGetItem(Stat_MB[kid], 6, 1)
            call MultiboardSetItemValue( mbi, I2S(TKills[kid]) )
            call MultiboardReleaseItem(mbi)
            
            if GameMode1[1] == false then
                if GameMode1[2] == true then
                    set i = 1
                    loop
                        exitwhen i == 7
                        set c = 0
                        call ForForce(Teams<i>, function Add)
                        set mbi = MultiboardGetItem(Team_MB, i, 1)
                        call MultiboardSetItemValue( mbi, I2S(c))
                        call MultiboardReleaseItem(mbi)
                        set mbi = null
                        set i = i + 1
                    endloop
                elseif GameMode1[3] == true then
                    set i = 1
                    loop
                        exitwhen i == 5
                        set c = 0
                        call ForForce(Teams<i>, function Add)
                        set mbi = MultiboardGetItem(Team_MB, i, 1)
                        call MultiboardSetItemValue( mbi, I2S(c))
                        call MultiboardReleaseItem(mbi)
                        set mbi = null
                        set i = i + 1
                    endloop
                elseif GameMode1[4] == true then
                    set i = 1
                    loop
                        exitwhen i == 4
                        set c = 0
                        call ForForce(Teams<i>, function Add)
                        set mbi = MultiboardGetItem(Team_MB, i, 1)
                        call MultiboardSetItemValue( mbi, I2S(c))
                        call MultiboardReleaseItem(mbi)
                        set mbi = null
                        set i = i + 1
                    endloop
                elseif GameMode1[5] == true then
                    set i = 1
                    loop
                        exitwhen i == 3
                        set c = 0
                        call ForForce(Teams<i>, function Add)
                        set mbi = MultiboardGetItem(Team_MB, i, 1)
                        call MultiboardSetItemValue( mbi, I2S(c))
                        call MultiboardReleaseItem(mbi)
                        set mbi = null
                        set i = i + 1
                    endloop
                endif
            endif
            set GameKills = GameKills + 1
            if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
                call DisplayTextToPlayer(GetLocalPlayer(), 0, 0,  PlayerColors[GetPlayerId(GetOwningPlayer(GetDyingUnit()))] + GetPlayerName(GetOwningPlayer(GetDyingUnit())) + &quot;|r&quot; + &quot; has been pwned by &quot; + PlayerColors[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] + GetPlayerName(GetOwningPlayer(GetKillingUnit())) + &quot;|r&quot; + &quot; for &quot; + &quot;|cffffcc00&quot; + &quot;5&quot; + &quot; gold!&quot; + &quot;|r&quot;)
            endif
            call SetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD) + 5 )
            if GameKills == 1 then
                call StartSound( gg_snd_FirstBlood )
                if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
                    call DisplayTextToPlayer(GetLocalPlayer(), 0, 0,  PlayerColors[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] + GetPlayerName(GetOwningPlayer(GetKillingUnit())) + &quot;|r&quot; + &quot; has received |c00FF0000FIRST BLOOD!!|r |cffffcc00+5 gold!|r&quot;)                
                endif
                call SetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD) + 5 )
            endif    
            set s = &quot;|cffffcc00Archer Wars|r &quot; + &quot;|c0000FF00&quot; + I2S(Kills[kid]) + &quot;|r&quot; + &quot;|cffffcc00/|r&quot; + &quot;|c00FF0000&quot; + I2S(Deaths[kid]) + &quot;|r&quot;
            if GetLocalPlayer() != GetOwningPlayer(GetKillingUnit()) then
                set s = &quot;&quot;
            else
                call MultiboardSetTitleText(Norm_MB, s)
                if Team_MB != null then  //do these IF&#039;s cause desyncs inside a GetLocalPlayer if?
                    call MultiboardSetTitleText(Team_MB, s)
                endif
                set i = 0 //do setting a variable such as i cause desyncs inside a GetLocalPlayer if?
                loop
                    exitwhen i == 12
                    if Stat_MB<i> != null then
                        call MultiboardSetTitleText(Stat_MB<i>, s)
                    endif
                    set i = i + 1
                endloop  
            endif
            set s = &quot;|cffffcc00Archer Wars|r &quot; + &quot;|c0000FF00&quot; + I2S(Kills[did]) + &quot;|r&quot; + &quot;|cffffcc00/|r&quot; + &quot;|c00FF0000&quot; + I2S(Deaths[did]) + &quot;|r&quot;
            if GetLocalPlayer() != GetOwningPlayer(GetTriggerUnit()) then
                set s = &quot;&quot;
            else
                call MultiboardSetTitleText(Norm_MB, s)
                if Team_MB != null then
                    call MultiboardSetTitleText(Team_MB, s)
                endif
                set i = 0
                loop
                    exitwhen i == 12
                    if Stat_MB<i> != null then
                        call MultiboardSetTitleText(Stat_MB<i>, s)
                    endif
                    set i = i + 1
                endloop  
            endif
            if SpreeCount[did] &gt; 3 then
                if SpreeCount[did] &gt; 10 then
                    set SpreeCount[did] = 10
                endif
                if GodlikeCount[did] &gt; 0 then
                    set bounty = SpreeEndGold[SpreeCount[did]] + (7 * (GodlikeCount[did] - 1))
                else
                    set bounty = SpreeEndGold[SpreeCount[did]]
                endif
                if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
                    call DisplayTextToPlayer( GetLocalPlayer(),0,0, PlayerColors[did] + GetPlayerName(GetOwningPlayer(GetDyingUnit())) + &quot;|r&quot; + &quot;&#039;s &quot; + SpreeEndAnnounce[SpreeCount[did]] + &quot; has been ended by &quot; + PlayerColors[kid] + GetPlayerName(GetOwningPlayer(GetKillingUnit())) + &quot;|r&quot; + &quot; |cffffcc00+&quot; + I2S(bounty) + &quot; gold!|r&quot; )
                endif
                call SetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD) + bounty )
                call DestroyEffect(SpreeSFX[did])
            endif
            set SpreeCount[did] = 0
            set GodlikeCount[did] = 0
            set MKCount[did] = 0
            set SpreeCount[kid] = SpreeCount[kid] + 1
            if SpreeCount[kid] &gt; 10 then
                set SpreeCount[kid] = 10    
            endif
            if SpreeCount[kid] &gt; 3 then
                call StartSound(SpreeSound[SpreeCount[kid]] )
                call SetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD) + SpreeGold[SpreeCount[kid]] )
                if SpreeCount[kid] == 4 then
                    set SpreeSFX[kid] = AddSpecialEffectTarget( &quot;Abilities\\Spells\\Items\\HealingSalve\\HealingSalveTarget.mdl&quot;, Hero[kid], &quot;origin&quot;  )
                endif
                if SpreeCount[kid] == 10 then
                    set GodlikeCount[kid] = GodlikeCount[kid] + 1 
                endif
                if GodlikeCount[kid] &gt; 0 then
                    set bounty = SpreeEndGold[SpreeCount[kid]] + (7 * (GodlikeCount[kid] - 1))
                else
                    set bounty = SpreeEndGold[SpreeCount[kid]]
                endif
                if IsPlayerInForce(GetLocalPlayer(),bj_FORCE_ALL_PLAYERS) then
                    call DisplayTimedTextToPlayer( GetLocalPlayer(), 0,0,10.00, PlayerColors[kid] + GetPlayerName(GetOwningPlayer(GetKillingUnit())) + &quot;|r&quot;  + SpreeAnnounce[SpreeCount[kid]] + &quot; |cffffcc00(&quot; + I2S(bounty) + &quot; Bounty)|r&quot;)
                endif
            endif
            set MKCount[kid] = MKCount[kid] + 1
            if d == 0 then
                set d = KDS.create()
                set d.t = NewTimer()
                set d.p = Player(kid)
                set KDS[Hero[kid]] = d
                call SetCSData(d.t,d)
            else
                call PauseTimer(d.t)
            endif
            call TimerStart(d.t,1,false,function End)
            if MKCount[kid] &gt; 3 then
                set MKCount[kid] = 3
            endif
            if MKCount[kid] &gt; 1 then
                call StartSound(MKSound[MKCount[kid]] )
                call SetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(GetKillingUnit()), PLAYER_STATE_RESOURCE_GOLD) + MKGold[MKCount[kid]] )
                if IsPlayerInForce(GetLocalPlayer(),bj_FORCE_ALL_PLAYERS) then
                    call DisplayTimedTextToPlayer( GetLocalPlayer(), 0,0,10.00, PlayerColors[kid] + GetPlayerName(GetOwningPlayer(GetKillingUnit())) + &quot;|r&quot;  + MKAnnounce[MKCount[kid]])
                endif
            endif
            set i = 0
            loop
                exitwhen i == 12
                if TKills[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] == RankKills<i> then
                    call SetPlayerName( GetOwningPlayer(GetKillingUnit()), ( PlayerName[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] + Rank<i> ) )
                    if IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS) then
                        call DisplayTextToPlayer( GetLocalPlayer(),0,0, PlayerColors[GetPlayerId(GetOwningPlayer(GetKillingUnit()))] + PlayerName[GetPlayerId(GetOwningPlayer(GetKillingUnit()))]  + &quot;|r has ranked up to a(n)&quot; + &quot;|cffffcc00&quot; + Rank<i> + &quot;|r&quot; )
                    endif
                    set mbi = MultiboardGetItem(Stat_MB[GetPlayerId(GetOwningPlayer(GetKillingUnit()))], 1, 1)
                    call MultiboardSetItemValue(mbi, Rank<i>)
                    call MultiboardReleaseItem(mbi)
                    set mbi = null
                endif
                set i = i + 1
            endloop
        endif
    else
        set Deaths[did] = ( Deaths[did] + 1 )
        set TDeaths[did] = ( TDeaths[did] + 1 )
        set mbi = MultiboardGetItem(Norm_MB, spots[did], 2)
        call MultiboardSetItemValue(mbi, I2S(Deaths[did]) )
        call MultiboardReleaseItem(mbi)
        set mbi = null
        if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
            call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, PlayerColors[did] + GetPlayerName(GetOwningPlayer(GetDyingUnit())) + &quot;|r&quot;  + &quot; has died.&quot; )
        endif
        set s = &quot;|cffffcc00Archer Wars|r &quot; + &quot;|c0000FF00&quot; + I2S(Kills[did]) + &quot;|r&quot; + &quot;|cffffcc00/|r&quot; + &quot;|c00FF0000&quot; + I2S(Deaths[did]) + &quot;|r&quot;
        if GetLocalPlayer() != GetOwningPlayer(GetTriggerUnit()) then
            set s = &quot;&quot;
        else
            call MultiboardSetTitleText(Norm_MB, s)
            if Team_MB != null then
                call MultiboardSetTitleText(Team_MB, s)
            endif
            set i = 0
            loop
                exitwhen i == 12
                if Stat_MB<i> != null then
                    call MultiboardSetTitleText(Stat_MB<i>, s)
                endif
                set i = i + 1
            endloop  
        endif
    endif
     
    if DM == true then
        call TriggerExecute(DM_Trig[Mode])
    endif
    set mbi = null
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( trig, Condition( function Conditions))
    call TriggerAddAction( trig, function Actions )
endfunction

endscope
</i></i></i></i></i></i></i></i></i></i></i></i></i></i>
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
I don't think variables can be local. Can they?
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Not local to a trigger... I mean local to a player itself. Where i can be 1 for one player, and 2 for another.
 

Viikuna

No Marlo no game.
Reaction score
265
Ye, its a great feature. It allows you to have special effects, ligthnings and other nice stuff to look different for different players.

You can use "" string to make effect visible only for Player 1, or something like that.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Oh wait I was thinking of globals sorry.. But yea I already know about those. Learned of em a long time ago.
 

cleeezzz

The Undead Ranger.
Reaction score
268
JASS:
scope MB initializer Init

globals
    private integer list = 0
endglobals

private function Filter1 takes nothing returns boolean
    return GetPlayerSlotState(GetFilterPlayer()) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(GetFilterPlayer()) == MAP_CONTROL_USER 
endfunction

private function Count takes nothing returns nothing
    set count = count + 1
endfunction

private function PlayerSet takes nothing returns nothing
    local multiboarditem mbi = null
    local string s
    set spots[GetPlayerId(GetEnumPlayer())] = list
    set mbi = MultiboardGetItem(Norm_MB, list, 0)
    call MultiboardSetItemValue(mbi, (PlayerColors[GetPlayerId(GetEnumPlayer())] + ( PlayerName[GetPlayerId(GetEnumPlayer())] + &quot;|r&quot; ) ) )
    call MultiboardReleaseItem(mbi)
    set mbi = MultiboardGetItem(Norm_MB, list, 1)
    call MultiboardSetItemValue( mbi, I2S(Kills[GetPlayerId(GetEnumPlayer())]))
    call MultiboardReleaseItem(mbi)
    set mbi = MultiboardGetItem(Norm_MB, list, 2)
    call MultiboardSetItemValue(mbi, I2S(Deaths[GetPlayerId(GetEnumPlayer())]) )
    call MultiboardReleaseItem(mbi)
    set mbi = null
    set s = &quot;|cffffcc00Archer Wars|r |c0000FF00&quot; + I2S(Kills[GetPlayerId(GetEnumPlayer())]) + &quot;|r|cffffcc00/|r|c00FF0000&quot; + I2S(Deaths[GetPlayerId(GetEnumPlayer())]) +&quot;|r&quot;
    if GetLocalPlayer() == GetEnumPlayer() then
        call MultiboardSetTitleText(Norm_MB, s)
    endif
    set list = list + 1
endfunction

private function Actions takes nothing returns nothing
    local integer c
    local integer i
    local force f = CreateForce()
    local multiboarditem mbi = null
    set count = 0
    set f = GetPlayersMatching(Condition(function Filter1))
    call ForForce(f, function Count)
    set c = count
    set Norm_MB = CreateMultiboard()
    call MultiboardSetColumnCount(Norm_MB, 3)
    call MultiboardSetRowCount(Norm_MB, c + 4)
    call MultiboardSetTitleText(Norm_MB, &quot;|cffffcc00Archer Wars|r |c0000FF000|r|cffffcc00/|r|c00FF00000|r&quot;)
    set mbi = MultiboardGetItem(Norm_MB, 0, 0)
    call MultiboardSetItemValue( mbi, &quot;|cffffcc00Players|r&quot; )
    call MultiboardReleaseItem(mbi)
    set mbi = MultiboardGetItem(Norm_MB, 0, 1)
    call MultiboardSetItemValue(mbi, &quot;|cffffcc00Kills|r&quot; )
    call MultiboardReleaseItem(mbi)
    set mbi = MultiboardGetItem(Norm_MB, 0, 2)
    call MultiboardSetItemValue( mbi, &quot;|cffffcc00Deaths|r&quot; )
    call MultiboardReleaseItem(mbi)
    set i = 0
    loop
        exitwhen i &gt; c + 1
        set mbi = MultiboardGetItem(Norm_MB, i, 0)
        call MultiboardSetItemStyle( mbi, true, false )
        call MultiboardSetItemWidth( mbi, 0.09 )
        call MultiboardReleaseItem(mbi)
        set mbi = MultiboardGetItem(Norm_MB, i, 1)
        call MultiboardSetItemStyle( mbi, true, false )
        call MultiboardSetItemWidth( mbi, 0.04 )
        call MultiboardReleaseItem(mbi)
        set mbi = MultiboardGetItem(Norm_MB, i, 2)
        call MultiboardSetItemStyle( mbi, true, false )
        call MultiboardSetItemWidth( mbi, 0.04 )
        call MultiboardReleaseItem(mbi)
        set i = i + 1
    endloop
    set mbi = MultiboardGetItem(Norm_MB, c+2, 0)
    call MultiboardSetItemStyle( mbi, true, false )
    call MultiboardSetItemWidth( mbi, 0.19 )
    call MultiboardSetItemValue( mbi, &quot;|c0033CCFFPush Right Arrow for Stats|r&quot; )
    call MultiboardReleaseItem(mbi)
    set mbi = MultiboardGetItem(Norm_MB, c+2, 1)
    call MultiboardSetItemStyle( mbi, true, false )
    call MultiboardSetItemWidth( mbi, 0.00 )
    call MultiboardReleaseItem(mbi)
    set mbi = MultiboardGetItem(Norm_MB, c+2, 2)
    call MultiboardSetItemStyle( mbi, true, false )
    call MultiboardSetItemWidth( mbi, 0.00 )
    call MultiboardReleaseItem(mbi)
    set mbi = MultiboardGetItem(Norm_MB, c+3, 0)
    call MultiboardSetItemStyle( mbi, true, false )
    call MultiboardSetItemWidth( mbi, 0.19 )
    call MultiboardSetItemValue( mbi, &quot;|c0033CCFFPush Down Arrow for Team|r&quot; )
    call MultiboardReleaseItem(mbi)
    set mbi = MultiboardGetItem(Norm_MB, c+3, 1)
    call MultiboardSetItemStyle( mbi, true, false )
    call MultiboardSetItemWidth( mbi, 0.00 )
    call MultiboardReleaseItem(mbi)
    set mbi = MultiboardGetItem(Norm_MB, c+3, 2)
    call MultiboardSetItemStyle( mbi, true, false )
    call MultiboardSetItemWidth( mbi, 0.00 )
    call MultiboardReleaseItem(mbi)
    // SET LIST= Where the FIRST player will be shown, in what ROW he will be placed. in this case it player 1 will be in row 2! If he plays.. if player 1 does not play but player 2 plays, player2 will be put in Row 2!  etc!
    set list = 1
    call ForForce( f, function PlayerSet )
    call DestroyForce(f)
    call TriggerSleepAction(0.03)
    call MultiboardDisplay(Norm_MB,true)
    set i = 0
    loop
        exitwhen i == 12
        set CMB<i> = Norm_MB
        set i = i + 1
    endloop
    set f = null
    set mbi = null
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    set MBT = trig
    call TriggerAddAction( trig, function Actions )
endfunction

endscope

</i>


JASS:
scope PlayerLeaves initializer Init

private function Remove takes nothing returns nothing
    call RemoveUnit(GetEnumUnit())
endfunction

private function Actions takes nothing returns nothing
    local integer i = 1
    local group g = NewGroup()
    local string s = PlayerColors[GetPlayerId(GetTriggerPlayer())] + PlayerName[GetPlayerId(GetTriggerPlayer())]  + &quot; has left the game.&quot;
    call TriggerSleepAction(0.01)
    loop
        exitwhen i == 7
        call ForceRemovePlayer(Teams<i>, GetTriggerPlayer() )
        set i = i + 1
    endloop
    call KillUnit( Building[GetPlayerId(GetTriggerPlayer())] )
    call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(), null)
    call ForGroup(g,function Remove)
    call ReleaseGroup(g)
    set g = null
    if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, s) 
    endif
    call DestroyMultiboard(Stat_MB[GetPlayerId(GetTriggerPlayer())])
    set Stat_MB[GetPlayerId(GetTriggerPlayer())] = null
    call DestroyMultiboard(Norm_MB)
    call TriggerExecute(MBT)
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterPlayerEventLeave( trig, Player(0) )
    call TriggerRegisterPlayerEventLeave( trig, Player(1) )
    call TriggerRegisterPlayerEventLeave( trig, Player(2) )
    call TriggerRegisterPlayerEventLeave( trig, Player(3) )
    call TriggerRegisterPlayerEventLeave( trig, Player(4) )
    call TriggerRegisterPlayerEventLeave( trig, Player(5) )
    call TriggerRegisterPlayerEventLeave( trig, Player(6) )
    call TriggerRegisterPlayerEventLeave( trig, Player(7) )
    call TriggerRegisterPlayerEventLeave( trig, Player(8) )
    call TriggerRegisterPlayerEventLeave( trig, Player(9) )
    call TriggerRegisterPlayerEventLeave( trig, Player(10) )
    call TriggerRegisterPlayerEventLeave( trig, Player(11) )
    call TriggerAddAction( trig, function Actions )
endfunction

endscope


</i>
 

cleeezzz

The Undead Ranger.
Reaction score
268
Crashing a single player

well what are some codes that crash only 1 player, like fatal error crash, not just disconnect. i have this annoying crash problem but it only seems to happen to a single player at one time. It probably has to do with GetLocalPlayer() but i do not see a problem with my GetLocalPlayer() blocks.

also, i have no idea why the crash comes up or when it will come up, it seems very random.
 

Azlier

Old World Ghost
Reaction score
461
Most of my crashes when something totally moronic is called like:
Player(-1), Player(16).
 

cleeezzz

The Undead Ranger.
Reaction score
268
>Most of my crashes when something totally moronic is called like:
Player(-1), Player(16).

are those local crashes though? just one player crashes. most crashes i know kill everyone.

offtopic but i thought i posted this as a new thread, for the 2nd time... and it doesnt say it was edited by a mod and its a different topic, its not disconnect anymore, its crashing
 

cleeezzz

The Undead Ranger.
Reaction score
268
bump, i would like to know the reasons why a GetLocalPlayer() block would crash ONLY 1 player.

for example, would a desynced string table crash a player?
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
bump, i would like to know the reasons why a GetLocalPlayer() block would crash ONLY 1 player.

for example, would a desynced string table crash a player?

JASS:

if GetLocalPlayer() == Player( 1 ) then
    // Your local on purpose crash.
    call Player( -1 )
endif


Not only is your code extremely inefficient, but the desync is not in here.
I'd suggest you read tutorials about GetLocalPlayer(), instead of bumbing this thread over again.
Crashes and Desyncs are 2 entirely differn't things, For example, never create a handle in a local code because this will desync the player.
Using the code above this, crashes the game for Player(1).

Reading about this stuff is the best thing you can do before even experimenting with GetLocalPlayer().
 
General chit-chat
Help Users

      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