Hey there, I am trying to make that the host always choose the difficult, so I tried this toturial: http://www.wc3c.net/showthread.php?t=86119
and this script instead:
function GetHostId takes nothing returns integer
//This stores the Id + 1 for each player.
call StoreInteger(GameCache(), "missionKey", "key", GetPlayerId(GetLocalPlayer()) + 1)
//Setup the TriggerSyncReady call.
call TriggerSyncStart()
//Sync the value of the entry for each player.
//Each value will sync to the value of the host.
call SyncStoredInteger(GameCache(), "missionKey", "key")
//Wait until the Game Cache syncs the key for everyone.
call TriggerSyncReady()
//Return the synced value as a id.
return GetStoredInteger(GameCache(), "missionKey", "key") - 1
endfunction
I placed that script in triggers, at top where the name of the map is.
I also made a Variable named "Host" and it's a "player" variable.
and the last thing is this:
But I get an error on that trigger, so what am I doing wrong?
(error= Line 276: Expected a function name)
and this script instead:
function GetHostId takes nothing returns integer
//This stores the Id + 1 for each player.
call StoreInteger(GameCache(), "missionKey", "key", GetPlayerId(GetLocalPlayer()) + 1)
//Setup the TriggerSyncReady call.
call TriggerSyncStart()
//Sync the value of the entry for each player.
//Each value will sync to the value of the host.
call SyncStoredInteger(GameCache(), "missionKey", "key")
//Wait until the Game Cache syncs the key for everyone.
call TriggerSyncReady()
//Return the synced value as a id.
return GetStoredInteger(GameCache(), "missionKey", "key") - 1
endfunction
I placed that script in triggers, at top where the name of the map is.
I also made a Variable named "Host" and it's a "player" variable.
and the last thing is this:
Trigger:
- Start of the map
- Events
- Map initialization
- Conditions
- Actions
- Custom script: call GetHost()
- Events
But I get an error on that trigger, so what am I doing wrong?
(error= Line 276: Expected a function name)