Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: Creating AI units around player  (Read 691 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!