HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Weather, Regions, and Random

10-11-2004, 04:45 AM#1
Panto
Greetings.

Let's pretend, hypothetically, that I've got this trigger here:
Code:
Weather
    Events
        Time - Every 15.00 seconds of game time
        Player - Player 4 (Purple) types a chat message containing weather as An exact match
    Conditions
        ((This trigger) is on) Equal to True
    Actions
        Game - Display to (All players) for 30.00 seconds the text: Weather!
        -------- 0=nothing, 1=rain, 2=wind, 3=light --------
        For each (Integer intLoop) from 1 to 8, do (Actions)
            Loop - Actions
                Set intRandom = (Random integer number between 0 and 3)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        intArRandomWeather[intLoop] Not equal to intRandom
                    Then - Actions
                        Environment - Remove weatherArRandom[intLoop]
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                intRandom Equal to 0
                            Then - Actions
                                Do nothing
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                intRandom Equal to 1
                            Then - Actions
                                Cinematic - Ping minimap for (All players) at (Center of regionArWeather[intLoop]) for 15.00 seconds
                                Environment - Create at regionArWeather[intLoop] the weather effect Ashenvale Rain (Heavy)
                                Environment - Turn (Last created weather effect) On
                                Set weatherArRandom[intLoop] = (Last created weather effect)
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                intRandom Equal to 2
                            Then - Actions
                                Environment - Create at regionArWeather[intLoop] the weather effect Outland Wind (Light)
                                Environment - Turn (Last created weather effect) On
                                Set weatherArRandom[intLoop] = (Last created weather effect)
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                intRandom Equal to 3
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (In-game time of day) Greater than or equal to 6.00
                                        (In-game time of day) Less than 18.00
                                    Then - Actions
                                        Environment - Create at regionArWeather[intLoop] the weather effect Rays Of Light
                                        Environment - Turn (Last created weather effect) On
                                        Set weatherArRandom[intLoop] = (Last created weather effect)
                                    Else - Actions
                                        Environment - Create at regionArWeather[intLoop] the weather effect Rays Of Moonlight
                                        Environment - Turn (Last created weather effect) On
                                        Set weatherArRandom[intLoop] = (Last created weather effect)
                            Else - Actions
                        Game - Display to (All players) for 10.00 seconds the text: (intArRandomWeather[ + ((String(intLoop)) + (] =  + (String(intRandom)))))
                        Set intArRandomWeather[intLoop] = intRandom
                    Else - Actions
                        Do nothing
However, it doesn't always make weather in the regions that it's supposed to. Sometimes it does, sometimes it doesn't.

I moved the variable definitions inside the If loops in the middle to make absolutely sure that they're firing together, so what else might be going wrong?

There are 8 regions, assigned to regionArWeather[x] where x is 1 through 8. The integer array intArRandomWeather keeps track of what kind of weather is assigned to each region so that it doesn't destroy and re-make it if the weather is randomly assigned to the same number as before. The weather array weatherArRandom just stores the weather as it's created so that it can later be destroyed.

So, is there only one weather effect allowed, or what? Something's going wrong here.
10-11-2004, 04:54 AM#2
Panto
Testing has revealed that it always works for region 8, and not necessarily any of the others.
11-24-2004, 05:45 PM#3
oNdizZ
hmm, i still a noob....
but, have you in your initialazation added this?

Set regionArWeather[1] = "that region on the map"
Set regionArWeather[2] = "that second region on the map"

and so on.. couse if you haven't, the variable won't work?
11-24-2004, 05:49 PM#4
Panto
Yes, of course they're defined.
11-24-2004, 06:35 PM#5
oNdizZ
I've tried some things(in the GUI) and this is what i discovered:

i made 2 rain triggers.

First one with a loop action
And second one with no loop


i made both VERY simple so i could know that it wasen't any wrong with them

on the first one, only 1 of 8 rain-regions worked

and on the second one 3 of 3 worked

this is the second one:

Rain test
Events
Player - Player 1 (Red) types a chat message containing rain as An exact match
Conditions
Actions
Environment - Create at (region 1) the weather effect Ashenvale Rain (Heavy)
Environment - Turn (Last created weather effect) On
Environment - Create at (region 2) the weather effect Ashenvale Rain (Heavy)
Environment - Turn (Last created weather effect) On
Environment - Create at (region 3) the weather effect Ashenvale Rain (Heavy)
Environment - Turn (Last created weather effect) On


that way, it truely work, but i don't think it work with loops
11-25-2004, 06:45 AM#6
Panto
Huh, interesting find. Thanks, I'll take a look-see.