- Joined
- Mar 24, 2013
- Messages
- 1,105
JASS:
function PreventPlay takes nothing returns nothing
local integer i = udg_PlayerNumberOfWhoseTurn
local integer i2 = 0
local player p2
loop
exitwhen i2 > 11
set p2 = Player(i2)
if GetLocalPlayer() == p2 and i2 == i then
call EnableSelect(true, true)
call BJDebugMsg("Allowed playing for " + GetPlayerName(p2))
else
call EnableSelect(false, true)
call ClearSelection()
call SelectUnit(udg_Builders[GetPlayerId(p2)], true)
call BJDebugMsg("Blocked for " + GetPlayerName(p2))
endif
set i2 = i2 + 1
endloop
set p2 = null
endfunction
So the goal of the code is to check which player's turn it is by looking at the global, then if it is their turn allow them to click on on things. If it isn't, don't allow them to click on things, select their builder. Currently, it just makes it so no one is able to click on anything.
When it was player 1's turn. It printed to player 1 that player 1 was allowed to move, it printed to player 2, player 1 was not allowed to move.
I'm assuming that there is a problem with my usage of GetLocalPlayer. Any feedback would be great!
Last edited: