This is Copy and Paste
GhostWolf, here I go again.
Though I know this isn't excacly what he wants...
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 comes within 256.00 of 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)
-
Player - Add 1000 to (Owner of (Triggering unit)) Current gold
-
Player - Add 1000 to (Owner of (Triggering unit)) Current lumber
-
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
-
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.
ANOTHER COPY AND PASTE!
Further information.
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