Jump to content
TWRoach

How to solve Player effect the AI spawn unit

Recommended Posts

hello guys I used this script to spawn ai for my mission

but We found the player will effect the number of AI spawn

For example

 

1 palyer he spawn 1 Group  A total of 12 AI
2 player he spawn 2 Group  A total of 24 AI


script:

RED = [getMarkerPos "mgru", EAST, 12] call BIS_fnc_spawnGroup;

 

 

{

 

  
    removeAllWeapons _x;
    removeAllItems _x;
    removeAllAssignedItems _x;
    removeUniform _x;
    removeVest _x;
    removeBackpack _x;
    removeHeadgear _x;
    removeGoggles _x;
_x removeItem "NVGoggles";
_x unassignItem "NVGoggles";
 
 
    _x forceAddUniform "MNP_CombatUniform_China";
    _x addVest "MNP_Vest_ChinaH_T2";
    for "_i" from 1 to 17 do {_x addItemToVest "30Rnd_580x42_Mag_Tracer_F";};
    _x addBackpack "MNP_B_FieldPack_PLA_Basic";
    for "_i" from 1 to 4 do {_x addItemToBackpack "rhs_mag_rdg2_white";};
    for "_i" from 1 to 4 do {_x addItemToBackpack "rhs_mag_rgd5";};
    _x addHeadgear "MNP_Helmet_PAGST_CN";
 
 
    _x addWeapon "arifle_CTAR_blk_F";
    _x addPrimaryWeaponItem "acc_flashlight";
    _x enableGunLights "forceOn";
 
 
    _x linkItem "ItemMap";
    _x linkItem "ItemCompass";
    _x linkItem "ItemWatch";
    _x linkItem "ItemGPS";
} foreach units RED;
 
_waypoint0a = RED addwaypoint[getmarkerpos"wp1",0];
_waypoint0a setwaypointtype"Move"; 
_waypoint0a setWaypointSpeed "FULL";
_waypoint0a setWaypointFormation "NO CHANGE";
 
_waypoint1a = RED addwaypoint[getmarkerpos"wp2",0];
_waypoint1a setwaypointtype"Move"; 
_waypoint1a setWaypointSpeed "FULL";
_waypoint1a setWaypointFormation "NO CHANGE";
 
_waypoint2a = RED addwaypoint[getmarkerpos"wp3",0];
_waypoint2a setwaypointtype"Move"; 
_waypoint2a setWaypointSpeed "FULL"; 
_waypoint2a setWaypointFormation "NO CHANGE";
 
_waypoint3a = RED addwaypoint[getmarkerpos"wp4",0];
_waypoint3a setwaypointtype"Move"; 
_waypoint3a setWaypointSpeed "FULL"; 
_waypoint3a setWaypointFormation "NO CHANGE";
 
 
_waypoint4a = RED addwaypoint[getmarkerpos"wp5",0];
_waypoint4a setwaypointtype"SAD"; 
_waypoint4a setWaypointSpeed "FULL"; 
_waypoint4a setWaypointFormation "NO CHANGE";
 
 
[RED, 1] setWaypointCombatMode "RED";
[RED, 1] setWaypointBehaviour "AWARE";
[RED, 1] setWaypointTimeout [1, 1, 1];
 
 
anyone can help me?? or Provide better scripting I would appreciate it
sorry Bad English

Share this post


Link to post
Share on other sites

You wrote nothing about how you execute your code , i assume you are running it from init.sqf

