Does this leak?

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,614
Does this leak?

Does this work properly?

  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) has an item of type Healing Salve) Equal to True
          • (Charges remaining in (Item carried by (Picked unit) of type Healing Salve)) Greater than 0
        • Then - Actions
          • Item - Set charges remaining in (Item carried by (Picked unit) of type Healing Salve) to ((Charges remaining in (Item carried by (Picked unit) of type Healing Salve)) - 1)
          • Skip remaining actions
        • Else - Actions
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
It might bug, depending on what you're trying to do.

In a trigger like this, the skip remaining actions isn't actually doing anything:
  • Untitled Trigger 063
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 1 (Red) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
        • Loop - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: Text 1
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Footman
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: Footman found
              • Skip remaining actions
            • Else - Actions
      • Game - Display to Player Group - Player 1 (Red) the text: Text 2
It will still loop through all remaining units even though a footman is found. It will display Text 1 for all units in the group and also Text 2 will be displayed.

Look at the trigger conveted to JASS:
JASS:
function Trig_Trigger_064_Func001001002 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction

function Trig_Trigger_064_Func001Func002C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetEnumUnit()) == 'hfoo' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Trigger_064_Func001A takes nothing returns nothing
    call DisplayTextToForce( bj_FORCE_PLAYER[0], "TRIGSTR_064" )
    if ( Trig_Trigger_064_Func001Func002C() ) then
        call DisplayTextToForce( bj_FORCE_PLAYER[0], "TRIGSTR_065" )
        return // This is "skip remaining actions"
    else
    endif
endfunction

function Trig_Trigger_064_Actions takes nothing returns nothing
    call ForGroupBJ( GetUnitsOfPlayerMatching(Player(0), Condition(function Trig_Trigger_064_Func001001002)), function Trig_Trigger_064_Func001A )
    call DisplayTextToForce( bj_FORCE_PLAYER[0], "TRIGSTR_066" )
endfunction

//===========================================================================
function InitTrig_Trigger_064 takes nothing returns nothing
    set gg_trg_Trigger_064 = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Trigger_064, Player(0) )
    call TriggerAddAction( gg_trg_Trigger_064, function Trig_Trigger_064_Actions )
endfunction

So it only skips out of the function that deals with that single unit, not the one that deals with the loop.
 
Status
Not open for further replies.
Top