Name | Type | is_array | initial_value |
Color | string | Yes | |
ForestItems | integer | No | |
NumberOfTrees | integer | No | |
PlayerName | string | Yes | |
PlayersInGame | integer | No | |
RandomPoint | location | No | |
RealX | real | No | 30.00 |
RemoveTrees | integer | No | |
T | integer | Yes | 1 |
TempPoint | location | No | |
TempPoint2 | location | No | |
Top_catapult | integer | Yes | 0 |
top_foots | integer | Yes | |
top_range | integer | Yes | |
TopMen | integer | Yes | |
unitgroup | group | No | |
X | integer | No | |
Y | integer | No | |
Z | integer | No |
function PlayerIsPlaying takes integer i returns boolean
local playerslotstate pss=GetPlayerSlotState(Player(i))
if pss!=PLAYER_SLOT_STATE_PLAYING or pss==PLAYER_SLOT_STATE_EMPTY or pss==PLAYER_SLOT_STATE_LEFT then
set pss=null
return false
endif
set pss=null
return true
endfunction
function ColorPlayerName takes player p returns string
/////////This function was made by Pacifist.
local playercolor color=GetPlayerColor(p)
local string tempString="|cffffffff"
if color==PLAYER_COLOR_RED then
set tempString="|cffff0303"
elseif color==PLAYER_COLOR_BLUE then
set tempString="|cff0042ff"
elseif color == PLAYER_COLOR_CYAN then
set tempString="|cff1ce6b9"
elseif color==PLAYER_COLOR_PURPLE then
set tempString="|cff540081"
elseif color==PLAYER_COLOR_YELLOW then
set tempString="|cfffffc01"
elseif color==PLAYER_COLOR_ORANGE then
set tempString="|cfffe8a0e"
elseif color==PLAYER_COLOR_GREEN then
set tempString="|cff20c000"
elseif color==PLAYER_COLOR_PINK then
set tempString="|cffe55bb0"
elseif color==PLAYER_COLOR_LIGHT_GRAY then
set tempString="|cff959697"
elseif color==PLAYER_COLOR_LIGHT_BLUE then
set tempString="|cff7ebff1"
elseif color==PLAYER_COLOR_AQUA then
set tempString="|cff106246"
elseif color==PLAYER_COLOR_BROWN then
set tempString="|cff4e2a04"
endif
set color=null
return tempString+GetPlayerName(p)+"|r"
endfunction
function PlayerLeavesActions takes nothing returns nothing
local player tp=GetTriggerPlayer()
call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,30,udg_PlayerName[GetPlayerId(tp)]+" has left the game.")
set udg_PlayersInGame=udg_PlayersInGame-1
//
//
//
//
//IMPORTANT!!!!!!!
//
//
//IF YOU ARE MAKING A SINGLE PLAYER MAP,
//DELETE THE FOLLOWING FIVE LINES AFTER THE BELOW COMMENTS.
//
//
//Don't forget to delete these commented lines to save a little space!
//
//
//
if udg_PlayersInGame==1 then
loop
call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,30,"EVERONE HAS LEFT THE GAME BUT YOU! DO NOT WASTE YOUR TIME IN HERE!!")
call TriggerSleepAction(30)
endloop
endif
set tp=null
endfunction
//===========================================================================
function InitTrig_Player_strings_and_leaving takes nothing returns nothing
local trigger t=CreateTrigger()
local event e=null
local triggeraction ta=TriggerAddAction(t,function PlayerLeavesActions)
local integer i=0
loop
exitwhen i>11
//
//
//
//IMPORTANT!!!!!!
//
//
//IF YOU USE GUI (Graphical User Interface) TRIGGERS OR START EVERYTHING WITH 1 INSTEAD OF 0,
//REPLACE "udg_Color[i]" BELOW WITH "udg_Color[i+1]" AND
//REPLACE "udg_ColorName[i]" BELOW WITH "udg_ColorName[i+1]".
//
//
//Don't forget to delete these commented lines to save a little space!
//
//
//
set udg_Color[i]=SubString(ColorPlayerName(Player(i)),0,10)
set udg_PlayerName[i]=udg_Color[i]+ColorPlayerName(Player(i))
if PlayerIsPlaying(i) then
set udg_PlayersInGame=udg_PlayersInGame+1
endif
set i=i+1
endloop
set i=0
loop
exitwhen i>11
set e=TriggerRegisterPlayerEventLeave(t,Player(i))
set e=null
set i=i+1
endloop
set t=null
set ta=null
endfunction