| 11-02-2003, 11:02 PM | #1 |
How do you make the game randomly choose a number between say... 1 and 3 and then do actions according to what number picked. Like... If pick number equal to 1 do actions -Make rain at rain <gen> If picked number equal to 2 do actions -Make dungeon fog at rain <gen>... And so on... How would I do this? |
| 11-02-2003, 11:38 PM | #2 |
set variable to math - random number |
| 11-03-2003, 12:45 AM | #3 |
And how do you do the "If number = X, do actions..." part? |
| 11-03-2003, 12:50 AM | #4 |
I think i posted something similar to this a few days ago. It was about a random weather cycle. It should work if you just replace the actions with whatever you wanted. Heres what the guy posted for a trigger: Events: - Map Init Conditons: - None Actions: - CreateWeatherEffect(...) - set Effect[0] = (Last Created Weather Effect) - CreateWeatherEffect(...) - set Effect[1] = (Last Created Weather Effect) .... .... //repeat for all effects LOOK AT THIS TRIGGER!!! Randomize Effects Events: - Every Y seconds Conditions: - None (unless needed) Actions: - for (Integer A) = 0 to X - DisableWeatherEffect[(Integer A)] - EnableWeatherEffect Effect[(RandomNumber from 0 to X)] // X is the highest index used in first trigger EDIT: If you figure out what this means please be sure to tell me :D DOUBLE EDIT: hmm nvm i think i figured it out now.:ggani: |
| 11-03-2003, 01:05 AM | #5 |
I don't want it to cycle, I want it to be random. And anyway I'm asking a question, I don't want to have it "cycle" your way. |
| 11-03-2003, 01:08 AM | #6 |
ArRaY |
| 11-03-2003, 01:14 AM | #7 | |
Quote:
well jesus tap dancing christ guy, im just trying to help. Fine you dont like what MarSara posted you can figure it out by yourself, seeing as how YOU asked it maybe YOU can figure it out. think your head could get any farther up your ***? I couldnt really hear the snotty tone in your comments. Second off, you ninny, learn to read more carefully. What is the first word in the phrase "Random Weather Cycle." Hmmm is it... RANDOM!!?? Cycle is just an extra word. I could have named it Random Weather Effects too, and the trigger would still be the same. If you look at the trigger it doesnt "cycle" (like in a particular order) anyways, so your attempt at using my own words against me has failed and exploded in your face |
| 11-03-2003, 01:17 AM | #8 |
Ya realy man, take a napperz |
| 11-03-2003, 02:44 AM | #9 |
do what they said up there (the ones that were sane) ^ but if you want it random add some more extra veriables in there that is (do nothing). |
| 11-03-2003, 03:05 AM | #10 | |
Quote:
Oh, I'm sorry. I didn't see the "Random Part". But I'm not feeling nice right now because of your rampant flaming so I will take the liberty to add something else in... |
| 11-03-2003, 03:15 AM | #11 |
apology accepted. And about my rampant flaming: Whenever someone unknowingly makes an *** of themselves, or does something stupid, I let them know about it, in a way that usually they dont like :D |
| 11-03-2003, 03:58 AM | #12 |
MrMath = Random Number between 0 and 3 If (MrMath == 0) { Do whatever } If (MrMath == 1) { Do whatever } If (MrMath == 2) { Do whatever } If (MrMath == 3) { Do whatever } Sorry bout writing that in JS syntax, but im too lazy to think up the accual triggers. |
| 11-03-2003, 04:28 AM | #13 |
Theres not much to add to SpectreReturns, it's a good simple system. The only other way you might consider is basing it off %age chances of each possibilty, for example: Code:
Actions
Set RandomNumber = (Random real number between 0.00 and 100.00)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomNumber Less than 20.00
Then - Actions
Game - Display to (All players) the text: 1
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomNumber Less than 45.00
Then - Actions
Game - Display to (All players) the text: 2
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomNumber Less than 100.00
Then - Actions
Game - Display to (All players) the text: 3
Else - ActionsIn the trigger I posted above theres a 20% chance of displaying 1, 25% of 2, and 55% chance of 3. |
