Jump to content
  • 0

EMS mission


robbiedarza

Question

Hi i am trying to increase the number of ai spawns at the ikea mission and im not sure where i need to change

 

is it in here somewhere                    DZMSAISpawn.sqf

 

 /*                                                                        //
    DZMSAISpawn.sqf by Vampire
    Usage: [position,unitcount,skillLevel] execVM "dir\DZMSAISpawn.sqf";
        Position is the coordinates to spawn at [X,Y,Z]
        UnitCount is the number of units to spawn
        SkillLevel is the skill number defined in DZMSAIConfig.sqf
*/                                                                        //
private ["_position","_unitcount","_skill","_wpRadius","_xpos","_ypos","_unitGroup","_aiskin","_unit","_weapon","_magazine","_wppos1","_wppos2","_wppos3","_wppos4","_wp1","_wp2","_wp3","_wp4","_wpfin","_unitArrayName","_unitMissionCount"];
_position = _this select 0;
_unitcount = _this select 1;
_skill = _this select 2;
_unitArrayName = _this select 3;

//diag_log text format ["[EMS]: AI Pos:%1 / AI UnitNum: %2 / AI SkillLev:%3",_position,_unitcount,_skill];

_wpRadius = 20;

_xpos = _position select 0;
_ypos = _position select 1;

//Create the unit group. We use east by default.
_unitGroup = createGroup east;

//Probably unnecessary, but prevents client AI stacking
if (!isServer) exitWith {};

for "_x" from 1 to _unitcount do {

    //Lets pick a skin from the array
    _aiskin = DZMSBanditSkins call BIS_fnc_selectRandom;
    
    //Lets spawn the unit
    _unit = _unitGroup createUnit [_aiskin, [(_position select 0),(_position select 1),(_position select 2)], [], 10, "PRIVATE"];
    
    //Make him join the correct team
    [_unit] joinSilent _unitGroup;
    
    //Add the behaviour
    _unit enableAI "TARGET";
    _unit enableAI "AUTOTARGET";
    _unit enableAI "MOVE";
    _unit enableAI "ANIM";
    _unit enableAI "FSM";
    _unit setCombatMode "YELLOW";
    _unit setBehaviour "COMBAT";
    
    //Remove the items he spawns with by default
    removeAllWeapons _unit;
    removeAllItems _unit;
    
    //Now we need to figure out their loadout, and assign it
    
    //Get the weapon array based on skill
    _weaponArray = [_skill] call DZMSGetWeapon;
    
    _weapon = _weaponArray select 0;
    _magazine = _weaponArray select 1;
    
    //diag_log text format ["[EMS]: AI Weapon:%1 / AI Magazine:%2",_weapon,_magazine];
    
    //Get the gear array
    _aigearArray = [DZMSGear0,DZMSGear1,DZMSGear2,DZMSGear3,DZMSGear4];
    _aigear = _aigearArray call BIS_fnc_selectRandom;
    _gearmagazines = _aigear select 0;
    _geartools = _aigear select 1;
    
    //Gear the AI backpack
    _aipack = DZMSPacklist call BIS_fnc_selectRandom;

    //Lets add it to the Unit
    for "_i" from 1 to 3 do {
        _unit addMagazine _magazine;
    };
    _unit addWeapon _weapon;
    _unit selectWeapon _weapon;
    
    _unit addBackpack _aipack;
    
    if (DZMSUseNVG) then {
        _unit addWeapon "NVGoggles";
    };
    
    {
        _unit addMagazine _x
    } forEach _gearmagazines;
    
    {
        _unit addWeapon _x
    } forEach _geartools;
    
    _aicskill = DZMSSkills1;
    
    //Lets set the skills
    switch (_skill) do {
        case 0: {_aicskill = DZMSSkills0;};
        case 1: {_aicskill = DZMSSkills1;};
        case 2: {_aicskill = DZMSSkills2;};
        case 3: {_aicskill = DZMSSkills3;};
    };
    
    {
        _unit setSkill [(_x select 0),(_x select 1)]
    } forEach _aicskill;
    
    //Lets prepare the unit for cleanup
    _unit addEventHandler ["Killed",{ [(_this select 0), (_this select 1)] ExecVM DZMSAIKilled; }];
    _unit setVariable ["DZMSAI", true];
};

//Lets give a launcher if enabled
//The last _unit should still be defined from the FOR above
if (DZMSUseRPG) then {
    _unit addWeapon "RPG7V";
    _unit addMagazine "PG7V";
    _unit addMagazine "PG7V";
};

