• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Special Effect

Status
Not open for further replies.
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.
 
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?
 
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.
 
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.
Back
Top