• 🏆 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!

How to make a quest that makes the player destroy multiple enemy bases? (Trigger examples would be nice, pls)

Level 7
Joined
Apr 10, 2022
Messages
44
Hello.

I may have been making a lot of maps lately and know to do triggers, but there's one thing it still can't get right, mostly about quest that revolve in destroying "multiple enemy bases.".

Triggers.png


I tried the integer variable of the number of bases destroyed...
Triggers.png


But the problem is that I don't know how to mark the quest completed when all bases are destroyed by events...
Triggers.png


I tried the "specific unit" and "generic" unit event, nothing worked...


I need some advice about these kinds of quest. Please help me? Anyone comment?
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,641
I assume a base is a single building, like destroy 3 different Town Halls. In which case you can do something like this:
  • ClawsAndSwords Start Quest
    • Events
      • ... Something happens to start the quest
    • Conditions
    • Actions
      • -------- Start the quest --------
      • Unit Group - Add Town Hall <001> to ClawsAndSwords_Bases
      • Unit Group - Add Town Hall <002> to ClawsAndSwords_Bases
      • Unit Group - Add Town Hall <003> to ClawsAndSwords_Bases
      • Set Variable ClawsAndSwords_Count = (Number of units in ClawsAndSwords_Bases)
      • Trigger - Turn on ClawsAndSwords Base Dies
^ Replace the Town Halls with your three different enemy bases. ClawsAndSwords_Bases is a Unit Group variable.
  • ClawsAndSwords Base Dies
    • Events
      • Unit - A unit dies
    • Conditions
      • ((Triggering unit) is in ClawsAndSwords_Bases Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from ClawsAndSwords_Bases
      • Set Variable ClawsAndSwords_Count = (ClawsAndSwords_Count - 1)
      • Trigger - Run ClawsAndSwords Finish Quest (checking conditions)
^ We check to see if the unit that died was in our Unit Group that contains the three enemy Bases. If it is, we subtract 1 from our Integer variable using the Arithmetic function and run a trigger that will handle finishing the quest (IF the conditions have been met). Ideally this trigger would be off by default since it only needs to be on once the quest has started.

  • ClawsAndSwords Finish Quest
    • Events
    • Conditions
      • ClawsAndSwords_Count Equal to 0
    • Actions
      • -------- Finish the quest --------
      • Trigger - Turn off ClawsAndSwords Base Dies
^ We finish the quest once all three bases have been killed.


What's nice about this setup is you can add any number of units to ClawsAndSwords_Bases in the Start Quest trigger and it'll continue to work as intended.

Note that you could get rid of the ClawsAndSwords_Count variable and instead use (Number of units in ClawsAndSwords_Bases) Equal to 0 as your Condition in the Finish Quest trigger. This would make it even more automated and dynamic at the cost of a little efficiency.
 
Last edited:
Level 7
Joined
Apr 10, 2022
Messages
44
I assume a base is a single building, like destroy 3 different Town Halls. In which case you can do something like this:
  • ClawsAndSwords Start Quest
    • Events
      • ... Something happens to start the quest
    • Conditions
    • Actions
      • -------- Start the quest --------
      • Unit Group - Add Town Hall <001> to ClawsAndSwords_Bases
      • Unit Group - Add Town Hall <002> to ClawsAndSwords_Bases
      • Unit Group - Add Town Hall <003> to ClawsAndSwords_Bases
      • Set Variable ClawsAndSwords_Count = (Number of units in ClawsAndSwords_Bases)
      • Trigger - Turn on ClawsAndSwords Base Dies
^ Replace the Town Halls with your three different enemy bases. ClawsAndSwords_Bases is a Unit Group variable.
  • ClawsAndSwords Base Dies
    • Events
      • Unit - A unit dies
    • Conditions
      • ((Triggering unit) is in ClawsAndSwords_Bases Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from ClawsAndSwords_Bases
      • Set Variable ClawsAndSwords_Count = (ClawsAndSwords_Count - 1)
      • Trigger - Run ClawsAndSwords Finish Quest (checking conditions)
^ We check to see if the unit that died was in our Unit Group that contains the three enemy Bases. If it is, we subtract 1 from our Integer variable using the Arithmetic function and run a trigger that will handle finishing the quest (IF the conditions have been met). Ideally this trigger would be off by default since it only needs to be on once the quest has started.

  • ClawsAndSwords Finish Quest
    • Events
    • Conditions
      • ClawsAndSwords_Count Equal to 0
    • Actions
      • -------- Finish the quest --------
      • Trigger - Turn off ClawsAndSwords Base Dies
^ We finish the quest once all three bases have been killed.


What's nice about this setup is you can add any number of units to ClawsAndSwords_Bases in the Start Quest trigger and it'll continue to work as intended.

Note that you could get rid of the ClawsAndSwords_Count variable and instead use (Number of units in ClawsAndSwords_Bases) Equal to 0 as your Condition in the Finish Quest trigger. This would make it even more automated and dynamic at the cost of a little efficiency.
It more like, destroying 3 entire bases, all their buildings... something like that.
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,641
Okay, then add all of the buildings to the Unit Group.

If there's a lot and you don't feel like manually adding them then do something like this:
  • Set Variable ClawsAndSwords_Bases = (Units in playable map area matching (Matching unit) is a Building Equal to True)
You can adjust the conditions to find your desired units.
 
Top