You must be logged in to post messages.
Please login or register

Scenario Design
Moderated by Yeebaagooon, nottud

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: Quest Var Guide
posted 13 January 2006 08:28 PM EDT (US)   
Contributors: Dr. Nick, Auron, Lp, Papaya


What is a variable?
The technical definition of a variable is a place in memory used to store a value that is unknown at the time of creation.
At this point, that probably doesn't make much sense to you (and if it does, you really don't need to read the rest of this guide). That's okay; I just needed to get that out of the way so I can start explaining it to you.
So what does it mean? Well, when you create a scenario, there are things you may not know, or that can change, depending on the player. Still confused? An example is probably in order:
Say in your scenario you want to create a shopping list (never ask why!). The list has four different items: a rug, a house, a fish and a donkey. These items can be bought in any order. This is entirely possible (I've done it). How would you keep track of which items the player has and which still need to be bought? This is where variables come into play.
You can actually create a variable that stores this information so that you don't need to know it when you make the scenario. Instead, you simply refer to it by its name.
Okay, now I will break away from the example to explain another aspect of variables. This is actually very logical if you think about it: If you don't know what this mystery value is when you create this scenario, how in Hades' name can you use it? The answer is very simple: Names. Every Quest Var that you create will have a name. Remember it, because without it, you're screwed. A name can be anything, really. I like to use descriptive names because they allow me to remember what variable is for what.
So in our example, there will be four Quest Vars: one for the rug, one for the house, one for the donkey and one for the fish. Lets make some names: Has_Rug, Has_House, Has_Donkey and Has_Fish are the ones I will use.
Okay now what? you may ask yourself at this point. Well remember, a variable is just a value. We can use it to keep track of things. Let’s say, if the player has the item, its variable value will be 1 and if they don't, the value will be 0. These are really arbitrary, but I use 0=FALSE 1=TRUE because its sort of a programming thing (I could have used 121.5=TRUE and anything else=FALSE or some other nonsense but lets face it, that's just asking for typos).
So: So far we have a good definition of a Quest Variable in plain English: Any value that you don't know when you create the scenario or that can change when the scenario is played. It has two parts (in AOM:TT) A name and a value.

Types
There are many types of data that your computer can store. It can store "strings" which are strings of characters (anything you can type is a character), there are integers (i.e. 1, 2, 3, 4, 5, etc), there are boolean values (Big word...just means true or false only), and many, many more.

But you, as a scenario designer for AoM, don't have to even think about it. Its all handled because the only type of information your Quest Variables are allowed to hold are called Float. That's short for Floating Point decimals. For those of you who are mathematically challenged, a floating point decimal is any number with a decimal point in it. You know, this guy: "." As in 32.33, 1234.70, etc. In fact, any value you give it will automatically be given many decimal places: 1 becomes 1.000000 (or so), etc.

So the main thing to get from this chapter is: If you want to go on to do other types of programming, there are many different types of variables. If you're going to stick with scenario designing, only worry about the decimal point numbers.

Quest Var Set
This is pretty self explanatory. This is where you can directly set the value of your variable (or create it with a default value).
Parameters: Var Name; This is where you enter the unique name of your variable. Value; This is where you enter the value you want to give your variable.
Example: For the example in Chapter 1. When the player buys the rug, you can create a trigger with the effect: Quest Var Set. Var Name = Has_Rug. Value = 1. This will set the variable named Has_Rug to the value 1.

Quest Var Modify
This allows you to change the value of your variable by using an operator. This may seem confusing at first, but its not that difficult.
Parameters: Var Name; The name of the variable whose value you want to modify. Operator; This is the way you want to change your variable. Its a mathematical operator. Value: This is the amount you want to change by. The formula would be: Var Name = Var Name Operator Value.
Example: I haven't given an example of this yet, but here's a simple one. Say you want to create an RPG where killing a Jarl gives you 500 experience points. You can keep track of how much experience a player has by using a Quest Variable (let's name it Experience). you can set up a condition so that the trigger fires whenever the player kills a Jarl. Then the effect would be: Quest Var Modify. Var Name = Experience. Operator = +. Value = 500. So the formula would be Experience = Experience + 500. No matter what Experience is already, this effect will add 500 to it. You can also use - (subtract), * (multiply), /(divide), and probably % (modulus, though I've never tried it) as operators.

Quest Var Modify2
This trigger is exactly the same as Quest Var Modify, except instead of using a value for the third parameter, you use another Quest Variable. That way you don't need to know how much to change the first Quest Variable when you create the scenario. The formula this creates is: Var Name = Var Name Operator Var Name2. So for the example from Quest Var Modify: Experience = Experience + Jarl_Experience. That way, Jarls don't have to always give 500 experience, they could give a variable amount that you determine.

