Will this GetLocalPlayer function cause desynch?

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Hi there :D

Here I am, using GetLocalPlayer for the first time to create my own function. I was hoping someone could take a look at it and let me know if it will cause a desynch, because I don't really understand the function or the concept by how it works.

Here it is:
JASS:
function HideItemFromPlayer takes item i, player p returns nothing
    if GetLocalPlayer() == p then
        call SetItemVisible(i,false)
    endif
endfunction

Basically I'm trying to hide a particular item from a particular player.

Thanks in advance! +rep is promised!
 

luorax

Invasion in Duskwood
Reaction score
67
I think it won't cause desyinc, because the handle exists for each player, but only "p" is able to see it. So noone's computer is going to think "what item? This game sucks", and will desync, they will think that "hmm, an item, but invisible. Okay, it seems to be okay"
 

Carnerox

The one and only.
Reaction score
84
I don't like it it exactly does it with items as well, but last night I was testing GetLocalPlayer() for hiding units for a certain player and it disconnected them all. It would probably not work with items either, I don't know though.
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
why not to test it yourself?
Maybe he does not have someone with whom to test desyncs?

Maybe he figures more experienced mappers would already know if it does, or if it only does in certain circumstances and who could explain what and why?

I myself have not tested it, but it would probably desync in at least the following circumstances:
1. A unit is issued an order targeting the item
2. A unit in windwalk tries to walk in its vicinity (windwalked units cannot pass through items and therefore there may be local differences in pathing of the unit, leading to a desync)
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
I don't like it it exactly does it with items as well, but last night I was testing GetLocalPlayer() for hiding units for a certain player and it disconnected them all. It would probably not work with items either, I don't know though.

Yes, because hiding removes the unit from the playspace in a gameplay sense; it's a lot like removing a unit entirely. So, the game functions differently on different computers.

I would imagine hiding items would have a similar effect, since one players' game might be able to interact with the item but another players' game wouldn't.


Things that DON'T desync are generally aesthetic in their most basic nature; anything that affects how gameplay works will cause conflicts between computers.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Hi guys, thanks for all the replies :) to put the usage of this function in context: My game is based on collecting elemental orbs from killed enemies to increase your own power. If you kill an enemy and he drops an orb that you already have, it's supposed to hide that orb so you can't interact with it, or even see it. The idea behind that is so you can't 'drag' items, like in Island defense where you can drag titan items, by picking them up even though you instantly drop them, but at your current location. From what I've gathered, it looks like a bad idea to use this function though :/
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
in island defense the problem was that once a unit picked up an item it wasnt allowed to pick up that particular item was dropped instantly.
this can be abused because this way the players still can drag the item towards their position even if they cannot pick it up entirely.

to bypass this you could change the event.
instead of "item is picked up" use "unit is ordered to pick up an item" (usually a "smart" order since smart stands for everything right-click related).
when a unit is ordered to pick up an item, check if the unit is allowed to pick the item up. if not? order the unit to stop, or maybe just to walk to the items position, or whatever. this way the system cannot be abused.

by the way, in island defense their was another reason for this effect, items pathing could block the construction of buildings like walls or towers, the titan could have placed items which couldnt be picked up by builders at certain positions inside their bases to make them unable to rebuild walls and towers there.
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
When the item is picked up, its position is NOT hero's position BUT the position before it's picked up so this:
Trigger:
  • Drop Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set TempItem = (Item being manipulated)
      • Set TempPoint = (Position of TempItem)
      • Hero - Drop TempItem from (Triggering unit)
      • Item - Move TempItem to TempPoint
      • Custom script: call RemoveLocation( udg_TempPoint )

works just fine :) (you should add conditions, though)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top