| 05-30-2004, 02:46 AM | #1 |
I don't understand on how to do variabels, can someone explain it to me? |
| 05-30-2004, 03:00 AM | #2 |
A variable is a title, a name that you set anything to. Its for storing data of a specific type to it so it can be used later. You have to set a variable in a trigger to something like a Unit. Then whenever in any trigger you want to do something with that particular unit you set the variable to, you select the variable for the action. Its kinda hard to explain with words, just try and experiment. |
| 05-30-2004, 04:00 AM | #3 |
A variable is an object that represents something else. It is dynamic; i.e. it can change. There are different tyes of variable that represent different things. A unit variable can represent a unit, while a unit-type variable can represent a unit type. Variables are most useful when you want to issue an order or do something to a unit that was created through triggers. When you create a unit, you can set it to a unit variable and then use that variable any time in the game to effect that unit. Also, variable can be overwritten and replaced. If you had a variable set to Footman 0001 and then used the set variable function to set the same variable to another unit, the variable would no longer be equal to Footman 0001. A variable can not be equal to more then one thing at a time. If you need more then one variable with the same name, you use an array. An array is a like a big storage box with smaller boxed contained therein. In each of the smaller boxes is a held a variable, but all are stored under the same name. This way you can set Variable[1] equal to Footman 0001 and then set Variable[2] equal to the other unit. The number after the variable name is what seperates one variable from the next. If you have a more specific question about variables, feel free to ask me. |
| 05-30-2004, 03:55 PM | #4 |
Can you tell what to put in the rest? Trigger 1: Event: Unit enters region. Condition: (Unit type of (triggering unit)) equal to footman Action: Trigger - Turn on Trigger 2 Trigger 2: Event: Time - Every 15.00 seconds of the game Action: No idea what to put here. |
| 05-30-2004, 04:59 PM | #5 |
What do want to happen? |
| 06-03-2004, 04:22 PM | #6 | |
Quote:
A footman is created in a region, then the footman goes to another region, then the footman attack moves to a random point within a region every 20 seconds. |
| 06-03-2004, 04:52 PM | #7 |
This is a way to do it... Trigger 1: Event: Unit enters region. Condition: (Unit type of (triggering unit)) equal to footman Action: Trigger - Turn on Trigger 2 unit group - add triggering unit to UnitGroupVariableForFooties Trigger 2: Event every 20 seconds of game time Condition Action unit group - pick every unit in (UnitGroupVariableForFutis) and do actions loop -actions unit - order (picked unit) to (attack-move) to (random point in (your region)) |
| 06-05-2004, 04:25 PM | #8 |
Thank you!i!i!i |
| 06-06-2004, 08:03 AM | #9 |
TRIGGERS ARE MY HERO! They make so many triggers so much less complex when you have just 9 solid lines full of text, and instead you can use one simpe variable, easy to read and reduces lag in game and loading!!!!!!! ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ ^_^ |
| 06-06-2004, 09:27 AM | #10 |
Note that I tried to keep the trigger as simple as possible, so it now causes noticable memory leaks (the "random point in region" leaks a point object handle). If you get the trigger working OK, you can try removing the leak then, all you need is another point variable. Look into the tutorial made by Cubasis about this (it is currently the tutorial of the week, the link is at the main page) to learn how to remove the leak. |
