| 10-29-2004, 10:02 AM | #1 |
Call Rain Points Events Time - Every (Random real number between 480.00 and 960.00) seconds of game time Conditions Actions For each (Integer A) from 1 to 10, do (Actions) Loop - Actions Set RainTargetTempPoint[(Integer A)] = (Random point in (Playable map area)) For each (Integer B) from 1 to 10, do (Actions) Loop - Actions If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions (Distance between RainTargetTempPoint[(Integer A)] and RainTargetTempPoint[(Integer B)]) Less than 5000.00 Then - Actions Custom script: call RemoveLocation( udg_RainTargetTempPoint[GetForLoopIndexA()] ) Set RainTargetTempPoint[(Integer A)] = (RainTargetTempPoint[(Integer B)] offset by 5000.00 towards (Random angle) degrees) Else - Actions Do nothing Trigger - Run Rain On <gen> (checking conditions) Wait (Random real number between 240.00 and 480.00) seconds Trigger - Run Rain Off <gen> (checking conditions) Can anyone see any bug in this? i doesn't work but i dont know what... :( |
| 10-29-2004, 10:15 AM | #2 |
Have you tried it without the random number in the event? I don't think you can call an event using random periodic times. I don't think you could even do it with a variable unless you were to code it in Jass. You could you a timer that resets to a random number everytime the trigger is through. then just use the timer expires event and it will recycle its self automatically. |
| 10-29-2004, 10:19 AM | #3 |
what do you want to check with this? other question, where is the end of the first and where is the end of the second loop? |
| 10-29-2004, 10:20 PM | #4 |
First to Klownkiller: I've tried with another event aswell: Chat event and i want the random event becouse of that it doesnt rain outside at 6 o'clock every day? :D to diehard: Call Rain Points Events Time - Every (Random real number between 480.00 and 960.00) seconds of game time Conditions Actions AFor each (Integer A) from 1 to 10, do (Actions) Loop - Actions Set RainTargetTempPoint[(Integer A)] = (Random point in (Playable map area)) AFor each (Integer B) from 1 to 10, do (Actions) Loop - Actions If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions (Distance between RainTargetTempPoint[(Integer A)] and RainTargetTempPoint[(Integer B)]) Less than 5000.00 Then - Actions Custom script: call RemoveLocation( udg_RainTargetTempPoint[GetForLoopIndexA()] ) Set RainTargetTempPoint[(Integer A)] = (RainTargetTempPoint[(Integer B)] offset by 5000.00 towards (Random angle) degrees) Else - Actions Do nothingBB Trigger - Run Rain On <gen> (checking conditions) Wait (Random real number between 240.00 and 480.00) seconds Trigger - Run Rain Off <gen> (checking conditions) Red is where the first start and end, and blue is where the other starts and ends... |
| 10-30-2004, 01:01 AM | #5 |
well, the way you did it, it can put 2 spots in the same area (within 5000) you make sure that the first chosen point isnt within 5000, but the 2nd with the offset may be within 5000. also, when you say it doesnt work.. if nothing happens the problem may be in Run Rain. |
| 10-30-2004, 08:36 AM | #6 |
well i madea teat for your random number in the event. It will fire the trigger but it is not random at all. It picks a random number at map Initalization and uses that same number everytime. I ran it with 0 to 5 seconds as the random, and it ran for 10 minutes. The trigger fired every 3.4 seconds for the entire 10 minutes. Every time i ran the map it was a different time, but always the same time throughout the map. As far os the rest of your trigger it seems to be fine. maybe you should post your Run Rain as Twistar suggested. you could just make a test map with those 2 triggers and post it as well. |
| 10-30-2004, 01:32 PM | #7 | |
Quote:
That won't work, well it would work but not right, It will always be the same period, and the only time the random number is changed is during map initialization. better use TimerRain Expires as event, then at the end of the trigger start TimerRain with a random timeout, of course you'd need to start TimerRain at map initialization somewhere |
| 10-30-2004, 01:43 PM | #8 |
Try this: Code:
Call Rain Points
Events
Time - Elapsed Game time is 1.00 seconds
Conditions
Actions
Wait - Wait (Random Real Number between (480.00 and 960.00)
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
Set RainTargetTempPoint[(Integer A)] = (Random point in (Playable map area))
For each (Integer B) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between RainTargetTempPoint[(Integer A)] and RainTargetTempPoint[(Integer B)]) Less than 5000.00
Then - Actions
Custom script: call RemoveLocation( udg_RainTargetTempPoint[GetForLoopIndexA()] )
Set RainTargetTempPoint[(Integer A)] = (RainTargetTempPoint[(Integer B)] offset by 5000.00 towards (Random angle) degrees)
Else - Actions
Do nothing
Trigger - Run Rain On <gen> (checking conditions)
Wait (Random real number between 240.00 and 480.00) seconds
Trigger - Run Rain Off <gen> (checking conditions)
Trigger - Run (This Trigger) (checking conditions)That should, in effect do it in random periods. Also, the reason it is always a set time is because warcraft, when the map is loading, generates all events for triggers and never generates them again, unless you use the action Trigger - Add Event. That is why you cannot have Events with variables in them. The Events have to be generated at the start of the map. |
| 10-30-2004, 01:50 PM | #9 | |
Quote:
|
| 10-30-2004, 01:51 PM | #10 |
You could use a Wait - Game Time if you wanted. You could turn it off before the wait, but I'm pretty sure it won't get called in there anywhere. Unless he's doing it. I'm not using a periodic Event, just a one time event. |
| 10-30-2004, 01:56 PM | #11 |
Wait - Game Time Is a polled wait, it is a weird function Code:
function PolledWait takes real duration returns nothing
local timer t
local real timeRemaining
if (duration > 0) then
set t = CreateTimer()
call TimerStart(t, duration, false, null)
loop
set timeRemaining = TimerGetRemaining(t)
exitwhen timeRemaining <= 0
// If we have a bit of time left, skip past 10% of the remaining
// duration instead of checking every interval, to minimize the
// polling on long waits.
if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
call TriggerSleepAction(0.1 * timeRemaining)
else
call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
endif
endloop
call DestroyTimer(t)
endif
endfunctionIt creates its own timer and uses normal wait actions till the timer expires and it even doesn't derreference the t local variable, while making a timer with random expiration periods will always use the same timer and won't do anything but starting it. |