Quest Var Randomize
Quest var randomize does not randomize objects as a random map script. A random map script can randomize all objects in whatever place possible(depending on the .xs document of course), Unlike a quest var randomize effect which needs a quest var check to define the location where the object(s) has to be randomize. The first thing you have to know is that In order to randomize an object successfully, you must create the main trigger called "Quest Var Randomize". Quest Var Randomize is an effect which randomizes values. All variables(Ex: Min=1 Max=5) defined are valid values and can be randomize. This can pretty much be use with any quest var. Example:

 Trigger_Main: Active
Effect: Quest Var randomized(name: Main)<select min value and max value>
Condition: Always

You must always be careful in naming your quest var randomize effect. Think of a short, simple name. Remember that you have to re-type this same name in the other triggers containing the quest var check condition or other. Depending on the minimum value and maximum value, a certain amount of objects will randomize. So, for example, if I want to randomize 3 settlements, I would have to put Min Value=1, and Max Value=3. Example:

Trigger_Main: Active
Effect: Quest var randomized<minimum value 1><maximum value 3>(Name: Main)
Condition: Always

Trigger_1:
Effect: Change unit type<cinematic block into settlement>
Condition: Quest Var check<Value 1>(Name: Main)

Trigger_2:
Effect: Change unit type<cinematic block into settlement>
Condition: Quest Var check<Value 2>(Name: Main)

Trigger_3:
Effect: Change unit type<cinematic block into settlement>
Condition: Quest Var check<Value 3>(Name: Main)

In the Example illustrated above, the Main trigger(quest var randomize) has three choices, and will only choose one of the 3 other trigger. Each trigger that has "condition Quest Var Check" which represents a value in the Quest Var randomize effect because of the number written in the Quest Var check Value Box. The reason why I typed "Main" in the name box, is because "Main" is the name of the "Quest Var Randomize" effect that will decide which value to randomize.

The reason why you are using Quest Var Check as a condition is because this condition will fire the desired Value you typed. Its similar to a Fire Event effect; however, instead of activating a trigger, it gets activated by the quest var randomize and causes the value to take effect. Remember that you must type the desired amount of values in the Quest Var Randomize effect. If you type a value in a quest var check condition that is not defined in the quest var randomize, nothing will happen because the value is not registered. Keep in mind that this condition can be used and set with the Quest Var Set, Quest Var Modify, and trigger effects as well.

Be careful when typing a value number for each quest var check. As you can see, each trigger above has different numbers in the quest var check box. If you put the same number in two different quest var check box, then the quest var randomize effect will choose one of the two triggers to randomize, and the other one will be deactivated. You can also add an extra value so that the main trigger has the possibility of not randomizing any of the other values written in the quest var check. Variables:

Greater Than or Equal to(=> ): You would use this variable to check the same value and other greater values

Less Than or Equal to(<=): You would use this variable to check the same value and other less values

Greater Than(> ): You would use this to check ONLY greater values than the typed value

Less Than(< ): You would use this to check ONLY less values than the typed value

Equal to(==): You would want to use this value if you want to check one value. but you can just use the equal variable if you only want one trigger to randomize

If you couldn’t manage to work this trigger out, do not worry. It takes some time to understand and it is for sure you wont get it right away(depending on your experience with the editor). Make sure the values are set correctly, as well as the variables. Always make sure the trigger itself is not accidentally looped, activated or run immediately by mistake.

Example: Okay, say the player must win at a game of "Paper, Rock, Scissors" against the computer in order to win a donkey (instead of buying it for his list...duh!). The player chooses one of the three options and then the computer can randomly chose one of the three options using the following effect: Quest Var Randomize. Var Name = Comp_Answer. Min Value = 1. Max Value = 3. Rounding = On (TRUE). The value will be either 1 (paper), 2 (rock) or 3(scissors). This is just one example, the possibilities are endless!

Conditions using Quest Variables
There are only two conditions that I will go over for Quest Variables. These are really where Variables show their usefulness. First a small explanation of some minor programming type stuff:
IF...THEN. Okay, short logic lesson. As you may (or may not) know, all conditions are similar to the English IF...THEN. In other words, the Unit In Area condition is
really saying IF there is a unit in the area, THEN do the effects. Quest Var conditions are no different. In fact, you can really see the correlation better.

Quest Var Check
Okay, so you want to know IF the person bought the rug. Quest Var Check is the condition for you. Remember that IF the variable Has_Rug = 1, THEN they have the rug. IF the variable Has_Rug = 0, THEN they don't. This can be almost directly translated to the Quest Var Check condition like this: Condition: Quest Var Check. Var Name = Has_Rug, Operator = ==, Value = 1. Unless you want to know more about other kinds of programming, just accept that == means "is equal to" as in: IF Has_Rug is equal to 1. There are also several other operators that you can experiment with. So the opposite would be IF Has_Rug == 0, or Or you can even just check the "Not" box as in IF Has_Rug NOT == 1 THEN. It may not be good English, but I'm sure you get the idea.

