HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Problem

12-28-2002, 12:44 AM#1
Guest
Im working on a map and i'me trying to incorporate somewhat random weather. I would like to have the starting and stopping times to be random, but 2-6 hours apart, with the weather being constant. I have a general idea of how to get weather working, but when i tried to implement the random bit, then it jsut stopped working. Any help would be appreciated, and if you need any more info to help me please say so, and I'll add whatever I can.
12-28-2002, 06:26 AM#2
Ari
Why don't you post the triggers explaining how you're dealing with weather, and also the triggers you're using to randomly assign weather. That'll give us a better idea of what could be going wrong.
12-28-2002, 09:06 AM#3
Sytadel
Well you'd probably be wanting something using 'Math - Random Number', i.e. have a variable which is changed every 6 hours into a random number, and then run a trigger similar to:

If (Weathervariable = 1) Then do ('Environment - Create Weather Effect' Create at (Someregion) the weather effect Lordareon Rain Heavy)

You could also change the '6 hours' into a variable as well, like something that fluctuates between 2 and 6 hours as you said.
12-28-2002, 10:39 PM#4
Guest
First off, this is sorta what im using:

-events
- Game - The in-game time of day becomes Greater than or equal to 9.00
-actions
- Environment - Create at (Entire map) the weather effect Northerend Snow(Light)
-Environment - Turn (Last Created weather effect) On

Now, this will create the snow at 9AM, and then i have a similar trigger at what ever time except with "Turn weather Off." Now i want to set the time to random, but the event that im using "Game - Time of Day" won't except a real variable where the time goes, so it messes this up.

Sytadel: Does that work, without an event? Cause every time I've tried to make weather without an event it didn't work. Also, what does the "=1" have to do with anything, what random numbers are you assigning it (from what to what)?

And thnx for the replies
12-29-2002, 05:26 AM#5
Sytadel
Ok here's the trigger as I would do it...

--EVENT--
- Game - The in-game time of day becomes Greater than or equal to 9.00
--CONDITIONS--
-None
--ACTIONS--
- Turn last created weather effect Off
- Set (Weathervariable) = Random Number between 1 and 6
- If (Weathervariable = 1) Then do ('Environment - Create Weather Effect' Create at (Entire map) the weather effect Lordareon Rain Heavy)
- If (Weathervariable = 2) Then do ('Environment - Create Weather Effect' Create at (Entire map) the weather effect Lordareon Rain Light)
...etc until you get to 6...
- Turn last created weather effect On

So this trigger turns off the last effect, randomly picks a new one, and then turns it on. See?
12-29-2002, 05:36 AM#6
Guest
I see that, thnx. But how about making it start at a random time. The one I have is set for 9, but I would like to have it start at random times, but in my limited experience, you have to set an event in the trigger for this to work, yet this event statement that both me and you are using does not except real variables, which are what time is saved as (don't ask me why, it jsut doesn't list my real variables tht i have as an option).
12-29-2002, 05:38 AM#7
Guest
Also, you seem like you know what you are talking about, maybe you can help me with this:

I am trying to create a neutral town, so that the units don't automatically fight when in town. But once all the player's units leave town, then I want the settings to return the what they were. I have the trigger made for the units entering town, that works fine. But for leaving town I have a small problem. I use the following action:

If ((No unit is in (Units in neutral area [gen] owned by Player 1 (Red))) Equal to True) then (set to original setting), otherwise do nothing

My problem comes in that if player 1 has no units in the region "neutral area" then that statement should be true, and the settings should be reset. The problem is, it comes out false, and I have no clue why. If you could help me with this I would greatly appreciate it.
12-29-2002, 05:55 AM#8
dataangel
Trigger 1

Events
Game Day is 0.00
Actions
Set Starttime = Random number between 0 and 23
Set Endtime = Random number between Starttime and 24
Set Weatherrand = Random number between 1 and 6
Trigger - Turn on Trigger 2


Trigger 2

Events
Periodic Event - Every 2 seconds
Actions
If(Current Game Time = Endtime) Disable weathereffect
If(Current Game Time = Endtime) Destroy weathereffect
If(Current Game Time = Endtime) Trigger - Turn off (this trigger)
If(Current Game Time = Starttime) Do Nothing Else Skip Remaining Actions
If(Weatherrand = 1) Create weather effect over entire map
If(Weatherrand = 2) Create weather effect over entire map
If(Weatherrand = 3) Create weather effect over entire map
If(Weatherrand = 4) Create weather effect over entire map
If(Weatherrand = 5) Create weather effect over entire map
If(Weatherrand = 6) Create weather effect over entire map
Set weathereffect = (Last Created Weather Effect)


I'm pretty sure that'll do it for you. Actually test it to make sure.

Your latter problem probably depends on other stuff. Nothing looks wrong with that action. Post the event and any conditions you're using too.
12-29-2002, 06:12 AM#9
Guest
Thnx a lot, I'll see if that weather thing works, but later today, after I get some sleep, kinda tired right now.

As for the other one, here is the full trigger:

- Events
- Unit - A unit leaves neutral area <gen>
- Conditions
- (Owner of (Triggering unit)) Equal to Player 1 (Red)
- Actions
- If ((No unit is in (Units in neutral area [gen] owned by Player 1 (Red))) Equal to True) then (set to original setting), otherwise do nothing
12-29-2002, 07:27 AM#10
Sytadel
Your trigger looks fine... just replace 'Triggering unit' with 'Leaving unit' and see what that does. Of course, the problem could be in whatever actions make up 'original setting'.
12-29-2002, 08:00 AM#11
Guest
I put that same action in trigger initilization, and set it to create one type of unit if it was true, or another type if it was false, and the statement that should have been true, ended up being false. I then tried by placing a unit in the region, and it was still false.
12-29-2002, 03:14 PM#12
Guest
hey aster, maybe these guys could help us figure out the whole unit aquisitoin thing. You one of our other ideas was to set the units aquisiton to 0 when in town, so that they do not pick fights, at any rate i think the problem was storing the units default acquisition range, is there any easy way to do it ?
12-29-2002, 06:06 PM#13
Guest
That's not the big problem, it's just tedious to have to store each units range, but it's pretty simple, I believe. The problem is, is that the triggers don't set the range to 0, thus the units still end up attacking.
12-29-2002, 11:42 PM#14
Guest
Thanks everyone for trying to help but i finally figured it out. I used the function: ((Units in neutral area <gen> Owned by Player 1 (Red) is Empty) Equal to True) instead of the other one and it worked.

But as for the weather, I could still use some help.
12-30-2002, 10:28 AM#15
AIAndy
For the weather I would create an integer. In this integer I'd save the time in hours til next weather change. Then in an periodic event every game hour I would reduce that integer by 1. In that same trigger I'd check if the integer is 0. In that case I would disable the old weather effect and then create a random new one (like in the other posts) and set the integer to a new random value between 2 and 6.