| 05-25-2004, 03:51 PM | #1 |
Ok hears the scene I have a building with two gryphons in it that are doodad destructibles. Now what I'm trying to do is when a unit steps on a region one of them hides, or sometimes neither one of them hides. But I want it to happen randomly like some times the one on the left will hide and then some times the one on the right will and then sometimes neither one will hide. Any ideas? Sincerely, Strom Stonebeard |
| 05-25-2004, 05:01 PM | #2 |
yea, pick a random number between 1 and theMaxEventsYouWant set the number = to a temp variable then if the number is 1 do this if the number is 2, do this .... if the number is n do that |
| 05-25-2004, 05:38 PM | #3 | |
Quote:
Could elaborate on your post some. I'm pretty decent with triggers and familar with variables but the whole random number thing I'm kinda lost with. Sincerely, Strom Stonebeard |
| 05-25-2004, 05:40 PM | #4 |
Yeah, this is the right thing to do, this works for me (and I've checked that if you choose a random number between 1 and TheNumberYouWant, all the numbers in the interval will have almost the same probability to be chosen). EDIT : sorry, didn't see you where posting at the same time as me. What you have to do is use a set variable action, like this : create an integer variable named "choice", and a trigger variable "Possible Triggers". First set PossibleTriggers(1)=first action you want to be played, PossibleTriggers(2)=second action, ... Then use this trigger : action (set variable) : set "choice" = random number between 1 and TheNumberYouWant action (run trigger) : run PossibleTriggers(choice) |
| 05-25-2004, 06:28 PM | #5 |
Code:
Random Events Trig
Events
Unit - A unit enters SomeRegion <gen>
Conditions
Actions
Set Hide_Chance = (Random integer number between 1 and 100)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hide_Chance Less than or equal to 30
Then - Actions
Make the 1st Gryphon hide.
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hide_Chance Greater than or equal to 70
Then - Actions
Make the 2nd Gryphon hide.
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Hide_Chance Greater than or equal to 31) and (Hide_Chance Less than or equal to 69)
Then - Actions
Make none of them hide.
Else - Actions
Do nothing |
| 05-25-2004, 06:35 PM | #6 |
Does the Possible Trigger variable have an array? Cause I'm not sure how to set it as Possible Trigger(1). EDIT: Ah I see what your saying JJ9112, I'm guessing hide chance is a variable (interger?) I'll give that a try as well. Sincerely, Strom |
| 05-25-2004, 07:04 PM | #7 |
Hell Yea works perfectly, I tried what JJ9112 said, everything worked fine except the Gryphons would eventually hide them selves completly so I had to add an unhide in the if/then/else statements as well as hide. Thanks guys!! Sincerely, Strom Stonebeard |
