HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

GetLocalPlayer()

09-13-2007, 08:39 AM#1
Silvenon
Can anyone explain me what does it do exactly? I'm a noob at these stuff (desyncs)

EDIT: Arghhh I spelled it wrong......
09-13-2007, 09:16 AM#2
Anitarf
It gives you the local player. Triggers are simultaneously executed on all computers involved in a multiplayer game, this function can tell the computer that's executing the code which computer it's on. This way, you could for example change the terrain fog for only a single player, by checking if the local player equals a specific player you could get the fog change action to only run on one player's PC. However, you are very limited regarding the things you can do with this: if you do anything that affects the gamestate for only one player, the game will desync (you will get a server split). Things you shouldn't do include, but are not limited to: creating units, changing their hp/mana, adding or removing abilities or reseting their cooldowns, creating any kind of handle (unit, destructible, unit group, player group, effect, location...), using new unique strings, applying visibility modifiers... What you can do is purely cosmetic stuff like change unit vertex colouring, change fog, move cameras and other stuff that doesn't need to be synced.
09-13-2007, 09:25 AM#3
botanic
also don't use damage point it desyncs mac's 100% of the time

thought id throw that out there while I was at it... going to bed so ya ;P
09-13-2007, 09:34 AM#4
The Elite
Quote:
also don't use damage point it desyncs mac's 100% of the time
and people are on macs......... 2% of the time, (yes Tide Arc, i know your on a mac,) so its no biggy
09-13-2007, 05:00 PM#5
grim001
Macs are broken for WC3, I choose to ignore that they exist.
09-13-2007, 05:03 PM#6
Vexorian
my eyes! please change your sig.

Mac users should just get one with x86 architecture then get vmware and enjoy true interoperability exploiting the virtual machine...
09-13-2007, 06:25 PM#7
Toadcop
Quote:
using new unique strings
phalse =) strings,texttags,lightnings,images,ubersplats (maybe some others) maybe be CREATED localy =) and it will not desync ! it's special so...
+ btw gamecache intialization localy desyncs. cause it's create every time a new handle in "0x100000" range (InitGameCache())
hmmm do know why BUT ! i have dynamicly+localy changed MBs row/collumn count + set some value into and it have not desynced Oo i dunno really why... hmmm maybe mbitems has own handle range or something. anyway it seems to work.

Engineering Upgrade Ability can be used to change abilitys interface localy. so i use storm bolt one player can see a storm bolt model and the other one can see nothing or some other model. (only visual stuff) but someone may use it.
09-14-2007, 02:48 AM#8
botanic
Im on a mac as well and actually I think it is closer to about 5% of ppl that are on wc3 are on macs... ne ways i'd rather not make it so that there is a random bug in ANY part of my code that can desync ANYONE :/ just me tho

@Vexd I dunno I kinda like it :P
09-14-2007, 06:09 AM#9
Captain Griffen
Damage point sucks anyway. No one should use it due to its awesome crappiness.
09-14-2007, 06:11 AM#10
Tide-Arc Ephemera
What the hell does Damage Point/Circle do? Just wondering.
09-14-2007, 06:28 AM#11
Pyrogasm
Damages all units within X distance of a target point.
09-14-2007, 08:42 AM#12
Silvenon
Yeah, but it damages all of them, so allies are damaged too, that's why it's so crappy. Better to put units in x range in a group, extract enemies, and then damage one by one.

Quote:
Originally Posted by Vexorian
my eyes! please change your sig.

Are you referring to my sig? If you are, what's wrong with it? Anyways, if you don't like it, you change it, why should I bother :P

Quote:
Originally Posted by Anitarf
It gives you the local player. Triggers are simultaneously executed on all computers involved in a multiplayer game, this function can tell the computer that's executing the code which computer it's on. This way, you could for example change the terrain fog for only a single player, by checking if the local player equals a specific player you could get the fog change action to only run on one player's PC. However, you are very limited regarding the things you can do with this: if you do anything that affects the gamestate for only one player, the game will desync (you will get a server split). Things you shouldn't do include, but are not limited to: creating units, changing their hp/mana, adding or removing abilities or reseting their cooldowns, creating any kind of handle (unit, destructible, unit group, player group, effect, location...), using new unique strings, applying visibility modifiers... What you can do is purely cosmetic stuff like change unit vertex colouring, change fog, move cameras and other stuff that doesn't need to be synced.

Oh yes, I totally understand know. I was wondering how they played a weather effect for only one player :P. Thanks

EDIT: So I can do this:

Collapse JASS:
if (GetLocalPlayer() == Player(0)) then
    call CameraSetupApplyForceDuration(gg_cam_blabla, true, 1)
endif
?

If I can, how does it get a local player if nothing is executing? Or I have to use CameraSetupApplyForPlayer?
09-14-2007, 10:13 AM#13
botanic
good time to use damage point

Throw grenade that damages all units in 600 range of the explosion.
09-14-2007, 04:09 PM#14
Vexorian
Perhaps the fact that I actually saw that function once in real time brings me bad memories (Requiring maps to fix optimizer bugs has taken me to see some of the worst code...)
09-15-2007, 01:50 AM#15
PandaMine
GetLocalPlayer is also used when taking into account cameras, i.e. GetCameraTargetPositionX/GetCameraTargetPositionY and SetCameraField (although for SetCameraField you have SetCameraFieldForPlayer which avoids the desync)

There are probably a lot more functions which you are either forced to use local code (GetLocalPlayer) or synchronise the data with PitzerMikes sync function, or Ai Andys sync function or using sync native with gamecache