Alright I need some help. For my map I had to scrap the generic triggers that dictate what happens when a player leaves. Now I need to create a new one that will properly give control of their hero and display the message and such.
Now I tried it with GUI and it continues to disapoint me, if they leave under extraordinary conditions(lagout/disconnect) it will for some reason NOT detect them leaving and will only play a message, no shared control. So I now need some help with the sharing of control since I am not too sure on what the calls are for that.
In my map I use this code: (This is a long 1, theres probably another way but...)
Events: Time - Every 2.00 seconds of game time Conditions: ----- Actions: If ((Player 1 (Red) slot status) Equal to Has left the game) then do (Trigger - Turn off (This trigger)) else do (Do nothing) If ((Player 1 (Red) slot status) Equal to Has left the game) then do (Game - Grant shared vision and full shared unit control of Player 1 (Red) units with his/her allies) else do (Do nothing) If ((Player 1 (Red) slot status) Equal to Has left the game) then do (Game - Display to (All players) the text: ((Name of Player 1 (Red)) + |cff330066has left the game!|r)) else do (Do nothing) If ((Player 1 (Red) slot status) Equal to Is unused) then do (Trigger - Turn off (This trigger)) else do (Do nothing) If ((Player 1 (Red) slot status) Equal to Is unused) then do (Game - Grant shared vision and full shared unit control of Player 1 (Red) units with his/her allies) else do (Do nothing)
Horn
#3
That's really bad. Every 2 seconds? how about when a player actaully leaves/drops as events.
Look at my trigger, if u read it well, u c when a slot is equal to 'left the game' OR 'unused' So doesnt matter when he drops or sumthing, U get control.
Go away. Come back when you can help me with what I asked for. Which is a JASS solution. I could do it your way, but that way sucks, and GUI failed for detecting a leaving player and giving control, so now I want JASS, you hear? JASS
Ok this is my trigger taken directly from my AoS map im working on. I did this along time ago (like 6 months) when i first started learning jass so there could probably be some more optimizations but it works.
function PlayerLeaves_Actions takes nothing returns nothing
local force f
local integer i
local integer imax
local player p = GetTriggerPlayer()
if IsPlayerInForce(p, udg_Alliance) then
set f = udg_Alliance
set i = 0
set imax = 5
else
set f = udg_Undead
set i = 6
set imax =11
endif
call ShareEverythingWithTeam( p )
call ForceRemovePlayer( f, p )
loop
exitwhen i > imax
call AdjustPlayerStateBJ( ( GetPlayerState(p, PLAYER_STATE_RESOURCE_GOLD) / CountPlayersInForceBJ(f) ), Player(i), PLAYER_STATE_RESOURCE_GOLD )
set i = i + 1
endloop
call DisplayTextToForce( GetPlayersAll(), "|cffffff00" + GetPlayerName(p) + "|r has left the game")
set f = null
set p = null
endfunction
//===========================================================================
function InitTrig_PlayerLeaves takes nothing returns nothing
local integer p = 0
set gg_trg_PlayerLeaves = CreateTrigger( )
loop
exitwhen p > 11
call TriggerRegisterPlayerEventLeave( gg_trg_PlayerLeaves, Player(p))
set p = p + 1
endloop
call TriggerAddAction( gg_trg_PlayerLeaves, function PlayerLeaves_Actions )
endfunction