To anyone that was using the older version of the replay detect function, there were issues with it. When it was first posted on this site, the returning boolean for the function was unsynchronised which means when used will almost inevitably cause a desync. As a way to prevent this I synchronised the variable using gamecache and sync natives. Although this solved the multiplayer problem it seemed it also synchronised the boolean with replays which means it always returned true (even in replays). The function has been completely recoded, a lot of silly uneeded stuff was removed (the 2 sync functions have been removed and the globals) and I have just tested it and it works prefectly as intended
You can find instructions and the function at here http://www.hiveworkshop.com/forums/showthread.php?t=40777
For those who have no idea what im talking about I discovered a function which returns true if your actually playing in the game, and returns false if the game is being viewed as a replay. The only downsides to the function is it uses a pause which makes a noticable message (for this reason the returning value of the function should always be stored as a global boolean for future use). Here is the function for those lazy asses that dont wont to follow the link
With the new change to the function, it no longer needs to be synchronised however you should still initialize it like this because it has been reported that selecting units + triggersleepaction can cause desyncs
You can find instructions and the function at here http://www.hiveworkshop.com/forums/showthread.php?t=40777
For those who have no idea what im talking about I discovered a function which returns true if your actually playing in the game, and returns false if the game is being viewed as a replay. The only downsides to the function is it uses a pause which makes a noticable message (for this reason the returning value of the function should always be stored as a global boolean for future use). Here is the function for those lazy asses that dont wont to follow the link
JASS:
//<- InGame function created by PandaMine with help from Captain Griffein
function IsInGame takes nothing returns boolean
local integer counter = 1
local real camerax
local real cameray
local real x
local real y
local boolean output
loop
exitwhen counter > 12
if GetLocalPlayer() == Player(counter-1) then
set camerax = GetCameraTargetPositionX()
set cameray = GetCameraTargetPositionY()
endif
set counter = counter + 1
endloop
set counter = 1
call PauseGame(true)
call TriggerSleepAction(0)
loop
exitwhen counter > 12
if GetLocalPlayer() == Player(counter-1) then
call SetCameraPosition(camerax + 1,cameray + 1)
endif
set counter = counter + 1
endloop
call TriggerSleepAction(0)
call PauseGame(false)
set counter = 1
loop
exitwhen counter > 12
if GetLocalPlayer() == Player(counter-1) then
set x = GetCameraTargetPositionX()
if x == camerax + 1 then
set output = true
else
set output = false
endif
call SetCameraPosition(camerax,cameray)
endif
set counter = counter + 1
endloop
return output
endfunction
With the new change to the function, it no longer needs to be synchronised however you should still initialize it like this because it has been reported that selecting units + triggersleepaction can cause desyncs
JASS:
function Initiate takes nothing returns nothing
call EnableUserControl(false)
call TriggerSleepAction(.0)
set udg_InGame = IsInGame()
call EnableUserControl(true)
endfunction