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

(Buying) Quests Tutorial (ORPG-like)

Level 4
Joined
Apr 25, 2011
Messages
73

(Buying) Quests Tutorial (ORPG-like)


Introduction


I would recommend to read other tutorials on WE and quests before you go through this, as it is not meant for beginners, but for a little bit more experienced users.

Have you ever wanted to make a cool Quest system, like the ones in ORPGs? One with:

- Multi Player Instanceability?
- buying quests
- repeatable and non-repeatable
- level restricting quests
- updates in the Quests description based on your quest progression
- the player's name showing in F9 thingy

Well if you find yourself above then this is for you.
You will only need 5 variables for any quest-type you might have in mind. And yes, it is GUI.

Variables needed


For the quest you will need:
Note: You might consider to remember from what every variable comes from; it is kind of important and can speed up your work time. Anyway you can name them however you want, I just think that smaller name variables occupy less space (not sure, though).

Variable Name: Kills (used for both Repeatable and Non-Repeatable, so in general)
Variable Type: Integer
Variable Array?: Yes
Description: This will store the number of kills of a specified unit type.

Variable Name: PdQ ("PdQ" from "Player did Quest?"; only for Non-Repeatable)
Variable Type: Boolean
Variable Array?: Yes
Description: As the name says, it checks if a player has done a quest. It is like a "memory" variable; it remembers whether the player did a quest. This is used for unique quests.

Variable Name: PgQ ("PgQ" from "Player (has) got Quest?"; general)
Variable Type: Boolean
Variable Array?: Yes
Description: It is used to refer to a Quest that is currently going on; player is in progress of doing it; used for both types of quests.

Variable Name: Q ("Q" from "Quest") (general)
Variable Type: Quest
Variable Array?: Yes
Description: Here we'll store the quest we create so we can destroy it; we won't have to scroll down if we have a lot of quests done or in progress of doing.

Variable Name: UQ ("UQ" from "Unique Quest"; Non-Repeatable only)
Variable Type: Integer
Variable Array?: Yes
Description: Here we will "+1" for every step of a quest; it is used to track down a quest progression; more used in complex quests, not the easy killing quests.


