HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random number.. dont work?

09-03-2005, 09:13 AM#1
Thunder_Eye
Ive made this trigger below, It works fine and creates all the trees and so on.
The problem is, It seems to make the random number the same all the time, cause every time I test the map, It looks the same!

Is it supposed to be like this or have I done something wrong?

-If you dont feel like reading this long trigger, I'll explain it here.
It is supposed to create 280-350 summer tree walls at random point in the map, and then change the terrain texture there.
Then change the terrain a bit..
My problem is it places the trees at the same spots every time!

Quote:
Untitled Trigger 001
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Set tempIntegerA = (Random integer number between 280 and 350)
For each (Integer A) from 1 to tempIntegerA, do (Actions)
Loop - Actions
Set tempInteger = (Random integer number between 1 and 3)
Set tempPoint = (Random point in (Playable map area))
Destructible - Create a Summer Tree Wall at tempPoint facing (Random angle) with scale (Random real number between 0.80 and 1.20) and variation (Random integer number between 1 and 10)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
tempInteger Equal to 1
Then - Actions
Environment - Change terrain type at tempPoint to Lordaeron Summer - Rough Dirt using variation -1 in an area 1 and shape Circle
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
tempInteger Equal to 2
Then - Actions
Environment - Change terrain type at tempPoint to Lordaeron Summer - Grassy Dirt using variation -1 in an area 1 and shape Circle
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
tempInteger Equal to 3
Then - Actions
Environment - Change terrain type at tempPoint to Lordaeron Summer - Grass using variation -1 in an area 1 and shape Circle
Else - Actions
Set tempIntegerA = (Random integer number between 800 and 1500)
For each (Integer A) from 1 to tempIntegerA, do (Actions)
Loop - Actions
Set tempInteger = (Random integer number between 1 and 3)
Set tempPoint = (Random point in (Playable map area))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
tempInteger Equal to 1
Then - Actions
Environment - Change terrain type at tempPoint to Lordaeron Summer - Rough Dirt using variation -1 in an area 1 and shape Circle
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
tempInteger Equal to 2
Then - Actions
Environment - Change terrain type at tempPoint to Lordaeron Summer - Grassy Dirt using variation -1 in an area 1 and shape Circle
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
tempInteger Equal to 3
Then - Actions
Environment - Change terrain type at tempPoint to Lordaeron Summer - Grass using variation -1 in an area 1 and shape Circle
Else - Actions
Custom script: call RemoveLocation( udg_tempPoint )

09-03-2005, 11:50 AM#2
iNfraNe
random numbers dont seem to work on elapsed game time. They DO work on map init (unless u use waits on that, which seems stupid 2 me anyway)

so what u need 2do is create the random number at map init and use it at elapsed time
09-03-2005, 01:50 PM#3
Thunder_Eye
But doesnt it work too use as random loot on monsters for example?

Event
Unit Dies
Condition
blabla.
Action
Set Loot = random between 1 and 3
If loot = 1 create item blabla
If loot = 2 create item blablabla

I think that works, so why wont it work on this one? Is it because the event is Elapsed time?

EDIT:
Ok I set the random numbers in an Map intilialization like this
Trigger 1:
Quote:
Untitled Trigger 002
Events
Map initialization
Conditions
Actions
Set IntegerA = (Random integer number between 250 and 500)
Set IntegerB = (Random integer number between 900 and 1500)

and Trigger 2 is almost the same as the first one posted.
09-03-2005, 05:07 PM#4
Elven Ronin
You're not clicking the test button to test it are you? Because unless you've checked random number seed during test or something like that, it'll keep giving you the same number instead of making a random one.
09-03-2005, 08:06 PM#5
Thunder_Eye
Ok then thats probably the problem ;P I'll fix that later and try it