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

[Trigger] trigger required

Status
Not open for further replies.
Level 10
Joined
Apr 3, 2006
Messages
535
im trying to make a "simple" quest of killing say 10 of the same enemys. How would i go about doing this in my map. So far i understand i need to store the kills, or unit type? as a variable.
 
Level 4
Joined
Jun 8, 2007
Messages
89
You would create an integer to store the number of units killed. The trigger would look something like this:
Event: Whenever a unit dies
Condition: if triggering unit == <desired type>
Action: set <your integer> = <your integer> + 1.

If you want to use the Warcraft 3 built in quest system, there are some nice built in actions to manage that that aren't too hard to understand.
 
Level 10
Joined
Apr 3, 2006
Messages
535
i understand the basics of triggers, its just im rubbish with variables as i have only really started to use them so its all new to me + i i have just come back to WC3 after a year or so so im a tad rusty. But thank you for the trigger + rep :p

-i tried this, but i need a trigger to catch the variable/kills? so how would i do this to say trigger quest complete after 10 kills?
 
Last edited:
Level 19
Joined
Sep 4, 2007
Messages
2,826
Here is a small example how how variables work.
Event
A guy eats taco.
Condition
Action
If, then, else Condition
If
Value of taco_left = 1 or more.
Then - Actions
Eat more tacos.
Set taco_left = taco_left - 1
Else - Actions
Buy more tacos.
Set taco_left = taco_left + 5

taco_left is an Integer variable which in this case tells how much taco(s) are left.


If you need any more help these instruction should lead you in the right direction.
Though the first trigger which gives, finishes quests and allow you to interact with the NPC is functional for multiplayer as well as singleplayer.
Don't get scared of all these triggers. Some of them are just to create some interactive between the NCP and the player.
To get this [(Player number of (Owner of (Killing unit)))] you need to set arrays(the amount of players) to the variables which are used in these triggers.
Count_Killed_Units is an integer variable with arrays.(the amount of players)
Quest_Pig_Hunt is also an integer variable with arrays.(the amount of players)
  • ReciveQuest
    • Events
      • Unit - A unit enters Farmer'sQ
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] Equal to 0
        • Then - Actions
          • Quest - Display to (All players) the Quest Update message: (Hi, my farm is getting overrunned by some pigs. Could you help me get rid of them + ((Name of (Owner of (Entering unit))) + ?))
          • Set (Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] = (Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] Equal to 1
        • Then - Actions
          • Quest - Display to (All players) the Quest Update message: (Hi, have you killed those horrible pigs yet + ((Name of (Owner of (Entering unit))) + ?))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] Equal to 2
        • Then - Actions
          • Quest - Display to (All players) the Quest Update message: (((Thanks + (Name of (Owner of (Entering unit)))) + for getting ridd of those pigs for me. Here take this item.) + <Empty String>)
          • Set Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] = (Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] Equal to 3
        • Then - Actions
          • Quest - Display to (All players) the Quest Update message: Hi, there.
        • Else - Actions
AS you've seen, there are 4 stages in this trigger.
1: The entering player gets the quest by giving his variable (Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] the value 1.
2: When the player returns with the (Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] still with the value 1 the player gets to know that the quest isn't done yet.
3: When the player returns from finishing the quest he gets an item
4: Every time the player walks around the quest giver he says "Hi, there!"
First you need a trigger that counts how many quest units you've killed which will for fill the first trigger. It Should look simulare to this:

  • CountKilledUnit - Works in multiplayer
    • Events
      • Unit - A unit Dies
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • Quest_Pig_Hunt[(Player number of (Owner of (Killing unit)))] Equal to 1
          • (Unit-type of (Dying unit)) Equal to Pig
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Count_Killed_Units[(Player number of (Owner of (Killing unit)))] Less than 10
        • Then - Actions
          • Set Count_Killed_Units[(Player number of (Owner of (Killing unit)))] = (Count_Killed_Units[(Player number of (Owner of (Killing unit)))] + 1)
          • Game - Display to (All players) the text: (((Name of (Owner of (Killing unit))) + has killed ) + (String(Count_Killed_Units[(Player number of (Owner of (Killing unit)))])))
        • Else - Actions
          • Quest - Display to (All players) the Quest Update message: (((Name of (Owner of (Killing unit))) + has completed the quest and killed ) + (String(Count_Killed_Units[(Player number of (Owner of (Killing unit)))])))
          • Set (Quest_Pig_Hunt[(Player number of (Owner of (Killing Unit)))] = (Quest_Pig_Hunt[(Player number of (Owner of (Killing Unit)))] + 1)
This trigger gives the makes it possible for the player to complete the quest by setting (Quest_Pig_Hunt[(Player number of (Owner of (Killing Unit)))] to value 2 which tells the first trigger that you've completed the quest.
Enjoy.
 
Last edited:
Level 10
Joined
Apr 3, 2006
Messages
535
thank you for taking the time to go into so much detail redmarine. I will try this out later on it makes sense, i only have trouble sometimes finding the actually identical trigger :) Also one last question, if i set a quest to a integer when the quest is complete eg kill a boss, the boss death trigger sets the integer for the quest to 1 for example and this triggers the quest complete action. Storing quests as variable will allow me to set a quest and come back to it later on whilst others have been made and completed is this how it all works?
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
thank you for taking the time to go into so much detail redmarine. I will try this out later on it makes sense, i only have trouble sometimes finding the actually identical trigger :) Also one last question, if i set a quest to a integer when the quest is complete eg kill a boss, the boss death trigger sets the integer for the quest to 1 for example and this triggers the quest complete action. Storing quests as variable will allow me to set a quest and come back to it later on whilst others have been made and completed is this how it all works?

