• 🏆 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!

Special Effect

Status
Not open for further replies.
Level 9
Joined
Feb 15, 2013
Messages
372
Level 26
Joined
Aug 18, 2009
Messages
4,097
No, GetLocalPlayer() returns a single player. You can only compare it to other player expressions.

You can use

JASS:
if IsPlayerInForce(GetLocalPlayer(), GetPlayersAllies(Player(0))) then
    ...
endif

GetPlayersAllies creates a new force though, that should be removed or recycled. You can setup the force in GUI.

Also, the local block works that way that only players (clients) who match the condition execute what is inside. GetLocalPlayer returns a different player per client, that's why it causes an asynchronity. You have to be careful to only put stuff in these places that is not prone to cause net traffic and does not alter the gameplay.
 
Level 9
Joined
Feb 15, 2013
Messages
372
No, GetLocalPlayer() returns a single player. You can only compare it to other player expressions.

You can use

JASS:
if IsPlayerInForce(GetLocalPlayer(), GetPlayersAllies(Player(0))) then
    ...
endif

GetPlayersAllies creates a new force though, that should be removed or recycled. You can setup the force in GUI.

Also, the local block works that way that only players (clients) who match the condition execute what is inside. GetLocalPlayer returns a different player per client, that's why it causes an asynchronity. You have to be careful to only put stuff in these places that is not prone to cause net traffic and does not alter the gameplay.

GetPlayersAllies(Player(0)))??? that 0 stands for?
 
Level 3
Joined
Dec 14, 2014
Messages
29
Stands for "whatever".
When you create a map and set the units etc, ANY player can be controlled by a human player. There are 11 available players out there for you to choose, which one is your "human controlled" player?

Rick.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
It is evaluated from in to outside. The parenthesis behind a function name say to invoke this function and what's inside the parenthesis are the arguments to pass. So first the arguments have to be clear before the outer function can be called.

Therefore it's that execution order:

  1. GetLocalPlayer() <-returns the local player (if the local client plays Player 1 (Red), it returns Player 1 (Red), if he/she plays Player 2 (Blue), it returns Player 2 (Blue) and so on)
  2. Player(0) <-gets a player from its player number (Player 1 (Red) in this case)
  3. GetPlayersAllies(<player>) <-creates a new force containing the allies of <player>
  4. IsPlayerInForce(<player>, <force>) <-returns true if <player> is contained in <force>, else false

Check out a basic jass tutorial if you want to get a proper grasp.
 
Status
Not open for further replies.
Top