Jump to content
Sign in to follow this  
skinbone

[HELP] Uniform Variation Script Initialization

Recommended Posts

I've been trying to get a script to work that will set a unit's uniform, etc. based on a predefined list of classnames. I'm trying to get it to work on a unit made with ALiVE's ORBAT Creator.

 

The script seems to run fine, and I can see the random clothing applied to the unit for a second when it's spawned in, but soon after the loadout is replaced by the one saved in ALiVE.

 

I'm not very experienced with scripting or writing configs for Arma 3, but could this have something to do with the order the scripts are being initialized?

 

Here's an excerpt from the faction file showing how I'm initializing the script:

        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];};";
            };
		init = "call script_fnc_randomize;";  
        };
        // custom attributes (do not delete)
        ALiVE_orbatCreator_owned = 1;

    };

 

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
Sign in to follow this  

×