Arma 3
Make units spawn with a trigger
I am trying to make it so that not all the units in my mission spawn at the start to increase performance for the server. However, i dont want it to just be random units placed around an area. IS there a way for me to place units and give them instructions to move etc. but have them spawn once a trigger is activated?
< >
16/6 megjegyzés mutatása
All units placed in the editor are created on mission start. There is no way to delay their creation.

However, you can modify created units so that they effectively do not exist. See:

https://community.bistudio.com/wiki/disableAI
https://community.bistudio.com/wiki/enableSimulation
https://community.bistudio.com/wiki/hideObject

Alternatively, you could create unit during the mission and give them waypoints using scripts. These functions are a good start:

https://community.bistudio.com/wiki/BIS_fnc_spawnGroup
https://community.bistudio.com/wiki/BIS_fnc_taskPatrol

Will these groups still move to garrison inside of buildings? I would rather not have a bunch of guys just sitting around a town.
The main idea is that In my mission i want to place soldiers in a town where the objective is to clear the town. Is there a way to make it so that the enemies spawn as Blufor moves into the town progressively, that way they are not all there from the start causing performance hits?

I don't think BIS_fnc_taskPatrol will send them into nearby buildings. There are patrol scripts that do, if you search around.

A simpler way is to just move each unit into a building using these commands:

https://community.bistudio.com/wiki/nearestObjects
https://community.bistudio.com/wiki/buildingPos
https://community.bistudio.com/wiki/setPosATL

For example, this function will create a group and place it in a nearby building randomly. Just define the function by copying it into an object's init field.

SpawnGroupBuilding = { private ["_spawnPos", "_opforGroup", "_nearBuildings", "_building"]; _spawnPos = _this select 0; _opforGroup = [_spawnPos, east, ["O_Soldier_F", "O_Soldier_F"]] call BIS_fnc_spawnGroup; _nearBuildings = nearestObjects [(leader _opforGroup), ["house"], 50]; _building = _nearBuildings select (floor random count _nearBuildings); _buildingPositions = 0; for "_i" from 0 to 100 do { if ([(_building buildingPos _buildingPositions), [0,0,0]] call BIS_fnc_areEqual) exitWith {}; _buildingPositions = _buildingPositions + 1; }; { _x setPosATL (_building buildingPos (round (random _buildingPositions))); _x setUnitPos "up"; doStop _x; } forEach (units _opforGroup); _opforGroup };

You can change the units that spawn by altering the array of classnames given to BIS_fnc_spawnGroup. You can also change the radius to search for houses on the 'nearestObjects' command. You could also give the position of an object with 'getPosATL'.

This is tested and working in a simple mission in the editor. If you placed a marker named "mkGarrison", you could call the function from a trigger like so:

0 = [(getMarkerPos "mkGarrison")] call SpawnGroupBuilding;
The Ares Mod has a built in "Garrison" Module
There are a few ways to spwn units in during missions.

The sites module you can set to true via a trigger (only works on local host) but it automaticly fills any of the metal shoothouses you place within the site.

Theres the spawn ai module you just sync a trigger to then delete (works for ds or local host) no building filling but good for getting a tank or apc spawned in. Or just some ground troops.

The spawn ai module is probs best. Just place and configure it how you want. It will continue to keep spawning units untill it hits its manpower cap then replace any that get killed. To activate it set up a trigger and sync it to the module. Then to stop it spawning units use another trigger with

Deletevehicle nameofmodule;

In the triggers init line :)
Legutóbb szerkesztette: Karmaterrorᵁᴷ; 2017. máj. 31., 0:24
< >
16/6 megjegyzés mutatása
Laponként: 1530 50

Közzétéve: 2014. febr. 10., 12:49
Hozzászólások: 6