Quest Var Compare
This is the same as Quest Var Check except instead of comparing one quest var and one value, you're comparing two quest variables. The formula looks like this: IF Var Name1Operator Var Name2 THEN... So in our Paper, Rock, Scissors example, We want to know if its a tie (Both the player and the computer picked the same answer). So it would look like this: IF Player_Answer is equal to Computer_Answer THEN its a tie. So lets put the pieces into their correct Parameters: Var Name1 = Player_Answer, Operator = ==, Var Name2 = Computer_Answer. THEN (its a tie so do the necessary effects for a tie).
One more note about conditions: Remember, you can use multiple conditions with "AND" or with "OR" to get the desired results. Experiment around with it.

Conclusion
If you understand Quest Variables, then the possibilities are vast. You can have anything from inventory systems, to mini-games (like the paper-rock-scissors), to completely random environments.


oh you can wait for what I can give
you know what I am so you know how I live
try to look proud but you’re not in the slightest
its happening now and it’s always been like this.

[This message has been edited by Papaya (edited 02-25-2006 @ 11:42 AM).]

Replies:
posted 14 January 2006 00:25 AM EDT (US)     1 / 11  
Very nice!
posted 14 January 2006 00:55 AM EDT (US)     2 / 11  
Nice closing.
posted 14 January 2006 02:52 AM EDT (US)     3 / 11  
Finaly a qv guide that explains them all!

MEPH
[Insert amazingly witty signature here.]

Me and Yeebaagooon's scenarios | Download The Corruptor
posted 14 January 2006 07:33 AM EDT (US)     4 / 11  
Fantastic guide. It was especially the explanation of "what it actually is" that's missing in most guides. Great job.
posted 14 January 2006 07:33 AM EDT (US)     5 / 11  
Great guide!



Sweet baby maizes!
posted 14 January 2006 02:22 PM EDT (US)     6 / 11  
Well Done Papaya, well done!

I didn't learn much from it, just what Quest Var Modify 2 does. This will help many newbies how to utilize the most powerful effects and conditions in the game.


Cavuy | Writer, Graphic & Web Designer
ex-Modder and Scenario Designer | Legacy
Member since May 5th, 2003
posted 15 January 2006 12:43 PM EDT (US)     7 / 11  
Thanks guys, glad you liked it.

oh you can wait for what I can give
you know what I am so you know how I live
try to look proud but you’re not in the slightest
its happening now and it’s always been like this.
posted 15 January 2006 04:56 PM EDT (US)     8 / 11  
quest var modify 2 is like the other one except that the amount you add or minus can change during a game. e.g.

trigger 1 (loop)
conditions: every 30 seconds
quest var modify - modify QV1 by + 1

Trigger 2 (loop)
conditions: every 30 seconds
quest var modify 2 - modify QV2 by adding QV1

Trigger 3 (loop)
conditions: QV2 is > 1
effects: (1) modify protounit - anubite speed + 1
(2) quest var modify - modify QV2 by - 1

This should make your anubite increase in speed every 30 seonds by a larger amount each time. Thats sounds complex but once you know it, it makes logical sense.

Other uses using a trigger like that:
a shop reward increases in price every time you buy it
a an attack uppergrade increases your attack by a larger amount each time. This is just one way that uses quest var modify 2. There are plenty of others so experiment!

Hopefuly this has help teach you how to use quest var modify 2.


The boy with the mad imagination
Prepare for the ultimate duel!
Learn to use all my triggers and what you can do with them. Visit here.
Find out and download the transform trigger here.
Play some minigames I have created outside AOM including some 3D games here.
posted 15 January 2006 05:56 PM EDT (US)     9 / 11  

Quote:

Finaly a qv guide that explains them all!

It's been in Papaya's sig forever

posted 15 January 2006 07:00 PM EDT (US)     10 / 11  
Ha, I forgot about that. But that links to a very old one, IMO, not very good.

oh you can wait for what I can give
you know what I am so you know how I live
try to look proud but you’re not in the slightest
its happening now and it’s always been like this.
posted 15 January 2006 08:24 PM EDT (US)     11 / 11  

Quote:

But you, as a scenario designer for AoE3



3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679 8214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196 4428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273 7245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094 3305727036575959195309218611738193261179310511854807446237996274956735189 Mmm, pie.
Age of Mythology Heaven » Forums » Scenario Design » Quest Var Guide
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Age of Mythology Heaven | HeavenGames