OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Safari on 27 Apr 2004, 08:23:55

Title: Creating AI units around player
Post by: Safari 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
Title: Re:Creating AI units around player
Post by: General Barron 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.