• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Triggers, Quest: Kill all enemy structures

Status
Not open for further replies.
Level 3
Joined
Aug 27, 2019
Messages
44
I am creating one of most common mission objectives for a campaign. I want to create quest where player needs to kill all enemy structures.

My trigger is not working at the moment I am not exactly sure what is wrong.

I believe there is many ways to do this trigger but I will show what I have at the moment.

  • Count enemy structures
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set I_Structures = (Number of units in (Units owned by Player 6 (Orange) matching (((Triggering unit) is A structure) Equal to True)))
  • Create quest
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Quest - Create a Required quest titled Destroy enemies with the description Complete all main q..., using icon path ReplaceableTextures\CommandButtons\BTNHumanBarracks.blp
      • Set Q_Destroy = (Last created quest)
      • Quest - Create a quest requirement for Q_Destroy with the description Destroy all enemy s...
      • Set QR_Destroy = (Last created quest requirement)
      • Quest - Display to (All players) the Quest Discovered message: |cffffcc00MAIN QUES...
  • Enemy structure dies
    • Events
      • Unit - A unit owned by Player 6 (Orange) Dies
    • Conditions
      • ((Triggering unit) is A structure) Equal to True
    • Actions
      • Set I_Structures = -1
      • If (I_Structures Equal to 0) then do (Trigger - Run Victory <gen> (checking conditions)) else do (Do nothing)
I want to use Integer for this trigger because I can easily modify this trigger for other missions later. For example change this quest to "Destroy all Farms" instead by changing what units are counted to integer. Basic structure what I need for most of my quest triggers is to count type of units at beginning of map and each time unit is killed change amount by -1 and when count is 0 run victory trigger.

We were also talking about same kind of quest in this thread: [General] - Triggers, Quest: Kill 10 Footman
 
Last edited:
Level 28
Joined
Feb 18, 2014
Messages
3,574
There is a condition under Integer comparison that lets you check how many enemy structures are left on the map.
  • All Buildings Dead
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Count structures controlled by Player 6 (Orange) (Exclude incomplete structures)) Equal to 0
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Run Victory <gen> (checking conditions)
You can also pick every structure controlled by the enemy player and add them to a Unit Group and then check when all units in that Unit group are dead using a periodic event like in the trigger above.

By the way, there are two mistakes in your trigger:

Set I_Structures = (Number of units in (Units owned by Player 6 (Orange) matching (((Matching unit) is A structure) Equal to True)))

and

Set I_Structures = (I_Structures - 1)
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
Be aware that the count Warseeker suggested is listed under Player - Count structures inside integer comparison, and it is not the Unit - Count units in group action. The latter will leak a group while Warseeker's suggestion is a native to count and does not leak.
 
Level 3
Joined
Aug 27, 2019
Messages
44
It took a while for me to understand to use Artihmetic function.

Set Variable ... Arithmetic

SOLVED

My currently working version of triggers:

  • Count enemy structures
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set I_Structures = (I_Structures + (Count structures controlled by Player 6 (Orange) (Exclude incomplete structures)))
  • Create quest
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Quest - Create a Required quest titled Destroy enemies with the description Complete all main q..., using icon path ReplaceableTextures\CommandButtons\BTNHumanBarracks.blp
      • Set Q_Destroy = (Last created quest)
      • Quest - Create a quest requirement for Q_Destroy with the description Destroy all enemy s...
      • Set QR_Destroy = (Last created quest requirement)
      • Quest - Display to (All players) the Quest Discovered message: |cffffcc00MAIN QUES...
  • Enemy structure dies
    • Events
      • Unit - A unit owned by Player 6 (Orange) Dies
    • Conditions
      • ((Triggering unit) is A structure) Equal to True
    • Actions
      • Set I_Structures = (I_Structures - 1)
      • If (I_Structures Equal to 0) then do (Trigger - Run Victory <gen> (checking conditions)) else do (Do nothing)
 
Status
Not open for further replies.
Top