SelectUnit()

LearningCode

New Member
Reaction score
24
[lJASS]native SelectUnit takes unit whichUnit, boolean flag returns nothing[/lJASS]

Is there some other native for selecting a unit for a Player? o.0
Because I don't see how this will select a unit for a player.

I only see unit and boolean, nothing about player =/
 

Romek

Super Moderator
Reaction score
964
[ljass]GetLocalPlayer[/ljass] only causes desyncs if it's used incorrectly.
Don't get the idea that it automatically causes them. :p
 

Viikuna

No Marlo no game.
Reaction score
265
GetLocalPlayer, simply returns the player who is playing the game. Just use your common sense, and you should be able to figgure out what stuff should not be done with it.

For example, creating a unit in only player 1´s computer makes no sense. Example: You create some dungeon boss for only player 1´s computer. Player one attack that boss with his hero, but since that boss doesnt exists on player 2´s computer, player 1´s hero cant attack it on player 2´s computer, and stuff like that. The whole thing would be like really impossible and fucked up and everything. ( If you did something like that, the game would have server splitted long time ago, because the game is no longer the same game for all those players. )

Then again, doing stuff like selections, and camera thingies are no problem. ( All players rarely look at the exact same spot, or have exactly the same units selected. That stuff is different for players )

Its easy to make stuff look different for players with GetLocalPlayer, and thats what it is mostly used.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Creating handles in [ljass]GetLocalPlayer()[/ljass] block will cause desync, others work fine.
 

Sickle

New Member
Reaction score
13
Not true. A text tag is a handle and be created locally just fine. It is agents that we should worry about creating locally.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Prove it.

The locations for texttags in the memory are pre-allotted, and you can only have a certain amount of of them at once (I believe 64). [ljass]CreateTextTag[/ljass] doesn't so much create one as return the handle in the pre-allotted memory. The [ljass]Player[/ljass] native works in a similar way.
 

Viikuna

No Marlo no game.
Reaction score
265
Texttags, images, lightnings.

Asynchronous handles, which have their own handle id stack, thus creating them locally wont mess up with that "real" handle id stack thingy.

edit. It might be that only agents share this one handle stack thingy, but I havent really tested that stuff by myself, so Im not sure.

Anyways, texttags, images and lightnings are only visual stuff. Im not sure about effects, but you can always use some effect file path string which is different for players:

JASS:

local string path="effect.mdx"
if GetLocalPlayer()!=Player(0) then
    set path=""
endif
call AddSpecialEffectTarget(unit,path,"origin")
 

LearningCode

New Member
Reaction score
24
*Feels lost*
Great -___-

Everytime I ask a question, it gets answered.
But with it, comes about 15 more new questions =/
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615

They do. You can change the model path for different players, but you can't simply create an effect on one computer and not on another.

Everytime I ask a question, it gets answered.
But with it, comes about 15 more new questions =/

This is a good thing! If you don't have any more questions it means you're bored and not interested or learning!

Acturally, i belive its widgets.

No, widgets are not all it's limited to. Triggers are completely unrelated to a widget, but creating, destroying, or running one inside a GetLocalPlayer block will cause a black hole to swallow the sun. There's a general rule that handles do it, but there are many exceptions. It's simplest just to assume that things that affect the gameplay cannot be used locally.
 

Sickle

New Member
Reaction score
13
>>but creating, destroying, or running one inside a GetLocalPlayer block will cause a black hole to swallow the sun.

Not exactly. A trigger can run fine locally. But you have to watch what the trigger is running.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top