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

[GUI] How to Create a Quest That Uses Variables

Level 10
Joined
Dec 12, 2010
Messages
569
Hello, and welcome to my 2nd tutorial that shows you how to create a simple quest that uses variables. You would need to make variables for your quests for almost every quest you make that actually has a function.

In this tutorial, I will be making a quest that only has one quest requirement, kill 3 Murloc Tiderunners. This tutorial is making the assumption that the WE is already open along a map that you want to put a quest on.

Step 1: Open the Trigger Editor.

Step 2: Create a new trigger and give it the event, "Map initialization". In this tutorial, this trigger will be referred to has "Quest Creator." (You may choose to skip this step if you already have a trigger with the event, "Map initialization.")

Step 3: Create the "Quest - Create Quest" action for the "Quest Creator" trigger. Give the action a suitable title, description, icon, and choose to either display it as a required quest or an optional quest.

Step 4: Create a variable with the type Quest. The name of the variable doesn't matter, as long as you know which variable is the variable for your quest. In this tutorial, I will call it "KtM_Quest." Refer to the Screenshot below for help.

attachment.php


Step 5: Create the action, "Set Variable" for the "Quest Creator" trigger. Set the "Variable" to KtM Quest, or whatever the name is for your variable, and set the second value to "(Last Created Quest)." This sets the variable that you made to your quest.

Step 6: Then create the action "Quest - Create Quest Requirement" for KtM_Quest with a suitable description of your choosing (What you have to do to complete the quest. In this tutorial, I will make the description, "Kill 3 Murloc Tiderunners.").

Step 7: Create a new trigger. In this tutorial, I will call it "Kill the Murlocs Completion." Also, for this tutorial, I'm going to give it the following events, conditions, and actions:


  • Kill the Murlocs Completion
    • Events
      • Unit - Murloc Tiderunner 0005 <gen> Dies
      • Unit - Murloc Tiderunner 0006 <gen> Dies
      • Unit - Murloc Tiderunner 0007 <gen> Dies
      • Comment: The events are for when any of your units die
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Murloc Tiderunner 0005 <gen> is dead) Equal to True
          • (Murloc Tiderunner 0006 <gen> is dead) Equal to True
          • (Murloc Tiderunner 0007 <gen> is dead) Equal to True
          • Comment: This makes sure all of the other Murlocs are dead
        • Then - Actions
          • Quest - Mark (Last created quest requirement) as Completed
          • Quest - Mark KtM_Quest as Completed
          • Comment: The above action is when the quest you made gets completed
          • Quest - Display to Player Group - Player 1 (Red) the Quest Completed message: |cffffcc00QUEST COM...
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Execution count of (This trigger)) Equal to 1
              • Comment: The above condition is when the trigger fires a first time.
            • Then - Actions
              • Quest - Display to Player Group - Player 1 (Red) the Quest Update message: |cffffcc00QUEST UPD...
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Execution count of (This trigger)) Equal to 2
                  • Comment: The above condition is when the trigger fires a second time.
                • Then - Actions
                  • Quest - Display to Player Group - Player 1 (Red) the Quest Update message: |cffffcc00QUEST UPD...
                • Else - Actions
(Note: The actions I've created that display quest messages like this one...
  • Quest - Display to Player Group - Player 1 (Red) the Quest Update message: |cffffcc00QUEST UPD...
are optional and tells the player when he has killed one of the Murlocs that are required for him to kill.)

With this setup, the trigger works absolutely fine, but wait, no reward!? You can't have a quest with no reward! And that leads into our final step.

Step 8: Right before my second set of If/Then/Else actions with the "(Evaluation Count of (this trigger))" conditions and under my first If/Then/Else action, create a simple reward like "Player - Add Property" and use this to add a small amount of gold. You could have better rewards such as giving the player an item of some sort. Just use "Item - Create" and make it whatever item you want and create the item at a certain region.

It's true that you could use a variable with your Hero and have the item be given straight to your Hero, but that would require more work and as I already stated, another variable.

Warning: This tutorial may contain a few leaks since I did not check it. Leaks really don't bother me since it seems like they never really seem to do anything to the game (e.g. make the game take really long to unload, slow the game down, etc.). Leaks supposedly do make the game take longer to unload, but it seems that if your computer runs WC3 pretty good and is a little over the recommended system requirements, than your fine. I'm sure this doesn't have that many leaks since I didn't use any "Wait" commands, "Elapsed Time", or "Periodic Event" events.

That's it! You did it. Your quest should now be complete!
 

Attachments

  • Tutorial02_CreateVariable.jpg
    Tutorial02_CreateVariable.jpg
    329.4 KB · Views: 5,904
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
Dude, if this is a tutorial about quests using variables, then maybe you should use variables ;)

  • Quest - Mark (Last created quest requirement) as Completed
And where are quest discovered actions?

I recommend having three separete triggers
1) Create quest
2) Discover quest
3) Complete quest

You can run 1) at map initialization or from 2). Sometimes creating a quest when it is discovered is the better solution.
 
Top