if (isServer) then {

_RED = [getMarkerPos "mgru", EAST, 12] call BIS_fnc_spawnGroup;

{
    removeAllWeapons _x;
    removeAllItems _x;
    removeAllAssignedItems _x;
    removeUniform _x;
    removeVest _x;
    removeBackpack _x;
    removeHeadgear _x;
    removeGoggles _x;
    _x removeItem "NVGoggles";
    _x unassignItem "NVGoggles";
    _x forceAddUniform "MNP_CombatUniform_China";
    _x addVest "MNP_Vest_ChinaH_T2";
    for "_i" from 1 to 17 do {_x addItemToVest "30Rnd_580x42_Mag_Tracer_F";};
    _x addBackpack "MNP_B_FieldPack_PLA_Basic";
    for "_i" from 1 to 4 do {_x addItemToBackpack "rhs_mag_rdg2_white";};
    for "_i" from 1 to 4 do {_x addItemToBackpack "rhs_mag_rgd5";};
    _x addHeadgear "MNP_Helmet_PAGST_CN";
    _x addWeapon "arifle_CTAR_blk_F";
    _x addPrimaryWeaponItem "acc_flashlight";
    _x enableGunLights "forceOn";
    _x linkItem "ItemMap";
    _x linkItem "ItemCompass";
    _x linkItem "ItemWatch";
    _x linkItem "ItemGPS";
    
} foreach units _RED;
 
_waypoint0a = _RED addwaypoint[getmarkerpos "wp1",0];
_waypoint0a setwaypointtype "Move";  
_waypoint1a = _RED addwaypoint[getmarkerpos "wp2",1];
_waypoint1a setwaypointtype "Move";  
_waypoint2a = _RED addwaypoint[getmarkerpos "wp3",2];
_waypoint2a setwaypointtype "Move";
_waypoint3a = _RED addwaypoint[getmarkerpos "wp4",3];
_waypoint3a setwaypointtype "Move";  
_waypoint4a = _RED addwaypoint[getmarkerpos "wp5",4];
_waypoint4a setwaypointtype "SAD";

 {
    _x setWaypointCombatMode "RED";
    _x setWaypointBehaviour "AWARE";
    _x setWaypointTimeout [1, 1, 1];
    _x setWaypointFormation "NO CHANGE";
    _x setWaypointSpeed "FULL";
    
} forEach [_waypoint0a, _waypoint1a, _waypoint2a, _waypoint3a, _waypoint4a];
};
  • Like 1

Share this post


Link to post
Share on other sites

 

You wrote nothing about how you execute your code , i assume you are running it from init.sqf

if (isServer) then {

_RED = [getMarkerPos "mgru", EAST, 12] call BIS_fnc_spawnGroup;

{
    removeAllWeapons _x;
    removeAllItems _x;
    removeAllAssignedItems _x;
    removeUniform _x;
    removeVest _x;
    removeBackpack _x;
    removeHeadgear _x;
    removeGoggles _x;
    _x removeItem "NVGoggles";
    _x unassignItem "NVGoggles";
    _x forceAddUniform "MNP_CombatUniform_China";
    _x addVest "MNP_Vest_ChinaH_T2";
    for "_i" from 1 to 17 do {_x addItemToVest "30Rnd_580x42_Mag_Tracer_F";};
    _x addBackpack "MNP_B_FieldPack_PLA_Basic";
    for "_i" from 1 to 4 do {_x addItemToBackpack "rhs_mag_rdg2_white";};
    for "_i" from 1 to 4 do {_x addItemToBackpack "rhs_mag_rgd5";};
    _x addHeadgear "MNP_Helmet_PAGST_CN";
    _x addWeapon "arifle_CTAR_blk_F";
    _x addPrimaryWeaponItem "acc_flashlight";
    _x enableGunLights "forceOn";
    _x linkItem "ItemMap";
    _x linkItem "ItemCompass";
    _x linkItem "ItemWatch";
    _x linkItem "ItemGPS";
    
} foreach units _RED;
 
_waypoint0a = _RED addwaypoint[getmarkerpos "wp1",0];
_waypoint0a setwaypointtype "Move";  
_waypoint1a = _RED addwaypoint[getmarkerpos "wp2",1];
_waypoint1a setwaypointtype "Move";  
_waypoint2a = _RED addwaypoint[getmarkerpos "wp3",2];
_waypoint2a setwaypointtype "Move";
_waypoint3a = _RED addwaypoint[getmarkerpos "wp4",3];
_waypoint3a setwaypointtype "Move";  
_waypoint4a = _RED addwaypoint[getmarkerpos "wp5",4];
_waypoint4a setwaypointtype "SAD";

 {
    _x setWaypointCombatMode "RED";
    _x setWaypointBehaviour "AWARE";
    _x setWaypointTimeout [1, 1, 1];
    _x setWaypointFormation "NO CHANGE";
    _x setWaypointSpeed "FULL";
    
} forEach [_waypoint0a, _waypoint1a, _waypoint2a, _waypoint3a, _waypoint4a];
};

thanks this script work now! :) 

I customize the sqf file and use Triggers used to trigger

 

just Ask a question 

how to let spawn AI get in vehicle and go to waypoint? 

 

Share this post


Link to post
Share on other sites

Spawn vehicle group using Bis_fnc_spawnGroup

or use Bis_fnc_spawnVehicle

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

×