Variable Name: P ("P" from "Player"; he's the owner of the unit triggering the event)
Variable Type: Player
Variable Array?: No
Description: We need to store the player into a variable since we are using it more than once.

Variable Name: U ("U" from "Unit")
Variable Type: Unit
Variable Array?: No
Description: This will store the "triggering" unit.

Variable Name: Pn ("Pn" from "Player number")
Variable Type: Integer
Variable Array?: No
Description: This will store the number of the player.

Variable Name: Pg ("Pg" from "Player Group")
Variable Type: Player Group
Variable Array?: No
Description: We need this variable to avoid leaks that might slow down the game. We also use a custom script to remove the variable after usage so no leaks happen.


Math will hunt you forever!


Ok... So for this to work... I have used a little trick. Some of you might know it, some of you might not. So here it is how it goes.
In order to make the quest system work properly I had to use a matrix, but since WE does not have that I had to use something different. (Formula from here)

The formula for a linear matrix, as I recall it was called, is:

(X-1)*Ymax+Y

Note: "-1" is there for you not to worry about adding a 0 in your array and avoid confusion. You just replace "X" with 1,2,3...

"X" is an integer and signifies the quest number, in my case
"Ymax" is an integer and signifies the maximum players on the map
"Y" is the current player number (the one who is doing the action)

Q[((1 - 1) x 10) + Pn]
In my map "Ymax" is 10 (because I have only 10 playable slots, so 10 players)
"X" will be 1, as this will be the first quest
and "Y" will return whatever player triggers the event
Doing the math: 0 x 10 + 4(let's say)= 4
So the Quest number will be 4 ( Q[4] ) which stands for the respective player.

If we change the "X" (quest number) to 7(let's say)
Doing the math: 7x10+4=74, so Q[74] will be holding the 7th Quest for the Player with the number "4".

Again, for efficiency's sake, we will use less operations, since WE is slow with operation. That means you will have to make the math yourself.


Very Important Note: You don't really have to carry the formula around the map. You can do the math and write it down. (Ex: For the 1st quest: (1-1)*10+Pn, the number will become 0+Pn=Pn; for 3rd quest: (3-1)*10+Pn, the number will be 20+Pn; basically you can calculate the first 2 operations so you will have "number"+"Pn".

You might think: "OMFG! I'm at the 7th quest and I have the variable gone to an array of 70-80. This is insane!" Well it is not. Because these variables will be the only ones needed for ALL of you quests.


Before triggering preparations


You might want to create you items, give them a cool description and whatever you might like. I did 2 items for the quest:

7edf.jpg


i7hr.jpg


And this is how they look in-game:
nrom.jpg


Let's Start Triggering



First, let's create a trigger which makes the player have the quest:

Note: "TQ" = Take Quest

  • TQ
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • Set U = (Buying unit)
      • Set P = (Owner of U)
      • Set Pn = (Player number of P)
      • Set Pg = (Player group(P))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Sold Item)) Equal to Harpy Scout Q
          • (U is A Hero) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PgQ[Pn] Equal to False
              • (Level of U) Less than or equal to 10
            • Then - Actions
              • Game - Display to Pg the text: |cffBCC6CCYou shoul...
              • Set PgQ[Pn] = True
              • Quest - Create a Required quest titled (Harpy Extermination ( + ((Name of P) + ))) with the description The Footman said th..., using icon path ReplaceableTextures\CommandButtons\BTNHarpy.blp
              • Set Q[Pn] = (Last created quest)
              • Item - Remove (Sold Item)
            • Else - Actions
              • Item - Remove (Sold Item)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (U is A Hero) Equal to True
          • (Item-type of (Sold Item)) Equal to Kidnapped Wife Q
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PgQ[(10 + Pn)] Equal to False
              • (Level of U) Less than or equal to 10
              • PdQ[Pn] Equal to False
            • Then - Actions
              • Game - Display to Pg the text: |cffBCC6CCThe Footm...
              • Set PgQ[(10 + Pn)] = True
              • Quest - Create a Required quest titled (Kidnapped Wife ( + ((Name of P) + ))) with the description The Footman said th..., using icon path ReplaceableTextures\CommandButtons\BTNVillagerWoman.blp
              • Set Q[(10 + Pn)] = (Last created quest)
              • Item - Remove (Sold Item)
            • Else - Actions
              • Item - Remove (Sold Item)
        • Else - Actions
      • Custom script: call DestroyForce(udg_Pg)

Explanation:


We use the event Unit - A unit Sells an item (from shop), so we don't have to deal with the problem that the item has to be in the inventory of some hero. When the item is sold from the shop, before it gets to the hero, the trigger fires. (This is more for the situation then you have a full inventory and you might get to see the Quest Item on the ground, thing that seems bugged)

It then checks what is the item. In our case is the Harpy Scout Quest. And also check if the buying unit is a Hero.

Then, in a separate If/Then/Else, it checks if the global variable PgQ is false. (Which is, since that's the default value and we didn't do anything yet)
Note: We have PgQ[Pn] Which means that this is the first quest, since (1-1)*10+Pn=0*10+Pn=0+Pn=Pn.
We also check the level.
Note: You can have quest that are for levels on your own desire. (example: from 20 and below / only level 20 / 20 and above)

Now the Actions... We display to the player some text about the quest, like a story (the "|cffBCC6CC Text |r" is used for coloring the text). You might want to consider this or not, since most people don't read inside a game... They just "play" it.

Then we set PgQ (Player (has) got Quest?) to true, because the player gets the quest now.

After we create a Quest, so it will be displayed inside the F9 thingy. This is more just like a reminder. I usually put a summary of what you need to do. And then store this Quest into a variable with the same formula as the other variables.

We remove the item on the "Then" and also on the "Else", because you will buy the item anyway, so it should get removed even if you get the quest or don't.

Part Two:
Inside the same trigger we have another If. Yes you can do this. More than that, you can do this for how many times you want, for what concerns taking a Quest.

We check if the buyer is a Hero and if the item is the item for another quest. (Wife Kidnapping Quest, in this case)

We check if PgQ is false (so the player doesn't have this quest already)
Note: PgQ[10+Pn] Equal to False || "10" is from -> (The "2" from) (2-1)*10+Pn (stands for "second quest") =1*10+Pn=10+Pn.
We also check the Hero level.

Then we check if PdQ is false (so the player didn't do this quest already)
Note: PdQ[Pn] Equal to False || It is "Pn" because the "1" from (1-1)*10+Pn stands for "the first non-repeatable (unique) quest", which is equal to 0+Pn=Pn.

And after this we just do the same as the previous one, with the difference that instead of "Pn" we use "10+Pn" because this is the second quest and we change the name, description and image of the quest.


The Killing Trigger


Note: QK = Quests Killings

  • QK
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set U = (Killing unit)
      • Set P = (Owner of U)
      • Set Pn = (Player number of P)
      • Set Pg = (Player group(P))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Dying unit)) Equal to Harpy Scout
          • PgQ[Pn] Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Kills[Pn] Less than 2
            • Then - Actions
              • Set Kills[Pn] = (Kills[Pn] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Kills[Pn] Equal to 1
                • Then - Actions
                  • Quest - Display to Pg the Quest Update message: (|cffEDDA74You have killed + ((String(Kills[Pn])) + Harpy Scout.|r))
                • Else - Actions
                  • Quest - Display to Pg the Quest Update message: (|cffEDDA74You have killed + ((String(Kills[Pn])) + Harpy Scouts.|r))
            • Else - Actions
              • Quest - Mark Q[Pn] as Completed
              • Game - Display to (Player group(P)) the text: |cffEDDA74You have ...
        • Else - Actions
      • Custom script: call DestroyForce(udg_Pg)

Explanation:


The event is really general so we can have more killings in the same trigger (you can actually have all you killings count in this trigger)

We check what type of unit is the unit dying and we check if the "killer" has the quest.

We check if the "kills" are less than 2 and then, if they really are, we +1 the kills.

The next "If" is... for aesthetics. It checks if it is the first creep (Harpy Scout) and says it to the player (You have killed 1 Harpy Scout)
If not, it just says (You have killed (value of Kills[Pn]) Harpy Scouts)
Note: Yes, you can say that this is kind of useless, but since you want to make a good job, do it properly, not only half good.

Leaving the "If", we get into the "Else". If the number is not less than 2 then it will mark the Quest completed and show a message that you should return to get your reward.


Find the missing person


QKW = Quest Kidnapped Wife

  • QKW
    • Events
      • Unit - A unit comes within 200.00 of High Elf (Female) 0029 <gen>
    • Conditions
    • Actions
      • Set U = (Triggering unit)
      • Set P = (Owner of U)
      • Set Pn = (Player number of P)
      • Set Pg = (Player group(P))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (U is A Hero) Equal to True
          • PgQ[(10 + Pn)] Equal to True
          • UQ[Pn] Equal to 0
        • Then - Actions
          • Quest - Display to Pg the Quest Update message: |cffBCC6CCHello, yo...
          • Set UQ[Pn] = 1
          • Quest - Change the description of Q[(10 + Pn)] to Return to the Footm...
          • Quest - Mark Q[(10 + Pn)] as Completed
        • Else - Actions
      • Custom script: call DestroyForce(udg_Pg)

Explanation:


When you are close to the unit (200 is "close" for me; since it need to find the person, it kind of means to get near it) and you have the quest, the unit is a Hero and UQ=0 ("0" meaning that you just started the quest), it shows the player a little dialog, sets UQ equal to 1 (meaning the next step), changes the description from F9 thingy and marks the quest completed.

Note: This method can be used for a talk face-to-face (message delivery) trigger.
John sends you to Bob to give him an invitation for his event (here you can chose the Hero to carry and item ("Invitation") or just go and invite him (no item needed); depending on the method you chose some more triggering is required). Then you need to go back from Bob to John and tell John that Bob will come. Next, John sends you to say what Bob should wear and so on.

This can be done very easy with and If/Then/Else. Long-story-short:
Hero near John: UQ=0 (initialization of the quest)
Hero near Bob: If he just started the quest (UQ=0) and he invited him, Then set UQ=1 (Bob says "yes")
Hero near John: If Bob said "yes" to the invitation (UQ=1), Then set UQ=2 (John got the message)
Hero near Bob: If John got the "yes" message (UQ=2), he wants to tell Bob how to get dressed, Then set UQ=3 (Bob got John's message about the dressing) etc.

For this you will need 2 triggers: one for John and one for Bob. There is no (reachable) limit to how many times you can make your Hero go from one NPC to another, but it might get boring if it is done too many times.


The Rewards



QR = Quest Rewards
  • QR
    • Events
      • Unit - A unit comes within 200.00 of Fruit Stand 0031 <gen>
    • Conditions
    • Actions
      • Set U = (Triggering unit)
      • Set P = (Owner of U)
      • Set Pn = (Player number of P)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (U is A Hero) Equal to True
          • PgQ[Pn] Equal to True
          • Kills[Pn] Equal to 2
        • Then - Actions
          • Hero - Add 1000 experience to U, Show level-up graphics
          • Player - Set P Current gold to ((P Current gold) + 100)
          • Quest - Destroy Q[Pn]
          • Set PgQ[Pn] = False
          • Set Kills[Pn] = 0
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (U is A Hero) Equal to True
          • PgQ[(10 + Pn)] Equal to True
          • UQ[Pn] Equal to 1
          • PdQ[Pn] Equal to False
        • Then - Actions
          • Hero - Add 1500 experience to U, Show level-up graphics
          • Player - Set P Current gold to ((P Current gold) + 100)
          • Quest - Destroy Q[(10 + Pn)]
          • Set PgQ[(10 + Pn)] = False
          • Set PdQ[Pn] = True
          • Set UQ[Pn] = 0
        • Else - Actions
Note: Yes, unfortunately you need another trigger for rewards (you can't merge this one with the first one). More unfortunately is that you need different triggers for different unit giving rewards.

The event is clear, I hope.

The normal hero check condition, variable checks: PgQ (Pn) to see if he has the quest and Kills (Pn) to check if it killed all the units.

Note: Yes, the quest is asking to kill 3 x Harpy.
Here's the short explanation: You kill one Harpy (Kills[Pn]=1), two Harpies (Kills[Pn]=2) and when you kill the third one (no, it is not Kills[Pn]=3), in the If, 2<2 is False, so it will go through the Else branch and say that you have completed the quest. It is true because you have just killed the third Harpy, it just doesn't make the variable Kills[Pn] equal to 3.


Then we give experience and gold to the player, destroy the quest set the variables PgQ to false ('cuz the player does not have the quest, he just finished it!; so he can take it again) and Kills to 0 so he can restart the quest.

The other "If" is just like the other with the difference that it checks the value of UQ (what step it is currently on; current step, in our case is 1, which is also the final step) and we check if PdQ is false (so the player didn't do the quest already).

Actions: Give the rewards, destroy the quest (for a clean look), set PgQ to false (the player hasn't got the quest anymore, he just finished it), set PdQ to true (because he just finished it, so he DID it!) and set UQ to 0 (idk why I did this, but I think it's better for a variable to hold the 0 / null value).


Note: Please make sure that, when you change and item's description, you won't forget to change the trigger. (Don't forget to modify the experience / gold or if you make a quest repeatable or not, when you change the item's description. It will only say that it gives yyyyy Gold or Exp, but it will give the amount set inside the trigger)

Note2: You might consider noting down the values of your variables. (I'm referring to the "1", "2" (which morphs into "Pn" and "10+Pn) that are used in this tutorial) I noted them in the Trigger Description (like the picture) The numbers are just orientative. They are just an example of how it should look to help you.
u378.jpg


I know that this might have been already posted (or something like this)... But you feel better when you do something for the world to be a better place.


I'm waiting for criticism, reactions etc.
It's my first tutorial so... Just tell me what I did wrong and I will re-do it.

Anyway, all that has been discussed here are in the map attached. You can try it and see if it pleases you. If you need any other information, other kind of quests, just leave a reply and I will see what I can do about it.

Credits go to: deathismyfriend for efficiency and readability suggestion, using more variables and avoiding leaks.


Version 1.1 Added Player, Unit and Integer variables
Version 1.2 Added Player Group variable, so it won't leak
Version 1.3 Updated and Improved, for efficiency
Version 1.4 Removed an useless and possibly bugged DestroyForce
 

Attachments

  • Harpy.JPG
    Harpy.JPG
    108.4 KB · Views: 488
  • Variable Remember Comment.JPG
    Variable Remember Comment.JPG
    59.5 KB · Views: 450
  • Wife.JPG
    Wife.JPG
    110.4 KB · Views: 379
  • Quest Description.jpg
    Quest Description.jpg
    8 KB · Views: 438
  • Quests Tutorial v1.4.w3x
    14.3 KB · Views: 447
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
this tutorial seems to be a little overkill. Firstly you explain things a little too deep. I mean if they dont understand such a simple use of GUI they should go read some beginner tutorial.

You also use a bad system for doing this. (in my opinion)

the indexing is extremely ulgy to start with and you dont even need it.

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set main_quest[1] = True
      • Set quest_desp[1] = Save the village and become an hero!
      • Set quest_name[1] = Village Saviour
      • Set quest_icon[1] = ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Set quest_item[1] = Mask of Death
      • -------- ----------------- --------
      • Set main_quest[2] = False
      • Set quest_desp[2] = Collect some wood for Lumberjack Harry
      • Set quest_name[2] = We need wood
      • Set quest_icon[2] = ReplaceableTextures\CommandButtons\BTNPriest.blp
      • Set quest_item[2] = Demonic Figurine
      • -------- ----------------- --------
      • Set max_index = 2
      • -------- and so on --------
  • buy the shit
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • For each (Integer A) from 1 to max_index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Sold Item)) Equal to quest_item[(Integer A)]
            • Then - Actions
              • Item - Remove (Sold Item)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • main_quest[(Integer A)] Equal to True
                • Then - Actions
                  • Quest - Create a Required quest titled quest_name[(Integer A)] with the description quest_desp[(Integer A)], using icon path quest_icon[(Integer A)]
                • Else - Actions
                  • Quest - Create a Optional quest titled quest_name[(Integer A)] with the description quest_desp[(Integer A)], using icon path quest_icon[(Integer A)]
            • Else - Actions


that is a much cleaner solution.

I wont show how to turn it in because its really simple and you can do it in so many ways I dont know how everyone wants it.
 
Level 4
Joined
Apr 25, 2011
Messages
73
this tutorial seems to be a little overkill. Firstly you explain things a little too deep. I mean if they dont understand such a simple use of GUI they should go read some beginner tutorial.

You also use a bad system for doing this. (in my opinion)

the indexing is extremely ulgy to start with and you dont even need it.

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set main_quest[1] = True
      • Set quest_desp[1] = Save the village and become an hero!
      • Set quest_name[1] = Village Saviour
      • Set quest_icon[1] = ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Set quest_item[1] = Mask of Death
      • -------- ----------------- --------
      • Set main_quest[2] = False
      • Set quest_desp[2] = Collect some wood for Lumberjack Harry
      • Set quest_name[2] = We need wood
      • Set quest_icon[2] = ReplaceableTextures\CommandButtons\BTNPriest.blp
      • Set quest_item[2] = Demonic Figurine
      • -------- ----------------- --------
      • Set max_index = 2
      • -------- and so on --------
  • buy the shit
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • For each (Integer A) from 1 to max_index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Sold Item)) Equal to quest_item[(Integer A)]
            • Then - Actions
              • Item - Remove (Sold Item)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • main_quest[(Integer A)] Equal to True
                • Then - Actions
                  • Quest - Create a Required quest titled quest_name[(Integer A)] with the description quest_desp[(Integer A)], using icon path quest_icon[(Integer A)]
                • Else - Actions
                  • Quest - Create a Optional quest titled quest_name[(Integer A)] with the description quest_desp[(Integer A)], using icon path quest_icon[(Integer A)]
            • Else - Actions


that is a much cleaner solution.

I wont show how to turn it in because its really simple and you can do it in so many ways I dont know how everyone wants it.


I recommended at the beginning of the tutorial to have a look on a basic GUI tutorial...
I am using less variables than you do... It doesn't matter... It isn't that complicated when you copy-paste it... you just change the first number... And I said that for a better way of remembering what number you are on you can use the comment thingy on a trigger.

I can see why you Trigger is more simpler... but it was not intended to be a shortcut. It was intended for people to understand the concept of a Quest System with MPI. I think I explained it logically. How you said "too deep", was intended so they can get what I was thinking when I did it. (so they can "be inside my head")
 
Your triggers are very inefficient. If you have a tutorial you should show people the most efficient way to do something.
Example: player number of owner of triggering unit should be stored in a variable.
Anything used twice or more should be stored in a variable and the variable should be used. This is for efficiency and readability.

You should listen to chaosy ( except never use integer A/B they are slower and less efficient. And they can cause bugs)

less variables does not mean better. More efficient ways is with more variables (if done correctly)

You should take a look at my tutorial things a guier should know.
 
Level 4
Joined
Apr 25, 2011
Messages
73
deathismyfriend said:
Your triggers are very inefficient.
This is like:
crazy-monkey-emoticon-135.gif

Where is the constructive criticism? Thank God, I had the power to keep on reading, otherwise I would have killed myself. (Just kidding)

I did what you said, but I didn't made any variables for the Player Group which will need a custom script to be removed. Should I also use that variable since it is only 2 times used?

Don't need your tutorial! >:p I am using more variables and I know it's better to use variables when something is used more than just one time. It's just I'm not used to doing this in GUI. I'm using it more in JASS.

Oh, and yea, I credited you in the tutorial for this.

Also, I tried to make the tutorial more readable. Yes, I updated the map too.
 
Level 4
Joined
Apr 25, 2011
Messages
73
Done. I hope it works just like before, I hadn't time to test it out. I just modified the code. I did what was suggested... Anything else?

When is it going (or better said "how much is it going to take") to be reviewed by someone who can approve it?
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
0 * x is allways 1 if I remember right
You do stuff like 2-1 too. pointless

edit: did you really test this propperly?

because your index seems to be
(1-1) * 10 + X
0 * 10 + X
1 + X
this makes no sense at all

or

(1-1) * 10 + X
0 * 10 + X
0 + X

edit: or maybe it was X^0 or something that allways was 1, I dont remember
 
Last edited:
Level 4
Joined
Apr 25, 2011
Messages
73
0*X is always 0. Yes X^0 is always 1.

It works properly (if I did all the variables replacement right) with the (1-x)*10 +y

The 0+x is made so you can copy-paste it and modify it faster. Modify the "1" from ("1"-1)*10+Y to the number of the quest. (this depends on the variable's name)
 
Level 4
Joined
Apr 25, 2011
Messages
73
It stil the same... It has 3 operations... Why is it different from my version? Cuz it uses variables instead of integers?

It might not be sure to associate Ymax with max quests... Since you might not know that number when you start a map...

Ex: Number Quests = 3; Player number = 5
Number of Quest= 1 => tempInt2= (5-1)*3+1 => tempInt2= 13
Number of Quest= 2 => tempInt2= (5-1)*3+2 => tempInt2= 14

It works, I'll give you that. It still doesn't change the fact that it is kind of the same as what I did... It uses the same math that I did, but with some other variables... And as I mentioned, you might not know the maximum number of quests from a map...
 
The point is mine is used when you have to get the player number.
Otherwise you should calculate it out yourself rather than letting WC3 handle the math.

If you know the quest for that player you should use the 13 for quest one for player 5 rather than the math operations.

My method is generally used when the quest activation is in one trigger for all players.

questBooleans is a boolean array that tells if that quest is active for that player.
  • Example Trigger
    • Events
      • Player 1 Enters region
      • Player 2 Enters region
      • Player 3 Enters region
      • Player 4 Enters region
      • Player 5 Enters region
      • Player 6 Enters region
      • Player 7 Enters region
      • Player 8 Enters region
      • Player 9 Enters region
      • Player 10 Enters region
      • Player 11 Enters region
      • Player 12 Enters region
    • Conditions
      • unit has item of type example item
    • Actions
      • ----- Comment = quest 1 -----
      • Set tempPlayer = (triggering player)
      • Set tempPlayerGroup = (Player group(tempPlayer))
      • Set tempInt1 = 1
      • Set tempInt2 = (((player number of tempPlayer) - 1) * tempInt1)
      • Set questBooleans[tempInt2] = true
      • Game - Display to tempPlayerGroup the text: You need to kill 20 peons.
NUM_OF_QUESTS is the max number of quests.
  • Unit Dies Event
    • Event
      • A unit dies
    • Conditions
      • triggering unit equal to unit of type peon
    • Actions
      • Set tempInt1 = player number of (owner of killing unit)
      • Set tempInt2 = load quest number from hashtable or by inserting here
      • Set tempInt3 = (((tempInt1-1)*NUM_OF_QUESTS) + tempInt2
      • if
        • questBooleans[tempInt3] equal to true
      • then
        • increase killed number of units for that player
        • check if player has finished that quest by killing all units.
        • if it did then end quest and reward player.
      • else
In my example triggers above you only need 2 triggers for all 12 players. rather than separate triggers for each player for each quest.
 
Level 4
Joined
Apr 25, 2011
Messages
73
deathismyfriend said:
In my example triggers above you only need 2 triggers for all 12 players. rather than separate triggers for each player for each quest.

Are you serious?! What part of my tutorial is: "A trigger for a player"? There is a trigger for every type of quest (plus one for a reward and one for getting the quests). The only trigger that is only for a quest is "Find the Missing Person". And that is in order for a quest to go smoothly.

You just have the same thing as I do; the only different thing is that you set the "(1-1)*Ymax+PlayerNumber" to a variable...

Are you sure you read the whole tutorial (you know I have updated it with your suggestions about the variable usage). The first trigger you have is equal to my TQ (well... instead of entering a region, you have to buy some item) and your second trigger is the same as QK (the difference is that I don't give the reward to the player on the spot; I just think it's more logical to get back to the person who gave you the mission to get your reward rather than the reward "falling from the sky").
 
My triggers were an example of a different type of trigger. I was not going off of your triggers.

My point is in my trigger you don't know which quest is loading that is why the math operations are needed.
In the buying trigger of yours you should figure this out since you have quest one = ((1 - 1) x 10) + pn
Instead replace it like this.
pn
You do not need the ((1 - 1) x 10).

Also the way you get the rewards does not matter in the examples.
 
Level 4
Joined
Apr 25, 2011
Messages
73
So what you are basically saying is that I should store (1-1)*10+Pn into a variable?

Edit: For the first quest... well I used (1-1)*10+Pn so you can easily copy-paste the ITE and like so you'll make easier new quest. But I guess I can get the formula into a variable. It might prove more useful and easier... But it will need another variable...
 
So what you are basically saying is that I should store (1-1)*10+Pn into a variable?

Edit: For the first quest... well I used (1-1)*10+Pn so you can easily copy-paste the ITE and like so you'll make easier new quest. But I guess I can get the formula into a variable. It might prove more useful and easier... But it will need another variable...

What im saying is simply calculate it by yourself since it never changes.

Example quest 1 should be just Pn
quest 2 should just be 1+Pn
and so on.
 
Level 4
Joined
Apr 25, 2011
Messages
73
It will become 1-12, 13-24, 25-36 etc. Well, this is just more complicated... I thought of letting it be simple with 10 max player. You can better see the variable's going: 1-10, 11-20, 21-30 etc.

So anything else besides that I should make it more simpler (I mean stop using the formula and start calculating the result coming from it)?
 
Level 4
Joined
Apr 25, 2011
Messages
73
Well, as all people do, if I have something to work, I need to be told what to work and I will do it.

If it is complete / ready then it should be moved. If it is not complete, than someone has to tell me what I have to do for it to become approved and it can be moved to trash, I don't mind, but I need feedback with it...
 
Awesome. This looks approvable to me.

Just one issue. In the trigger "TQ", you destroy the force "Pg" in between the if statements. That means that in the kidnapped wife if-then-else, the text won't display to Pg (it'll try to display it to a destroyed force). And you destroy it again at the end.

Just keep the DestroyForce() at the end. Remove the one in-between. Other than that, I think it should be approvable.

P.S. I apologize for the long wait.
 
Level 2
Joined
Nov 11, 2013
Messages
19
Thanks man! I Found this at the exact time. I'm new to this community so I will a neeed lot of informations. Can you please tell me why my imported model didn't show up? just shadow? if it not bothers you Tnks.
 
Level 8
Joined
Apr 8, 2009
Messages
499
I think there's a miscalculation in the "The Killing Trigger" and "The Reward Trigger".

At the if/then/else section, where the condition is "Kills[Pn] Less than 2".
And at the "The Reward Trigger" the check once again checks if you have 2 kills...

You can just complete the quest with 2 kills instead of the required 3 kills :)

Change condition in the reward trigger to "Kills[Pn] greater than or equal to 3"
And +1 the Kills[Pn] int in the bottom section of the "The killing trigger".

PS: Sorry for necroposting :sad:
 
Last edited:
Top