• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

GetLocalPlayer()

Status
Not open for further replies.
Level 13
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,097
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