• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

GetLocalPlayer()

Status
Not open for further replies.
Level 14
Joined
Mar 4, 2009
Messages
1,156
1.)
When can we use it ? ( When does it not make Disconnections/Problems)
2.)
When can´t we use it? ( When does it make Disconnections/Problems)
3.)
Is it ok to use it like this ? (just for detection of the LocalPlayer )
set udg_PlayerVariable = GetLocalPlayer
create unit at point for (PlayerVariable)
 
Level 26
Joined
Aug 18, 2009
Messages
4,099
You have to get a clue which information are shared among the player clients. Interactive objects like units may run internal events and your own ones that not only affect you. Cosmetic changes like setting the title of a multiboard is not of public interest and therefore safe.

Each object gets an id. Like some other, units use the standard handle counter (the id pool). Since there are object types like unit in this pool that are interactive you should not desync that counter. Else different objects will be called via one id.

Your example will be dangerous because, for the normal engine, it is important which player the unit belongs to, for alliance settings with automatical attack for example.

However, I once created two units from different types on different clients. I could do so because the handle counter was increased for all and the units only differed in output characteristics like having another name. So when I would not run into a situation where I would need to share the name or the different unit type id the unit was based of, that was fine.
 
Status
Not open for further replies.
Top