Jump to content
  • 0

Searching for AI Spawn Paradrop (addition to blckeagls-ai-mission-version)


Dadalusi

Question

Hey there!

 

I want to know if its possible to make an AI Paradrop. Like spawn one chopper at coordinates XYZ1, make some AI. Let those AI get in the chopper. Fly to position XYZ2 and drop off AI there.

 

Me would be happy if i would have such piece of code inside an SQF function to call it from an server sides mission script which we already have working (We modified the one from bit)

 

We have two lines of code which will wait if a player is near of 10m from a lootbox inside one of the missions

// Waits until player gets near the _crate to end mission
waitUntil{{isPlayer _x && _x distance _crate < 10} count playableunits > 0};

What i want to achieve is to extend it so, that there is a second "eventHandler" which will spawn those paradrop at the given coordinates.:

// Coordinates are saved by
_coords = [mapCenter,300,mapRange,30,0,10,0] call BIS_fnc_findSafePos;

_conditionMet = distance _crate < 5; // Need some magic from your guys here
_conditionMet = {
    // Need More SQF magic from your guys here inside function.sqf
    // spawn paradrop[_coords] "mightyParaDropfunction.sqf"
};

From BLCKEagls AI Mission script there are few examples on how to spawn AI.

_safepos = [_pos,0,27,0,0,20,0] call BIS_fnc_findSafePos;
_veh = ObjNull;
_veh = createVehicle[_missionCar3, _safepos, [], 0, "NONE"];
_veh setVariable["LASTLOGOUT_EPOCH",1000000000000];
_veh setVariable["LAST_CHECK",1000000000000];
_ai4 moveInAny _veh;
_ai5 moveInAny _veh;
EPOCH_VehicleSlotsLimit = EPOCH_VehicleSlotsLimit + 1;
EPOCH_VehicleSlots pushBack str(EPOCH_VehicleSlotsLimit);
_slot = EPOCH_VehicleSlots select 0;
_veh setVariable ['VEHICLE_SLOT',_slot,true];
EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot];
EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots;
publicVariable 'EPOCH_VehicleSlotCount';
_veh call EPOCH_server_setVToken;
clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
clearBackpackCargoGlobal _veh;
clearItemCargoGlobal _veh;

BTW. We modified the marker in debug/addmarker*.sqf like so:

// green mission
_MainMarker = createMarker ["MainMarker", Ccoords];
_MainMarker setMarkerColor "ColorGreen";
_MainMarker setMarkerShape "ELLIPSE";
_MainMarker setMarkerBrush "Solid";
_MainMarker setMarkerAlpha 0.8;
_MainMarker setMarkerSize [600,600];

_MainMarkerTxt = createMarker ["MainMarkerTxt", Ccoords];
_MainMarkerTxt setMarkerBrush "Solid";
_MainMarkerTxt setMarkerColor "ColorBlack";
_MainMarkerTxt setMarkerShape "ICON";
_MainMarkerTxt setMarkerType "mil_dot";
_MainMarkerTxt setMarkerText "Easy Mission";

To have a single black dot in the mission centre plus mission text and colored the mission "green" to be a green/an easy mission.

 

Also we added few variables to spawnVehicle.sqf to maintain a different vehicle list per mission. modified like so:

private ["_missionCar1", "_missionCar2", "_missionCar3", "_missionColor"];

_missionCar1 = "B_G_Offroad_01_armed_F";
_missionCar2 = "B_G_Offroad_01_armed_F";
_missionCar3 = "B_G_Offroad_01_armed_F";

switch (_missionColor) do
{
    case "green":
    {
        _missionCar1 = "B_G_Offroad_01_armed_F";
        _missionCar2 = "B_G_Offroad_01_armed_F";
        _missionCar3 = "B_G_Offroad_01_armed_F";
    };

    case "blue":
    {
        _missionCar1 = "B_G_Offroad_01_armed_F";
        _missionCar2 = "B_G_Offroad_01_armed_F";
        _missionCar3 = "B_G_Offroad_01_armed_F";
    };

    case "orange":
    {
        _missionCar1 = "B_G_Offroad_01_armed_F";
        _missionCar2 = "B_MRAP_01_gmg_F";
        _missionCar3 = "B_G_Offroad_01_armed_F";
    };

    case "red":
    {
        _missionCar1 = "I_APC_Wheeled_03_cannon_F";
        _missionCar2 = "O_Heli_Attack_02_F";
        _missionCar3 = "O_Heli_Light_02_F";
    };
};

Additionally i did some magic to init.sqf from the mission system to have random loot

// Lootbox grün (easy)
blck_FillBoxes_Major = {
    private["_crate","_Weapons","_mags","_cfgweapons","_weapon","_plx","_mag","_mags","_allweap","_box"];
    _crate = _this select 0;
    clearWeaponCargoGlobal _crate;
    clearMagazineCargoGlobal _crate;

    // fixed mission loot
    _crate addMagazineCargoGlobal ["CinderBlocks",15];
    _crate addWeaponCargoGlobal ["LMG_Mk200_F",1];

    // specific mission loot
    _x = 0;
    for "_x" from 0 to 15 do {
        _randomitem = nil;
        _randomitem = blck_LootList_MajorItems select(floor(random count blck_LootList_MajorItems));
        _crate addMagazineCargoGlobal [_randomitem, random 2];
    };

    // globl loot (water, drinks, paint cans and so..)
    _x = 0;
    for "_x" from 0 to 5 do {
        _randomitem = nil;
        _randomitem = blck_LootList_GlobalItems select(floor(random count blck_LootList_GlobalItems));
        _crate addMagazineCargoGlobal [_randomitem, 1];
    };
};
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...