scope PlayerLeaves initializer init import Players import AI function cond takes nothing returns boolean player tp = GetTriggerPlayer() integer id = GetPlayerId(tp) DisplayTimedTextToPlayer(Players.locl, 0., 0., 5., "|cffffcc00" + GetPlayerName(tp) + "|r left the game and replaced by AI.") AI.addPlayer(tp) Players.aiControlled[id] = true Players.aiCount++ Players.humanCount-- return false end function init takes nothing returns nothing integer index = 0 trigger t = CreateTrigger() loop exitwhen index >= Players.COUNT TriggerRegisterPlayerEvent(t, Players.fromId[index], EVENT_PLAYER_LEAVE) index++ end TriggerAddCondition(t, Condition(function cond)) end endscope