// These are 4 waypoints in a NorthSEW around the center
_wppos1 = [_xpos, _ypos+20, 0];
_wppos2 = [_xpos+20, _ypos, 0];
_wppos3 = [_xpos, _ypos-20, 0];
_wppos4 = [_xpos-20, _ypos, 0];

// We add the 4 waypoints
_wp1 = _unitGroup addWaypoint [_wppos1, _wpRadius];
_wp1 setWaypointType "MOVE";
_wp2 = _unitGroup addWaypoint [_wppos2, _wpRadius];
_wp2 setWaypointType "MOVE";
_wp3 = _unitGroup addWaypoint [_wppos3, _wpRadius];
_wp3 setWaypointType "MOVE";
_wp4 = _unitGroup addWaypoint [_wppos4, _wpRadius];
_wp4 setWaypointType "MOVE";

// Then we add a center waypoint that tells them to visit the rest
_wpfin = _unitGroup addWaypoint [[_xpos,_ypos, 0], _wpRadius];
_wpfin setWaypointType "CYCLE";

//diag_log text format ["[EMS]: Spawned %1 AI at %2",_unitcount,_position];

// load the unit groups into a passed array name so they can be cleaned up later
call compile format["%1 = %1 + (units _unitGroup); _unitMissionCount = count %1;",_unitArrayName];

diag_log text format["[EMS]: (%3) %1 AI Spawned, %2 units in mission.",count (units _unitGroup),_unitMissionCount,_unitArrayName];

Robbie

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

This is the wrong file to do that. They are listed in each mission file. That mission files then calls the file you have posted above for config of the AI.

 

I don't have the files to hand but, you need to be looking in the files in the missions folder called SM1, SM2, SM3 etc. Then find the blocks that end in call DZMSAISpawn.sqf (the file you posted above).

 

In those blocks you will see the coords first, then the number of AI.

 

If you can, post one of those blocks here and I'll tell you which number to change.

Link to comment
Share on other sites

  • 0

Hi mate, thanks for the reply, heres the sm6 ikea mission one

[spoiler]

/*
	Medical Ural Attack by lazyink (Full credit for original code to TheSzerdi & TAW_Tonic)
	Updated to New Format by Vampire
*/

private ["_missName","_coords","_crash","_vehicle","_vehicle1","_crate","_crate2"];

//Name of the Mission
_missName = "IKEA Truck";
diag_log format["[EMS]: Major SM6 IKEA Truck Mission has started."];

//DZMSFindPos loops BIS_fnc_findSafePos until it gets a valid result
_coords = call DZMSFindPos;

[nil,nil,rTitleText,"An IKEA construction truck has crashed, locate the crash and loot the truck!", "PLAIN",10] call RE;

//DZMSAddMajMarker is a simple script that adds a marker to the location
[_coords,_missname] execVM DZMSAddMajMarker;

//We create the scenery
_crash = createVehicle ["UralWreck",_coords,[], 0, "CAN_COLLIDE"];
[_crash] call DZMSProtectObj;

//We create the vehicles like normal
_vehicle = createVehicle ["UAZ_MG_TK_EP1",[(_coords select 0) + 20, (_coords select 1) - 5,0],[], 0, "CAN_COLLIDE"];

//DZMSSetupVehicle prevents the vehicle from disappearing and sets fuel and such
[_vehicle] call DZMSSetupVehicle;

_crate = createVehicle ["MedBox0",[(_coords select 0) - 6, _coords select 1,0],[], 0, "CAN_COLLIDE"];
[_crate,"medical"] execVM DZMSBoxSetup;
[_crate] call DZMSProtectObj;

_crate2 = createVehicle ["USVehicleBox",[(_coords select 0) - 10, _coords select 1,0],[], 0, "CAN_COLLIDE"];
[_crate2,"supply"] execVM DZMSBoxSetup;
[_crate2] call DZMSProtectObj;


[[(_coords select 0) - 0.5635,(_coords select 1) + 0.3173,0],3,1,"DZMSUnitsMajor"] call DZMSAISpawn;
sleep 5;

[_coords,"DZMSUnitsMajor"] call DZMSWaitMissionComp;



//Call DZMSSaveVeh to attempt to save the vehicles to the database
//If saving is off, the script will exit.
 
 

[nil,nil,rTitleText,"Survivors have secured the IKEA truck, Ingvar Kamprad is mighty pleased!", "PLAIN",6] call RE;
diag_log format["[EMS]: Major SM6 IKEA Truck Mission has Ended."];
deleteMarker "DZMSMajMarker";
deleteMarker "DZMSMajDot";

//Let the timer know the mission is over
DZMSMajDone = true;

[/spolier]

cheers

 

robbie

cheers

 

 

Robbie

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...