randomally spawning ai

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

Post Reply
Smeghead
Lance Corporal
Posts: 22
Joined: Thu May 06, 2004 4:10 pm

randomally spawning ai

Post by Smeghead »

Guys you have been a great source of info for me , thank you 1 and all. Now for my next question is it possible to have an ai bot spawn in a random position but stay there. So rather than it stay where i place it on the the map, is it possible for it to spawn in a certain radius of its start point. In real terms i place the spawn point behind the wall but give it a radius of 20m in which to actually spawn, is this possible?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

origin

Post by tltrude »

I guess you could move the origin of it around randomly.
Tom Trude,

Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

i know there's a rand(om) function somewhere in MOHScript, it's been used before. i've just never used it myself.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

I think its

Code: Select all

randint (5)

It picks a random integer from 0 to 5.

Say you wanted a number between 2 and 7

Code: Select all


randint (5) + 2
I believe that was it.
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

starts at 0 like C++ rand function right?
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

lizardkid wrote:starts at 0 like C++ rand function right?
Yep, just add on the minimum number you want it to be. Like and random number between 2 - 7 you would need to add 2 onto it so a zero would be a 2 and a 5 would be a 7.
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yep, but it's 'randomint' or 'randomfloat' :wink: and you don't even need the parens () 8-)
Image
Post Reply