Jump to content
Sign in to follow this  
BullyBoii

spawn problem

Recommended Posts

im having a problem spawning in a group of units

code below:

_house = nearestObjects [getmarkerpos "objective_2", ["House"], 200];
_rMarkerName = random 9999;//random number to use as marker name
_i = 0;
{
_randomNumber = random 10;
if (_randomNumber <= 2) then
{

	//spawns units
	//creates a center
	_sideEast = createcenter east;
	_group = createGroup east;
	_group = [_x, EAST, random 3] call bis_fnc_spawnGroup; //_x is the house

	//moves unit into house
	_i = _i;
	{
		_x setpos ((nearestBuilding _x) buildingPos _i);
	} forEach units _group;
	_i = _i + 1;

	//creates markers at houses
	_rMarkerName = _rMarkerName + 1;//add one to marker number
	_markerName = str _rMarkerName; // creates a str from the number	
	_marker = createmarker [_markerName, getpos _x];//creates a marker on the house
	_markerName setMarkerType "hd_dot";
	_markerName setMarkerColor "colorRed";


};
} forEach _house;

the script is triggered on amultiplayer game mode with an in-game trigger, but the units do not appear

the script is meant to get pos of a house then set the units to spawn then moves them into the respective house then create a marker for that house

Share this post


Link to post
Share on other sites

hey,

bis_fnc_spawnGroup requires the functions manager (Modul) do you place it?

Share this post


Link to post
Share on other sites
im having a problem spawning in a group of units

code below:

_house = nearestObjects [getmarkerpos "objective_2", ["House"], 200];
_rMarkerName = random 9999;//random number to use as marker name
_i = 0;
{
_randomNumber = random 10;
if (_randomNumber <= 2) then
{

	//spawns units
	//creates a center
	_sideEast = createcenter east;
	_group = createGroup east;
	_group = [_x, EAST, random 3] call bis_fnc_spawnGroup; //_x is the house

	//moves unit into house
	_i = _i;
	{
		_x setpos ((nearestBuilding _x) buildingPos _i);
	} forEach units _group;
	_i = _i + 1;

	//creates markers at houses
	_rMarkerName = _rMarkerName + 1;//add one to marker number
	_markerName = str _rMarkerName; // creates a str from the number	
	_marker = createmarker [_markerName, getpos _x];//creates a marker on the house
	_markerName setMarkerType "hd_dot";
	_markerName setMarkerColor "colorRed";


};
} forEach _house;

the script is triggered on amultiplayer game mode with an in-game trigger, but the units do not appear

the script is meant to get pos of a house then set the units to spawn then moves them into the respective house then create a marker for that house

_group = [getPosATL _x, EAST, random 3] call bis_fnc_spawnGroup; //_x is the house

The array _house has a list of objects but not the location so just add the getPosATL _x for your code should do the trick.

You could also try to use "HouseBase" and "Building" instead of "House" to get some different results.

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  

×