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

[JASS] Quck JASS question

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
I was wondering. If one player activates this. Will not other players as well?
JASS:
function InitTrig_PST_Enable takes nothing returns nothing
    local integer index
    set gg_trg_PST_Enable = CreateTrigger(  )
    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(gg_trg_PST_Enable, Player(index), EVENT_PLAYER_UNIT_ISSUED_ORDER, null)
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
endfunction
 
Hmm... I might have not given enough information. In your example, you register the event for each player. Once the trigger is registered for an event, it fires once. Those actions are performed globally once, total.

If it makes more sense, the difference is between this:
  • Unit - A unit owned by Player 1 (Red) dies
And this:
  • Unit - A unit dies
It simply checks whether or not any unit dies of any player opposed to of a single player. ;)
 
Level 9
Joined
Jun 7, 2008
Messages
440
Sorry this is getting even more confusing. The trigger itself is supposed to fire when a unit dies. Does the loop check during the process of the unit dying? Or afterwards? I think it may just be easier to add each player and go with that.
 
Sorry this is getting even more confusing. The trigger itself is supposed to fire when a unit dies. Does the loop check during the process of the unit dying? Or afterwards? I think it may just be easier to add each player and go with that.

I think you might be misinterpreting what happens. ;\
JASS:
function InitTrig_PST_Enable takes nothing returns nothing
    local integer index
    set gg_trg_PST_Enable = CreateTrigger(  )
    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(gg_trg_PST_Enable, Player(index), EVENT_PLAYER_UNIT_ISSUED_ORDER, null)
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
endfunction

This is ran only once on map initialization. Once any unit dies, it will be registered by the trigger and the conditions/actions will be called.

As for the code you posted, it should work fine. ;D
 
Status
Not open for further replies.
Top