Random integer.. not so random?

maldruzard

Member
Reaction score
2
Hey there!

I have a trigger in my map which sets a variable region to different regions depending on a constantly changing integer which decides the number of the region randomely. It goes like hits (no idea how to do trigger text):

Events - Every 0.10 seconds of game time
Actions -
- set random = random integer between 1-23
- If (all conditions) are true, then (actions) else...

If - random is equal to 1
Then - set REGION to region 1

- If (all conditions) are true, then (actions) else...

If - random is equal to 2
Then - set REGION to region 2

etc!

My problem is that for some reason, every time I restart the map, the same regions seem to be selected! :( This is my spawning trigger, pretty simple:

Time Elapsed - 0.1 seconds
Actions - Spawn tent for player 1 at random point in REGION
Wait - 0.1 seconds
Actions - Spawn tent for player 2 at random point in REGION
Wait - 0.1 seconds
Actions - Spawn tent for player 3 at random point in REGION
Wait - 0.1 seconds
Actions - Spawn tent for player 4 at random point in REGION

Sure enough, all the tents spawn in different regions! However, upon restarting the map (have tested it many times), the tents spawn in exactly the same positions as previous playthroughs, despite the 'random' integer :( As this is a map that I would prefer to be played multiple times, the tent spawns being different each time is a must! Can anyone help?
 

vypur85

Hibernate
Reaction score
803
This is normal. The randomness will only be similar when you click the 'Test Map' and play the game. However, it will be random enough when you actually create the game normally.

On top of that, in the Terrain Editor, go to File > Preference > Test Map, and untick 'Fixed random seed'.

It will be fine afterwards.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top