Advanced Tutorial

From ALiVE Wiki
Jump to: navigation, search

These are some advanced editing techniques for adding third part functionality to your faction after exporting from Orbatron. Many thanks to Fynn for the guide.

Randomized Gear

To get randomized gear on your units you need to add this (example gear: https://pastebin.com/9vD97GDb) to the unit you want to use the gear (add it below the "ALiVE_orbatCreator_loadout" section). The numbers below the class of the gear are probabilities. You also need to insert under "class ALiVE_orbatCreator"

[_this] call CFP_main_fnc_randomizeUnit;
between
_this setunitloadout _loadout;
and
reload _this
so it looks like this:
_this setunitloadout _loadout;[_this] call CFP_main_fnc_randomizeUnit; reload _this


Disclaimer: it looks like it actually uses a community factions project (CFP) function so you may need to have that mod loaded for it to work correctly.

If you have a bunch of units you want to all randomize from the same set of gear you can just make sure that you use the unit with the gear list defined as your base so you don't have to re-add this list every time. If you use one of your own units as a base you don't need the wholesection at the bottom of your unit, so just remove all of the following:

class EventHandlers: EventHandlers
        {
            class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers_base {};
            class ALiVE_orbatCreator
            {
                init = "if (local (_this select 0)) then {_onSpawn = {_this = _this select 0;sleep 0.2; _backpack = gettext(configfile >> 'cfgvehicles' >> (typeof _this) >> 'backpack'); waituntil {sleep 0.2; backpack _this == _backpack};if !(_this getVariable ['ALiVE_OverrideLoadout',false]) then {_loadout = getArray(configFile >> 'CfgVehicles' >> (typeOf _this) >> 'ALiVE_orbatCreator_loadout'); _this setunitloadout _loadout;reload _this};};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";
            };
        };
        ALiVE_orbatCreator_owned = 1;


Full example of 2 units with one using the other as base: https://pastebin.com/5hExEApY.


Icons and classes

Add these at the start of your unit somewhere under "display name". To get your units to be EOD, Engineer or Medic you need to add these to your unit:

  • Medic: attendant=1;
  • EOD: canDeactivateMines=1;
  • Engineer: Engineer=1;

To get the right icons in the editor and your squad overview add these:

  • icon = "iconManExplosive";
  • icon = "iconMan";
  • icon = "iconManEngineer";
  • icon = "iconManMG";
  • icon = "iconManAT";
  • icon = "iconManLeader";

You can also add these to make your AI units call out "Sniper", "Machine Gunner", "Anti-tank" (only include one for each unit, obviously)

textSingular = "$STR_A3_nameSound_veh_infantry_sniper_s";
textPlural = "$STR_A3_nameSound_veh_infantry_sniper_p";
nameSound = "veh_infantry_sniper_s"; 
 
textSingular = "$STR_A3_nameSound_veh_infantry_MG_s";
textPlural = "$STR_A3_nameSound_veh_infantry_MG_p";
nameSound = "veh_infantry_MG_s";
 
textSingular = "$STR_A3_nameSound_veh_infantry_AT_s";
textPlural = "$STR_A3_nameSound_veh_infantry_AT_p";
nameSound = "veh_infantry_AT_s";


Ace vehicle compatibility

To get your vehicles working with ACE you need to add these options.

Fueltruck, you might need to adjust the positions of the hooks so they don't float. You can edit them in the editor to quickly preview without needing to reload the mod every time, I assume the transportfuel=0; part is to disable vanilla refuelling

transportFuel=0;
ace_refuel_hooks[]=
    {
        {1.3,-1.59,-0.62},
        {-1.16,-1.59,-0.62}
    };
ace_refuel_fuelCargo=10000;


To add rearm, repair, cargo or medic ability to vehicles, the following:

  • ace_rearm_defaultSupply=1200;
  • ace_repair_canRepair=1;
  • ace_cargo_space=20;
  • ace_refuel_fuelCapacity=1400;
  • attendant=1; (Medical vehicle)