| 04-27-2008, 10:13 PM | #1 |
What functions can be used in local player code without risking desyncs? Is there a list somewhere? For example, I know DisplayTextToPlayer works locally, as is shown in DisplayTextToForce: JASS:function DisplayTextToForce takes force toForce, string message returns nothing if (IsPlayerInForce(GetLocalPlayer(), toForce)) then // Use only local code (no net traffic) within this block to avoid desyncs. call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, message) endif endfunction |
| 04-27-2008, 10:34 PM | #2 |
one which don't do global actions ? for example displaying message isn't global. texttags self are not global so you can create texttags local. (same for lightning,ubersplats,images but i am not 100% ure but i guess it's so.) |
| 04-27-2008, 11:54 PM | #3 |
You can display anything locally as long as it doesn't effect the gameplay (or data between players; desync). I suggest whatever you do create for all players then make a local block/trigger to display it to only one player. game-text, special effects, camera, text-tags, lightning, ubersplats, images, ?buffs?, ?trackables?, ?timers?, Animation: ?all? Camera: all Cinematic: ?all? Enviroment: Weather water color sky ?fog? Floating Text: all Too many to say. Basicly anything you can do which will not cause any problems for other computers (data/syncing). For example: creating a local unit has collision and effects others (thats a no no), or creating a special effect locally will desync (you need to create the effect data for everyone then display is locally to the player. All data must be the same.) |
| 04-28-2008, 04:53 AM | #4 | |
Quote:
So... what would I need to change if my code is: JASS:if (GetLocalPlayer() == lPlayer) then set lEffect = AddSpecialEffectTarget(<Special Effect Model>, lUnit, <Attach Point>) call DestroyEffect(lEffect) set lEffect = null endif |
| 04-28-2008, 05:31 AM | #5 |
someone once said to me you have to null the path for every player you dont want to display the model to and then create the model for every player (the only difference is the path). |
| 04-28-2008, 05:31 AM | #6 |
You'd write this instead: JASS:local string ModelFile = "" if (GetLocalPlayer() == lPlayer) then set ModelFile = <Special Effect Model> endif call DestroyEffect(AddSpecialEffectTarget(ModelFile, lUnit, <Attach Point>) |
| 04-28-2008, 05:59 AM | #7 | |
Quote:
Small point: you can display a text tag to only one player, but you still have to _create_ it for every player. If you only create a text tag for one player, their handle ids will go out of sync. |
| 04-28-2008, 06:16 AM | #8 | |
Quote:
Actually, its safer to do: JASS:local string ModelFile = <Special Effect Model> if (GetLocalPlayer() != lPlayer) then set ModelFile = "" endif call DestroyEffect(AddSpecialEffectTarget(ModelFile, lUnit, <Attach Point>) |
| 04-28-2008, 01:44 PM | #9 | |
Quote:
// and it will not desync. string table don't need to be synced in truth. only if you use string indexes to attaching data you need. |
| 04-28-2008, 04:20 PM | #10 | |
Quote:
Is that so? I've never tried it, I just assumed it would cause problems. I especially expected consequences with H2I. |
| 04-29-2008, 07:22 AM | #11 | ||||||||
orly, Ammorth? I didn't really know it made a difference. In fact, it still doesn't seem like it would matter, because either way the string tables will be "unsynced". If I did it my way: Example String Table:
Example String Table:
I'd say each are equally "unsynced"... if it was simply no string instead of a null string (""), then it wouldn't be the same, but the way I see it neither way is better nor worse. |
| 04-29-2008, 10:35 AM | #12 | |||||||||
Quote:
"" already exists at position 1 in the string table [for every player], so it remains synced. |
| 04-30-2008, 06:52 AM | #13 |
Oh. |
| 05-01-2008, 12:59 AM | #14 |
Don't create handles using GetLocalPlayer(). There are only certain exceptions where the handle isn't normally allocated as regular handles are. Texttags, lightning, etc. You can use H2I and see if they are less than 0x100000... Stay away from creating handles for local players in general if you are not sure. Displaying it for players is probably the way to go unless someone performs an action on the object or whatever the case may be. (Which is why you don't create/show units locally unless they are stationary and don't do anything at all, but it is still kind of dangerous) Um... You get the point/jist of it at least. |
