Jump to content
Sign in to follow this  
pliskin124

Group Trigger Help

Recommended Posts

I have a script that actively calls in units when Blufor approach, however I want to regear them to look differently. I have another script that will do this via execVM, however is there a way to place a trigger down and have it work on units that actively spawn in?

The code for the SQF is this

nul = [] execVM "drirregulars\Random.sqf";

tldr; actively redress units that spawn in

Share this post


Link to post
Share on other sites

Not sure if I'm hearing you right. Let me provide a different perspective. Say I want to spawn a group of 10 AI at Point A, and have them move, as a group, to Point B, in Diamond formation. Simply spawn in individually and assign to a group or use the spawnGroup function to do it all, then set a waypoint.

What YOU want to do is get 10 AI from Point A to Point B, but in a trickling-fashion, as in one at a time. Yes? What I suggest is spawn them individually, and have each spawn "join" the 1st spawn, who you assigned a waypoint at Point B.

Here is how I applied this in one of my missions. Note: THIS is not what you're looking for. Maybe. I believe the 2nd PHP box is.

for "_i" from 0 to (3 max (floor(random 6))) do
{
	_rndmpos = [(_center select 0) + ((floor(random 2000))+(floor(random -2000))), (_center select 1) + ((floor(random 2000))+(floor(random -2000))), 0];
	_rndmspawngrp = [_rndmpos, EAST, ["O_Soldier_AA_F"]] call BIS_fnc_spawnGroup;
	if (_i == 0) then {
		rndme1spawn = leader _rndmspawngrp;
	}
	else
	{
		rndmespawn = leader _rndmspawngrp;
		[rndmespawn] join rndme1spawn;
	};
};

grpEnemy = group rndme1spawn;

_wpe = grpEnemy addWaypoint [_center, 0];
_wpe setWaypointType "MOVE";
_wpe setWaypointBehaviour "COMBAT";
_wpe setWaypointSpeed "FULL";
_wpe setWaypointCombatMode "RED";
_wpe setWaypointStatements  ["true",""];

What I did here was spawned in individual units (I'm using spawnGroup so that they're full, animate AI, versus that seen by createVehicle), with the 1st spawn (_i == 0) labeled as a different variable, so anyone that is not _i == 0 will enter the other scope and join _i == 0's group. The group is then given a command.

Here's what I'm thinking you could do. Note: You'll need to make a marker named "enemyspawn", where they will spawn, and "egoto", where the waypoint is set, or change that variable to a marker name you already have.

_espawn = getMarkerPos "enemyspawn";
_egoto = getMarkerPos "egoto";
spawnenemies = true;

while {(spawnenemies)} do {
for "_i" from 0 to 9 do
{
	_spawngrp = [_espawn, EAST, ["O_Soldier_F"]] call BIS_fnc_spawnGroup;
	if (_i == 0) then {
		e1spawn = leader _spawngrp;
		grpEnemy = group e1spawn;

		_wpe = grpEnemy addWaypoint [_egoto, 0];
		_wpe setWaypointType "MOVE";
		_wpe setWaypointBehaviour "CARELESS";
		_wpe setWaypointSpeed "FULL";
		_wpe setWaypointCombatMode "RED";
		_wpe setWaypointStatements  ["true",""];
	}
	else
	{
		espawn = leader _spawngrp;
		[espawn] join e1spawn;
	};
	sleep 10;
};
};

Every 10 seconds, a new unit will spawn, up to 10 total. Naturally, you can change the number of units and the sleep time between spawns.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×