- La función BIS_fnc_relPos para dar posiciones relativas dentro de un rango al spawnear enemigos, añadirles un circuito de waypoints
- Añadir las unidades spawneadas al Zeus addCuratorEditableObjects
- Chequear si un edificio es apto para ocupar BIS_fnc_isBuildingEnterable y la ocupación de un edificio tal vez te sirva <A2>DPD
Código: Seleccionar todo
// Defines
#define STAGE_ID "infantry"
#define TASK_ID "BIS_infantry_challenge_10"
#define WAYPOINT_POSITION "BIS_engagment"
#define WAYPOINT_RADIUS 150
#define TASK_MARKER_IMAGE "a3\Ui_f\data\Map\MapControl\taskIcon_ca.paa"
#define ENEMY_POSITION "BIS_engagment"
#define ENEMY_RADIUS 100
#define ENEMY_GROUP_PATROL "OIA_InfSentry"
#define ENEMY_GROUP_GUARDS "OIA_InfSentry"
#define CHALLENGE_TIMEOUT 1200
#define CHALLENGE_TIMEOUT_ID "BIS_challenge_timeout_id"
// The group that patrols the area
private "_patrolGroup";
_patrolGroup = [getMarkerPos ENEMY_POSITION, EAST, configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> ENEMY_GROUP_PATROL] call BIS_fnc_spawnGroup;
// Patrol the area
for "_i" from 0 to 2 do {
private "_waypoint";
_waypoint = _patrolGroup addWaypoint [[getMarkerPos ENEMY_POSITION, random ENEMY_RADIUS, random 360] call BIS_fnc_relPos, 0];
_waypoint setWaypointBehaviour "AWARE";
_waypoint setWaypointCombatMode "RED";
_waypoint setWaypointSpeed "LIMITED";
if (_i < 2) then {
_waypoint setWaypointType "MOVE";
} else {
_waypoint setWaypointType "CYCLE";
};
};
// The group that stays inside buildings and guards the area
private "_guardsGroup";
_guardsGroup = [getMarkerPos ENEMY_POSITION, EAST, configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> ENEMY_GROUP_GUARDS] call BIS_fnc_spawnGroup;
// The near buildings
private "_buildings";
_buildings = getMarkerPos ENEMY_POSITION nearObjects ["House", ENEMY_RADIUS];
// The enter-able buildings
private "_enterableBuildings";
_enterableBuildings = [];
// Filter buildings by validating only those that are enter-able
{
if ([_x, count units _guardsGroup] call BIS_fnc_isBuildingEnterable) then {
_enterableBuildings set [count _enterableBuildings, _x];
};
} forEach _buildings;
// All position from all enter-able buildings we have so far
private "_totalPositions";
_totalPositions = [];
// get the buildings positions
{
_totalPositions = _totalPositions + ([_x] call BIS_fnc_buildingPositions);
} forEach _enterableBuildings;
// Flush the list of positions
private "_positions";
_positions = _totalPositions call BIS_fnc_arrayShuffle;
// Resize to match the number of units in the group
_positions resize count units _guardsGroup;
// Set each unit of the group to a selected position in a selected building
for "_i" from 0 to ((count units _guardsGroup) - 1) do {
private ["_unit", "_position", "_direction"];
_unit = units _guardsGroup select _i;
_position = _positions select _i;
_direction = random 360;
_unit setDir _direction;
_unit setFormDir _direction;
_unit setPos _position;
_unit setUnitPos "UP";
doStop _unit;
};
// The enemy groups
BIS_infantry_enemyGroups = [_patrolGroup, _guardsGroup];
// Some basic properties
{
_x allowFleeing 0;
_x enableAttack false;
// Skill
{ _x setSkill 0.25; } forEach units _x;
// We need to make these units editable by the Instructor
BIS_curator addCuratorEditableObjects [units _x, true];
} forEach BIS_infantry_enemyGroups;