Cokemonkey11
New Member
In mapping there is a simple, but effective way to make 1 random thing out of a group of things happen.
For example:
make a unit walk towards a random point
Create Random Game Message (Tip System)
For this tutorial We are going to make a Random Tip System.
What You Should know how to do for this tutorial:
Open the World Editor.
Open the Trigger Editor.
Create a new Trigger.
Changing Data in a Trigger.
Step One: Create a Variable
Open the trigger Editor and click the x button at the top, on the toolbar.
For this variable, we want an "intiger." name it "rndm_words" and leave array unchecked, and default value at 0.
Step Two: Tell the Game When to Show Your Message
For this tutorial, we aren't going to show a random message once, but we are going to show it periodicly. So create a new trigger called "tips."
Click the "New Event" Button at the top, on the toolbar.
The event type is "time," because we are giving it a specific time to run the trigger, rather then basing it off of something else.
The event is "Periodic Event," because it is going to happen more then once, rather then just one time.
For this tutorial, the trigger will run ever 2 minutes (120 Seconds)
Step Three: Tell the Game What to Do
[Take note, we are skipping conditions, this is because there are none]
This is where it gets a little more complicated. Pay careful attention.
Click the "New Action" button at the top, on the toolbar.
The action type is "- General," because it's not classified as any other Action type.
The action is "Set Variable" because we are going to set that variable as a random number, in this case between 1 and 2 to keep the tutorial short, but you can have 3, 4, 5, 600 if you want. (although I dont recomend it)
Right now it says "Set (Variable) = (Value)"
Click Variable, and change it to "rndm_words," the variable we made earlier.
Click Value, and change the function from "Arithmetic," to "Math - Random Number."
The Text will change to "Random number between (1) and (10)."
Click 10 and, for this tutorial, change it to 2.
Click Ok (Twice) so your back at the main trigger editor.
You should have this:
Next, we create the messages.
Click the "New Action" button again,
change the action type to "-General," and the action to "If/Then/Else, Multiple Functions," Press Ok.
If you've never used an If/Then/Else action before, it may seem odd, just remember the If is like a condition, then, like an action, and else, like a seperate action.
We need to give our If/Then/Else information for it to run, so click the "If - Conditions," go to the top, and click "New Condition."
This Condition will check to see if the randomly generated number is 1, before it decides what to write.
Leave the Condition Type as "All," and select "Intiger Comparison" for the Condition.
It should say "(Number of units in (Units in (Playable Map Area))) (equal to) (0)." Select the first link, "(Number of units in (Units in (Playable Map Area)))," and change it from "Function," to "Variable," and pick our variable, "rndm_words." Press Ok, and it should now say "(rndm_words) (equal to) (0)." Click 0, and change it to 1. Press Ok (twice) so ur at the trigger editor, once more.
You should have this:
Now we need to tell the Game what to do, now that it has recognized the intiger as 1, Select "Then - Actions," and click the new action button.
The action type should be "Game," and the action type "Text Message (Explicitly Timed)." Now it should say "Display to (All Players) for (30) seconds, the text: (text)." Select the word text, and input your first tip. For this tutorial the first tip would be "Hi there!"
Press Ok (twice) so your back to your trigger editor. Select the current If/Then/Else Trigger, and copy paste it (Cntrl+C, Cntrl+V) But, now you have 2 actions for if our variable is 1, but you have nothing for 2, so select the second one, and change "(rndm_words) (equal to) (1)" to "(rndm_words) (equal to) (2)." and change the text in the second one from "Hi There!" to, whatever your second tip is. For this tutorial, "Good Luck, Have Fun."
Now you should have this:
And thats it! your finished, later you can make more Tips by changing the "set variable" trigger.
Let me know what you think, my first warcraft 3 tutorial.
For example:
make a unit walk towards a random point
Create Random Game Message (Tip System)
For this tutorial We are going to make a Random Tip System.
What You Should know how to do for this tutorial:
Open the World Editor.
Open the Trigger Editor.
Create a new Trigger.
Changing Data in a Trigger.
Step One: Create a Variable
Open the trigger Editor and click the x button at the top, on the toolbar.

For this variable, we want an "intiger." name it "rndm_words" and leave array unchecked, and default value at 0.

Step Two: Tell the Game When to Show Your Message
For this tutorial, we aren't going to show a random message once, but we are going to show it periodicly. So create a new trigger called "tips."
Click the "New Event" Button at the top, on the toolbar.

The event type is "time," because we are giving it a specific time to run the trigger, rather then basing it off of something else.
The event is "Periodic Event," because it is going to happen more then once, rather then just one time.
For this tutorial, the trigger will run ever 2 minutes (120 Seconds)

Step Three: Tell the Game What to Do
[Take note, we are skipping conditions, this is because there are none]
This is where it gets a little more complicated. Pay careful attention.
Click the "New Action" button at the top, on the toolbar.

The action type is "- General," because it's not classified as any other Action type.
The action is "Set Variable" because we are going to set that variable as a random number, in this case between 1 and 2 to keep the tutorial short, but you can have 3, 4, 5, 600 if you want. (although I dont recomend it)
Right now it says "Set (Variable) = (Value)"
Click Variable, and change it to "rndm_words," the variable we made earlier.
Click Value, and change the function from "Arithmetic," to "Math - Random Number."
The Text will change to "Random number between (1) and (10)."
Click 10 and, for this tutorial, change it to 2.
Click Ok (Twice) so your back at the main trigger editor.
You should have this:

Next, we create the messages.
Click the "New Action" button again,

change the action type to "-General," and the action to "If/Then/Else, Multiple Functions," Press Ok.
If you've never used an If/Then/Else action before, it may seem odd, just remember the If is like a condition, then, like an action, and else, like a seperate action.
We need to give our If/Then/Else information for it to run, so click the "If - Conditions," go to the top, and click "New Condition."

This Condition will check to see if the randomly generated number is 1, before it decides what to write.
Leave the Condition Type as "All," and select "Intiger Comparison" for the Condition.
It should say "(Number of units in (Units in (Playable Map Area))) (equal to) (0)." Select the first link, "(Number of units in (Units in (Playable Map Area)))," and change it from "Function," to "Variable," and pick our variable, "rndm_words." Press Ok, and it should now say "(rndm_words) (equal to) (0)." Click 0, and change it to 1. Press Ok (twice) so ur at the trigger editor, once more.
You should have this:

Now we need to tell the Game what to do, now that it has recognized the intiger as 1, Select "Then - Actions," and click the new action button.
The action type should be "Game," and the action type "Text Message (Explicitly Timed)." Now it should say "Display to (All Players) for (30) seconds, the text: (text)." Select the word text, and input your first tip. For this tutorial the first tip would be "Hi there!"
Press Ok (twice) so your back to your trigger editor. Select the current If/Then/Else Trigger, and copy paste it (Cntrl+C, Cntrl+V) But, now you have 2 actions for if our variable is 1, but you have nothing for 2, so select the second one, and change "(rndm_words) (equal to) (1)" to "(rndm_words) (equal to) (2)." and change the text in the second one from "Hi There!" to, whatever your second tip is. For this tutorial, "Good Luck, Have Fun."
Now you should have this:

And thats it! your finished, later you can make more Tips by changing the "set variable" trigger.
Let me know what you think, my first warcraft 3 tutorial.