Yep, I'll explain it: When a unit enters the quest giver's region, if the owner of entering unit got the value of his/her Quest_Pig_Hunt = 0 the entering player gets the quest when the value changes to 1.
It works for multiplayer because an array works like this.
You can make Quest_Pig_Hunt an array for all players. In this case you should set the Quest_Pig_Hunt array to (amount of players)
Quest_Pig_Hunt Array 1 = red
Quest_Pig_Hunt Array 2 = blue
Quest_Pig_Hunt Array 3 = teal
Quest_Pig_Hunt Array 4 = purple
Quest_Pig_Hunt Array 5 = yellow
and so on...
Which means if the entering unit is player 1, then Set Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] = (Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] + 1) sets the red's Quest_Pig_Hunt to value 1.
And if it is player 2 or player 3, the value will be 1 just like player 1 because the only thing that changes is the array.
Set Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] = (Quest_Pig_Hunt[(Player number of (Owner of (Entering unit)))] + 1)
The yellow text is the variable and the green text is the array(s).
---------------------------------------------------------------------------
Event
A guy eats taco.
Condition
Action
If, then, else Condition
If
Value of taco_left = 1 or more.
Then - Actions
Eat more tacos.
Set taco_left = taco_left - 1
Else - Actions
Buy more tacos.
Set taco_left = taco_left + 5
If we don't use arrays here the variable would just have 1 value. Example if player 1 eats taco(s) then player 2 will also be able to eat taco(s) from the same taco box.(taco_left = a taco box in this case with a lot of tacos lol...) If we add array to 2 then there will be 2 taco boxes and they'll have a box each.
To fix this trigger:
Event
A guy eats taco.
Condition
Action
If, then, else Condition
If
Value of taco_left[(Player number of (Owner of (Eating Unit)))] = 1 or more.
Then - Actions
Eat more tacos.
Set taco_left[(Player number of (Owner of (Eating Unit)))] = taco_left[(Player number of (Owner of (Eating Unit)))] - 1
Else - Actions
Buy more tacos.
Set taco_left[(Player number of (Owner of (Eating Unit)))] = taco_left[(Player number of (Owner of (Eating Unit)))] + 5
Btw Eating Unit doesn't exist. ;)
---------------------------------------------------------------------------
From my experiences a lot of examples gives a lot better understanding, because sometimes people don't understand right away. If you need anymore help just ask. Btw instead of using "Quest - Display to (All players) the Quest Update message:" you can use "Game - Display to (All players) the text:" but I would prefer "Quest - Display to (All players) the Quest Update message:" because it is different and it also tells you that you are doing quests.
To be honest I haven't tested the triggers but they should work.





But if you just wanted to know how to reset the quest then just set the value of the quest and the kill variable to 0
 
Last edited:
Level 10
Joined
Apr 3, 2006
Messages
535
Hi, im still having some trouble using variables in agem, so imn going to try something a bit simpler to start with. What i would liek to do is assign a variable to some quests and have more than 1 on the go at a time. Also i would like to do the same to the special effect which creates the exclamation mark above units head, so i can have several on at once throughout a village.

So i need to create a quest viarable? and then also set it up during game.
Im not near my copy of wc3 aat the moment, but would the trigger look like this
Set=quest1, as last created quest (quest1 being the quest variable name)

So whenever i want to effect quest1, eg start it and complete it i have to keep referencing the variable quest1. Proving the variable was set in game?
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
What are you reffering to? Are you trying to use real quests or my integer quests? The quest trigger is a single player quest only but using integer quests you can make multiplayer quests.(There are probable many was on doing this) The quest mark abow quest givers is an special effect. I'll make you a map later when I get time.

Quest_Pig_Hunt isn't a quest it is an integer which in this case checks the stage of the quest like:
0 Not begun
1 begun
2 not finished
3 finished
 
Level 10
Joined
Apr 3, 2006
Messages
535
oh i see, i think i understand now, your using the if, then action, to set what each variable integar would do, then when sometrhing triggers, you set the integar, eg kill a boss, sets intgar to value 3 eg finished?
 
Level 10
Joined
Apr 3, 2006
Messages
535
sorry one last question and i think im sorted :) how do i assign a variable to a special effect, or what variable type, would it be an integar aswell. I mean as it stands every time i give a quest and the do the exclamantion mark thingy over a NPC's head, i can only destroy last created special effect, i would like to be able to destroy specific special effects, so i can have more than 1 at a time - i hope this makes sense
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
I am at school but I'll do my best:
Make an special effect variable and call it "Quest_Mark"
Create special effect (Mark??) at (unit :confused:)
Set Quest_Mark to last created special Effect

And when you are done try this:
Destroy Special Effect Question_Mark
Hope it makes sence. :)
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
and make it arrayed to not spam with 100000000 effect variables

bah I just wanted to post something
 
Status
Not open for further replies.
Top