Random Numbers help?

For fulfilled maps that most likely don't work on the latest patch (1.24 or later).

Moderator: Cheaters

Black-Hole
Forum Fanatic
Posts: 315
Joined: October 16th, 2007, 7:32 pm

Random Numbers help?

Post by Black-Hole »

In the game im making at the start it pickes 4 random numbers for 4 different variables than uses the numbers to spawn Destructables in random places around the map.
For some reason it pickes the same number for all 4 every time i start the game. Please help me.
Spoiler:
LeaderBoard
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Wait 0.20 seconds
Set Trees_Max = (Random integer number between 2500 and 3500)
Wait 0.20 seconds
Set Fallen_Trees_Max = (Random integer number between 350 and 500)
Wait 0.20 seconds
Set Rocks_Max = (Random integer number between 350 and 500)
Wait 0.20 seconds
Set Gates_Max = (Random integer number between 2 and 10)
Wait 0.20 seconds
Leaderboard - Create a leaderboard for (All players) titled |c151B54Destructibl...
Set Leaderboard = (Last created leaderboard)
Leaderboard - Add Player 5 (Yellow) to Leaderboard with label Trees to make and value Trees_Max
Leaderboard - Add Player 6 (Orange) to Leaderboard with label Rocks to make and value Rocks_Max
Leaderboard - Add Player 7 (Green) to Leaderboard with label Fallen trees to make and value Fallen_Trees_Max
Leaderboard - Add Player 8 (Pink) to Leaderboard with label Gates to make and value Gates_Max
Leaderboard - Add Player 9 (Gray) to Leaderboard with label Trees and value Trees
Leaderboard - Add Player 10 (Light Blue) to Leaderboard with label Rocks and value Rocks
Leaderboard - Add Player 11 (Dark Green) to Leaderboard with label FallenTrees and value Fallen_Trees
Leaderboard - Add Player 12 (Brown) to Leaderboard with label Gates and value Gates
Leaderboard - Show Leaderboard
Wait 2.00 seconds
Trigger - Turn on Destructible 1 <gen>
Trigger - Turn on Destructible 2 <gen>
Trigger - Turn on Destructible 3 <gen>
Trigger - Turn on Destructible 4 <gen>
Trigger - Turn on Destructible Stop <gen>
The triggers Destructible 1 - 4 are all the same only with different destructibles
Spoiler:
Destructible 1
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Destructible - Create a Summer Tree Wall at (Random point in Entire Map <gen>) facing (Random angle) with scale 1.00 and variation 0
Destructible - Create a Summer Tree Wall at (Random point in Entire Map <gen>) facing (Random angle) with scale 1.00 and variation 0
Set Trees = (Trees + 2)
Leaderboard - Change the value for Player 9 (Gray) in Leaderboard to Trees
and lastly Destructible stop trigger which stopes the destructibles from spawning more than the max.
Spoiler:
Destructible Stop
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Trees Equal to Trees_Max
Then - Actions
Trigger - Turn off Destructible 1 <gen>
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Fallen_Trees Equal to Fallen_Trees_Max
Then - Actions
Trigger - Turn off Destructible 2 <gen>
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Rocks Equal to Rocks_Max
Then - Actions
Trigger - Turn off Destructible 3 <gen>
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Gates Equal to Gates_Max
Then - Actions
Trigger - Turn off Destructible 4 <gen>
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Gates Equal to Gates_Max
Fallen_Trees Equal to Fallen_Trees_Max
Rocks Equal to Rocks_Max
Trees Equal to Trees_Max
Then - Actions
Trigger - Turn off Destructible Stop <gen>
Game - Display to (All players) the text: Map build complete!
Else - Actions
Arabidnun
Forum Staff
Posts: 506
Joined: August 5th, 2007, 1:38 pm
Title: Gui Expert
Location: *Unknown*

Re: Random Numbers help?

Post by Arabidnun »

Sometimes when you are playing in single player, it picks the same random numbers all the time, but when u do something like, create random integer then display, then create another random integer then display they are always different after that. Try it in B-net, it might help.

I will create a beta map as the triggers you described and see if I accure with the same problem.

Edit:

I have created a beta map of your version, and it works perfectly for me on battle.net. I believe your problem is the single player.

However, I do have 1 suggestion, for you 4 destructable triggers, use this:

[blinking]
Destructible Triggers
[/blinking]
Spoiler:
Destructible Trees
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Destructible - Create a Summer Tree Wall at (Random point in (Entire map)) facing (Random angle) with scale 1.00 and variation 0
Set Trees = (Trees + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Trees Greater than or equal to Trees_Max
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Destructible - Create a Summer Tree Wall at (Random point in (Entire map)) facing (Random angle) with scale 1.00 and variation 0
Set Trees = (Trees + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Trees Greater than or equal to Trees_Max
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions

This way you will not go over your desiganted amount on the map and, you don't need to make another trigger for each Destructible.