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

Status
Not open for further replies.
Level 12
Joined
Jul 5, 2014
Messages
551
  • Events
    • Unit - A unit owned by Player 2 (Blue) Dies
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DoorOpen Equal to 1
      • (Owner of (Killing unit)) Equal to Player 1 (Red)
      • (Number of units in (Units in Region 002 <gen> owned by Player 2 (Blue))) Equal to 0
    • Then - Actions
      • Wait 1.00 seconds
      • Game - Display to (All players) for 12.00 seconds the text: CORTEZ WINS!!!
      • Wait 1.70 seconds
      • Sound - Play Credits <gen> at 100.00% volume, skipping the first 70.40 seconds
    • Else - Actions
      • Do nothing

It's an arena-like fight between 2 players. Dooropen 1 refers to closed doors. The trigger works without the "number of units" trigger, but with it, somehow it doesn't activate. It should be the trigger that confirms that I killed all the blue units in the region, but the editor doesn't like it for some reason. What am I doing wrong?
 
Level 20
Joined
Jul 14, 2011
Messages
877
Try adding something like:
  • (Number of units in (Units in Region 002 <gen> matching (((Owner of (Matching unit)) Equal to Player 2 (Blue)) and (((Matching unit) is alive) Equal to True)))) Equal to 0
Also, remove the 'Do Nothing' action. It literally does nothing.
 
^Why does it not work so well?
JASS:
function IsUnitDeadBJ takes unit whichUnit returns boolean
    return GetUnitState(whichUnit, UNIT_STATE_LIFE) <= 0
endfunction
JASS:
function IsUnitAliveBJ takes unit whichUnit returns boolean
    return not IsUnitDeadBJ(whichUnit)
endfunction

@WarCortez
Just to inform you, " Number of units..." will create a group so it leaks.
 
Level 12
Joined
Jul 5, 2014
Messages
551
^Why does it not work so well?
JASS:
function IsUnitDeadBJ takes unit whichUnit returns boolean
    return GetUnitState(whichUnit, UNIT_STATE_LIFE) <= 0
endfunction
JASS:
function IsUnitAliveBJ takes unit whichUnit returns boolean
    return not IsUnitDeadBJ(whichUnit)
endfunction

@WarCortez
Just to inform you, " Number of units..." will create a group so it leaks.

This is small, training map with very few triggers. A leak like that cause no problem.
 
Status
Not open for further replies.
Top