| 05-10-2007, 04:40 PM | #1 |
So i need to know how can i use local compares and then it's true i can launch a global function for all players !? Code:
function xxx takes nothing returns nothing
local boolean b=false
if GetLocalPlayer()==Player(0) then
if GetCameraTargetPositionX()>1000 then
set b=true
endif
endif
if b then
call DoNothing()
endif
endfunctionwill this cause a DeSync then true ??? if yes so how can i make it ? (sorry i don't have much MP coding XP xD ) |
| 05-10-2007, 04:49 PM | #2 |
Sorry, but wtf are you trying to do? I can't understand most of it. |
| 05-10-2007, 04:52 PM | #3 |
you could possibly do it if you are polling getlocalplayer for the host. (much in the way the GetHost() function works) but b is only set to true for the local player. Everything inside a GetLocalPlayer() "block" is only for the local player.. and its impossible to resync with anyone but the host. Atleast, i think. |
| 05-10-2007, 05:18 PM | #4 | |
hmmmm shit =) maybe you are right... but i think it must be something what i could do ! i think i must imagine this like all players runs the same code and sync the data if something is wrong then a desync... the problem is this part Quote:
well thanks Earth-Fury ;) |
| 05-10-2007, 07:30 PM | #5 |
Aha ! i have found a solution ! JASS:function echo takes string s returns nothing call DisplayTextToPlayer(GetLocalPlayer(),0,0,s) endfunction function GetFieldXBR takes player p,camerafield cf returns real if GetLocalPlayer()==p then return GetCameraField(cf) endif return 0. endfunction function Doxxx takes integer i returns nothing set udg_set=true // this is the point it could cause a desync cause it's a global var ! call echo("|cfffedaacActs for Player "+I2S(i)+"|r") endfunction function Trig_cgfg_Actions takes nothing returns nothing local integer i=0 local gamecache g=InitGameCache("InitGC.bx") loop exitwhen i>11 if Rad2Deg(GetFieldXBR(Player(i),CAMERA_FIELD_ANGLE_OF_ATTACK))>320 then call StoreBoolean(g,"b","b",true) endif if GetStoredBoolean(g,"b","b") then call Doxxx(i) endif call StoreBoolean(g,"b","b",false) set i=i+1 endloop call echo("OK") endfunction hmmm =) i seems to work only for booleans ^^ |
| 05-11-2007, 12:46 PM | #6 |
I don't see why you need gamecache here ... A local will be work too, no ? JASS:function Trig_cgfg_Actions takes nothing returns nothing local integer i=0 local boolean check = false loop exitwhen i>11 if Rad2Deg(GetFieldXBR(Player(i),CAMERA_FIELD_ANGLE_OF_ATTACK))>320 then set check = true call Doxxx(i) endif set i=i+1 endloop call echo("OK") endfunction Why not just that ? |
| 05-11-2007, 01:00 PM | #7 |
Troll-Brain well it will cause a DeSync anyway =( (but es your example is better) it's need to synchronized to work properly... btw global boolean are not synchronized !!! and gamecache too. |
| 05-11-2007, 01:13 PM | #8 |
Hmm set a global/local variable to a different value for each player never cause desynchronisation for me. I'm too lucky so ? xD |
