Comrades in Arms Discussion Board

Full Version: Scripting (No Discussion, just posts)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
@Alwarren
Most scripts have 2 components, one running on server side and another on client, some scripts might have just one component depending on what it has to do. From what i've seen in my tests/missions and in other people missions they have small impact on frames if used correctly. HC is taken in account.
Particles are not set to have an impact on AI vision to avoid server lag, fog has the default impact on AI vision, i usually tweak AI skills in missions where i use vision obstructive particles to simulate the impact on AI vision.
Adjusted NVG script

http://www.armaholic.com/page.php?id=25920

Can just be added to your mission, so no need for Mods
Here's a script I wrote for making HALO jumps while preserving backpacks (it's attached to the belly while jumping).

I used it like this in init.sqf:

Code:
FHQ_halo = compile preprocessFileLineNumbers "scripts\halo.sqf";
if (isServer) then {
       _startPos = getMarkerPos "start_marker";
       _startPos set [2, 3000];
       {
           private _scatter =  [(random 20) - 10, (random 20) - 10, (random 20) - 10];    
        if (_x == leader group _x) then {
           [_x, _startPos vectorAdd _scatter, _radio] remoteExec ["FHQ_halo", _x];
           } else {
            [_x, _startPos vectorAdd _scatter] remoteExec ["FHQ_halo", _x];
        };
    } foreach playableUnits;
};

This will have all playableUnits start around the marker _start_marker, at a height of 3000
Hey friends! I was toying around with some scripts, decided to take a shot at making one of my own. It uses a similar structure to FHQ ace loadout function. It basically adds ACE medical supplies to the unit it is called for (amount based on the number given 1-5) and gives the medic trait if they don't already have it.

It is called like so

Code:
"[UnitVariable, (1-5)] call compile preprocessFileLineNumbers "AceMedicKit.sqf";"

The idea is to add medical supplies to medics without creating an ace dependency if you don't want it.

Note: Have not tested on dedicated yet!
Hey friends, this script will add equipment to all roles. Entrenching tools, clackers, medical supplies, tripods, rangecards, etc. You can read into the script to see the exact conditions and items added, or adjust them as you need.

Simply copy into your initserver.sqf:

Code:
{
    if (!isClass (configFile >> "CfgMods" >> "ace")) exitWith {};
    
    _isMG = getText(configFile >> "CfgWeapons" >> primaryWeapon _x >> "cursor") == "mg";
    _isMarksman = getText(configFile >> "CfgWeapons" >> primaryWeapon _x >> "cursor") == "srifle";
    _isMedic = _x getUnitTrait "Medic";
    _isEngineer = _x getUnitTrait "engineer";
    _isEOD = _x getUnitTrait "explosiveSpecialist";
    
    _x addItem "ACE_Flashlight_XL50";
    _x addItem "ACE_EarPlugs";
    
    if (_isMG) then {
        _x addItem "ACE_SpareBarrel";
    };
    
    if (_isMarksman) then {
        _x addItem "ACE_Tripod";
        _x addItem "ACE_RangeCard";
    };
    
    if ((_isEOD) OR (_isEngineer)) then {
        _x addItem "ACE_Clacker";    
        _x addItem "ACE_DefusalKit";
    };
    
    if (_x getUnitTrait "Medic") then {
        for "_i" from 1 to 10 do {_x addItem "ACE_fieldDressing"};
        for "_i" from 1 to 10 do {_x addItem "ACE_packingBandage"};
        for "_i" from 1 to 3 do {_x addItem "ACE_bloodIV"};
        for "_i" from 1 to 3 do {_x addItem "ACE_salineIV"};
        for "_i" from 1 to 3 do {_x addItem "ACE_epinephrine"};
        for "_i" from 1 to 7 do {_x addItem "ACE_morphine"};
        for "_i" from 1 to 3 do {_x addItem "ACE_splint"};
        for "_i" from 1 to 3 do {_x addItem "ACE_bloodIV_500"};
        for "_i" from 1 to 3 do {_x addItem "ACE_salineIV_500"};
    };

    if (!(_isMG) AND !(_isMarksman) AND !(_isMedic) AND !(_isEOD) AND !(_isEngineer) AND (leader group _x != _x)) then {
        _x addItem "ACE_EntrenchingTool";
    };
} forEach allUnits;
Suicide Car Bomb script

Throw the functions below into a game logic in the editor. 

Suicide bomb script:

Add this to the unit group/composition init and make sure they are driving a vehicle:

Code:
_nul = leader this spawn Bomb_car_explode_fnc;
Code:
Bomb_car_explode_fnc = {  
  waitUntil { 
    (!alive driver _this) || !canMove _this ||  
    (({((_this distance2D _x) <= 10) && alive _x && side _x == WEST} count allUnits) > 0) 
   }; 
  _bomb = "BO_GBU12_LGB" createVehicle [(getPosATL _this select 0), (getPosATL _this select 1), 0]; 
  _bomb setVelocity [0,0,-200];
};


Car charging at units script: 

Add this to the unit group/composition init or call it from a trigger to order the specified suicide bomb truck to start driving towards players (replace <group_name> with the actual group's name:

Code:
_nul = <group_name> spawn Bomb_car_charge_fnc;
Code:
Bomb_car_charge_fnc = {
 _target = "";
 _huntable = [];
 {
   if (alive _x && side _x == WEST) then {_huntable pushBack _x;};
 } foreach allunits;
 _target = selectRandom _huntable;
 _wp = _this addWaypoint [getPos _target, 0];
 _wp setWaypointType "MOVE";
 _wp setWaypointCombatMode "YELLOW";
 _wp setWaypointBehaviour "CARELESS";
 _wp setWaypointSpeed "FULL";
 _wp setWaypointStatements ["true", "_null = (group this) spawn Bomb_car_charge_fnc;"];
};

Example mission included in post.

Note that if you want to make the suicide car bombs charge at units that you can change WEST to EAST or RESISTANCE if you want suicide car bombs to charge at those factions instead. You can replace allUnits with playableUnits + switchableUnits or your own custom array if you want suicide car bombs to only target players or specified units as well.
The attached sample mission demonstrates how to check exfiltration for players, accounting for multiple groups, players in vehicles, alive players, etc. It offers different versions of exfiltration, like all players in one specific trigger, all players in any one trigger, or players distributed among exfil triggers. 

It's a "simple" version without the use of external scripts (except something needed in init.sqf).

Pick the trigger (of the bottom three) that fits your need, modify the trigger names, and set the trigger to be non-repeatable.

More information is provided in comment nodes.
Pages: 1 2 3