• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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