Welcome, Guest Thursday 24th April 2014, 12:54:30
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: Spawning in random area of the marker  (Read 278 times)
0 Members and 1 Guest are viewing this topic.
SaS TrooP
*
Offline Offline

n00b always & everywhere


« on: 30 May 2011, 17:48:24 »

Lets say I have a marker, brush, 1000x1000 metres big. I am spawning AI unit. How can I force spawned unit to respawn in random area in that marker, on any of these 1000x1000 metres? Such a trick is used in eg. in UPSMON.
Logged
SaOk
Missions Depot Staff
*****
Offline Offline



WWW
« Reply #1 on: 02 Jun 2011, 12:50:20 »

Code:
_center = getmarkerpos "markername";
_range = getMarkerSize "markername";
_start = [(_center select 0) + random (_range select 0) - random (_range select 0),(_center select 1) + random (_range select 1) - random (_range select 1),0];
while {player distance _start < 500} do {_start = [(_center select 0) + random (_range select 0) - random (_range select 0),(_center select 1) + random (_range select 1) - random (_range select 1),0];};
_group = [_start, EAST, ["TK_INS_Soldier_EP1"],[],[],[0.7,0.9]] call BIS_fnc_spawnGroup;

With that while loop it also checks that the unit dosent spawn near player.
« Last Edit: 02 Jun 2011, 12:53:33 by SaOk » Logged
SaS TrooP
*
Offline Offline

n00b always & everywhere


« Reply #2 on: 02 Jun 2011, 20:23:17 »

Works even more than just fine! Thanks man!
Logged
Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: