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

Quest that kill multiple units. How to do?

Status
Not open for further replies.
Level 4
Joined
Jun 2, 2012
Messages
747
Hey, hivers! How do I do a quest that you will kill multiple type of units? For example you have to kill 3 kobold, 3 satyr and 3 troll...like that. This is my trigger but it doesnt work:
  • The Revenge Update
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Quest1 is enabled) Equal to True
      • (Unit-type of (Dying unit)) Equal to Demon Swordsman
      • (Unit-type of (Dying unit)) Equal to Returned Knight
      • (Unit-type of (Dying unit)) Equal to Returned Mage
    • Actions
      • Set DemonsSwordsmanKilled = (DemonsSwordsmanKilled + 1)
      • Set ReturnedKnightKilled = (ReturnedKnightKilled + 1)
      • Set ReturnedMageKilled = (ReturnedMageKilled + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DemonsSwordsmanKilled Equal to 3
          • ReturnedKnightKilled Equal to 3
          • ReturnedMageKilled Equal to 3
        • Then - Actions
          • Quest - Display to (All players) the Quest Update message: You have killed the...
        • Else - Actions
 
Level 4
Joined
Aug 26, 2012
Messages
123
Um, If you use "equal to", doesn't that mean if you kill Demon Swordsman 4 times but not kill another one, the DemonsSwordsmanKilled will become 4, and the If/then/else will be always false?

(He means that it's better use "Greater than or equal to", because "equal to" is an exact match...)
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
Hello there.

The reason for why it's not working is because of your conditions. The conditions determine whether or not your actions are run. When you then check if the dying unit is both "Demon Swordsman" and "Returned Knight" and "Returned Mage", your actions will not run. A unit cannot be of multiple types. It's important to know that the conditions are checked each time a unit dies. The "Dying unit" is not a cumulative term, as in it doesn't point to all the units that have died.

So, how to make it work?

The solution lies in taking these lines:
  • (Unit-type of (Dying unit)) Equal to Demon Swordsman
  • (Unit-type of (Dying unit)) Equal to Returned Knight
  • (Unit-type of (Dying unit)) Equal to Returned Mage
...and moving them into an If-Then-Else in your actions.

In other words, this is what your trigger should look like:
  • The Revenge Update
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Quest1 is enabled) Equal to True
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Dying unit)) Equal to Demon Swordsman
      • Then - Actions
        • Set DemonsSwordsmanKilled = (DemonsSwordsmanKilled + 1)
        • Update the quest?
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Dying unit)) Equal to Returned Knight
          • Then - Actions
            • Set ReturnedKnightKilled = (ReturnedKnightKilled + 1)
            • Update the quest?
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Unit-type of (Dying unit)) Equal to Returned Mage
              • Then - Actions
                • Set ReturnedMageKilled = (ReturnedMageKilled + 1)
                • Update the quest?
              • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • DemonsSwordsmanKilled Greater than or equal to 3
        • ReturnedKnightKilled Greater than or equal to 3
        • ReturnedMageKilled Greater than or equal to 3
      • Then - Actions
        • Quest - Display to (All players) the Quest Update message: You have killed the...
      • Else - Actions
 
Level 4
Joined
Aug 26, 2012
Messages
123
Oh, yeah, I wanna post that trigger, The Reborn Devil, but you did it first... Thanks for writing the trigger.

(So, Allain55X, hope you understand...)
 
Oh yes and use 'OR' in your conditions. xD
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Demon Swordsman
        • (Unit-type of (Triggering unit)) Equal to Returned Knight
        • (Unit-type of (Triggering unit)) Equal to Returned Mage
edit: When taking what unit is dying instead of using 'Dying unit' instead use 'Triggering unit' it's slightly faster.
 
Status
Not open for further replies.
Top