Home   Help Search Login Register  

Author Topic: Creating AI units around player  (Read 581 times)

0 Members and 1 Guest are viewing this topic.

Safari

  • Guest
Creating AI units around player
« on: 27 Apr 2004, 08:23:55 »
How can this be done: AI units are created around player at random positions, placement radius 2000 metres. But they are NOT created closer than 500 metres

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Creating AI units around player
« Reply #1 on: 27 Apr 2004, 08:29:37 »
After you create a unit in your script, name him _unit, and put this:

Code: [Select]
_radius = 500 + random 1500
_dir = random 360
_center =  getpos player

_pos = [(_center select 0) + _radius*cos _dir, (_center select 1) + _radius* sin _dir]
_unit setpos _pos

You may want to create a whole group at _pos, so you don't end up with guys in the same group all spread out around the player.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!