A Random Entity

Algebraic

L1: Registered
Jul 18, 2010
34
2
Hey, i was just wondering if there was any way to have an entity generate a random number...its hard to explain, but heres an example of a use for it:
You have 7 rooms, in room #1 there is a teleporter entrance.
Room numbers 2,3,4,5,6,7 (All named their numbers) have a teleporter exit.
So is there any way to make it so that the entrance will teleport a player to any of the other rooms at random? So, a player spawns and enters the teleporter and goes to room 3, another player spawns and enters into the teleporter and goes to room 6, etc.

Thanks in advance.
 

Captain Hatman

L1: Registered
Aug 5, 2010
24
6
The way I'd do it would be to use multiple instances of logic_timer, which can fire off at random intervals.

Turn on "use random time" and set your minimum random interval to 1 and your maximum random interval to any arbitrary number - say, the number of timers you intend to use +1. in outputs, use the output "OnTimer".

use a few of those to activate the exits, or set the target of the entrance, or turn on different entrances or whatever it is you're doing. It won't be completely random, but two players passing through a few seconds apart should wind up going to different rooms.
 

Algebraic

L1: Registered
Jul 18, 2010
34
2
Thanks, that should work alright for what i have in mind.

It just seems weird that valve wouldn't have a "math_random" or something that generates a random number.