Cokemonkey11
Spell Reviewer
- Joined
- May 9, 2006
- Messages
- 3,575
This is the most logical way I could think of doing this but it doesn't seem to work.
Typing -lvl after seeing the "only 1 player" messages does nothing.
Thanks for any help.
Typing -lvl after seeing the "only 1 player" messages does nothing.
JASS:
globals
integer tempPlayerCheck
trigger level
endglobals
function levelA takes nothing returns nothing
local integer lv = GetHeroLevel(udg_PlayerBoat[2])
call SetHeroLevel(udg_PlayerBoat[2],lv+1,true)
endfunction
function only1Add takes nothing returns nothing
if GetPlayerSlotState(GetEnumPlayer())==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(GetEnumPlayer())==MAP_CONTROL_USER then
set tempPlayerCheck = tempPlayerCheck+1
endif
endfunction
function Trig_only1Player_Actions takes nothing returns nothing
set tempPlayerCheck = 0
call ForForce(bj_FORCE_ALL_PLAYERS,function only1Add)
call DisplayTextToPlayer(Player(2),0,0,I2S(tempPlayerCheck)+" in game")
if tempPlayerCheck==1 then
call DisplayTextToPlayer(Player(2),0,0,"Singleplayer mode detected, type -lvl for a level up")
set level = CreateTrigger()
call TriggerRegisterPlayerChatEvent(level,Player(0),"-lvl",true)
call TriggerAddAction(level,function levelA)
endif
endfunction
function InitTrig_only1Player takes nothing returns nothing
set gg_trg_only1Player = CreateTrigger()
call TriggerRegisterTimerEvent(gg_trg_only1Player,10,false)
call TriggerAddAction(gg_trg_only1Player,function Trig_only1Player_Actions)
endfunction
Thanks for any help.