• 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.

[Trigger] Why does this trigger not like variables?

Status
Not open for further replies.
Level 7
Joined
Jul 11, 2008
Messages
104
  • Events
    • Player - Player (1) Red types a chat message containing -revive As an exact match
  • Conditions
    • (SeedofR <gen> is on) Equal to True
  • Actions
    • Blah blah blah
In events, why will it not allow me to select a variable for Owner of Unit (Instead of player 1 - red) no matter what variable type it is? It's only letting me select units that have already been generated on the map.
 
Level 7
Joined
Jul 11, 2008
Messages
104
that event is a player chat event...

that event cant be used with units because the player has to type in a chat event...

it would help if u also say wat u r trying to do

That event can be used with units. Owner of (Unit) types a a chat command. The problem is, I want to use units under a variable which it's not letting me do.

And the actions are irrelevant to my issue.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
In events, why will it not allow me to select a variable for Owner of Unit (Instead of player 1 - red) no matter what variable type it is? It's only letting me select units that have already been generated on the map.
Because the native that generates the event object uses pass-by-value arguments so it is forced to use whatever value it is passed when you call it. Yes you can use variables or even other natives to get the values, but only the value they evaluate to at the time of the call is used to create the event object and that event object will continue to use that value until the end of the trigger's life (the trigger is destroyed) in which case the event object is also destroyed.

JASS is functional/procedural, not declarative so you cannot get it to resolve stuff when required. Owner of a unit returns a player and it is that player value that is passed around. It does not pass around a reference to a function/method that returns a player which is evaluated on demand.
 
Status
Not open for further replies.
Top