Jump to content

Recommended Posts

Posted (edited)

Estoy creando intentando un script para crear una patrulla aleatoriamente pero cuando comienzo la misión me sale que randomPatrol.sqf no se encuentra. A ver si alguien sabe por qué. Gracias de antemano.

// randomPatrol.sql
// Configuración
private _patrolCenter = getMarkerPos "patrolCenter";
private _radius = 300; // Radio del área de patrulla
private _numSoldiers = 5; // Número de soldados a generar

// Clase de unidad del FFAA Mod
private _unitClass = "ffaa_s_Inf_Fusilero";

// Crear grupo
private _patrolGroup = createGroup east; // Cambia "east" si usas otra facción

// Generar soldados y asignarles waypoints aleatorios
for "_i" from 1 to _numSoldiers do {
    // Generar posición aleatoria dentro del radio
    private _pos = _patrolCenter getPos [random _radius, random 360];

    // Crear unidad
    private _unit = _patrolGroup createUnit [_unitClass, _pos, [], 0, "FORM"];

    // Asignar comportamiento y velocidad
    _unit setBehaviour "SAFE";
    _unit setSpeedMode "LIMITED";

    // Crear waypoints aleatorios
    for "_j" from 1 to 3 do {
        private _wpPos = _patrolCenter getPos [random _radius, random 360];
        private _wp = _patrolGroup addWaypoint [_wpPos, 0];
        _wp setWaypointType "MOVE";
    };
};

// Añadir ciclo de patrullaje
private _cycleWp = _patrolGroup addWaypoint [_patrolCenter, 0];
_cycleWp setWaypointType "CYCLE";


 


 


    
    
    

    
       

    

    
         
        
         
    



 
// init.sql
execVM "randomPatrol.sqf";

Olvidé poner las notas en inglés. Soy español y paso los archivos a otros editores de misiones.

Edited by jordisillero4
the code was not seen

Share this post


Link to post
Share on other sites

write in SQF     not SQL or SQLF

 

You script must have a little improvement:
 

private _patrolCenter = getMarkerPos "patrolCenter";
private _radius = 300;
private _numSoldiers = 5;
private _unitClass = "O_soldier_f";
private _patrolGroup = createGroup east;

private _initPatrolPos = _patrolCenter getPos [sqrt random 1 * _radius, random 360];
for "_i" from 1 to _numSoldiers do {
  private _unit = _patrolGroup createUnit [_unitClass, _initPatrolPos getpos [2* _i, [135,225] select (_i mod 2)] , [], 0, "FORM"];
  [_unit] joinSilent _patrolGroup;
  _unit setBehaviour "SAFE";
};

for "_i" from 1 to 3 do {
  private _wpPos = _patrolCenter getPos [sqrt random 1 * _radius, random 360];
  private _wp = _patrolGroup addWaypoint [_wpPos, 0];
  _wp setWaypointType "MOVE";
};
private _cycleWp = _patrolGroup addWaypoint [_initPatrolPos, 0];
_cycleWp setWaypointType "CYCLE";

 

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

×