tough script snippet question

  1. 7 years ago

    I am using the script snippet "Adding Custom Inits to Spawned Units" in the ALIVE wikki to do a custom load out for spawned units using RHS Russian troops (msv). I need to make just the RPG and rocket launching troops way less accurate. Is there a way to add a line into the script using the "aiming accuracy sub skill" settings for just these types of units?

  2. Edited 7 years ago by Whigital

    Correct me if im wrong, but i think the ALiVE AISkill module use the "Man" class Init XEH to set the unit skills, so you have to delay your script so it doesn't get overwritten.

    I would tackle this with a script that for one, checks if its a unit/vehicle that actually needs its skills changed, and two, spawns some code with delay for that unit/vehicle.

    setSkill_MSV_AT.sqf

    params ["_unit"];
    
    private ["_type", "_typeList"];
    
    
    // Units with RPGs in rhs_faction_msv
    
    _typeList =
    [
    	"rhs_msv_emr_at",
    	"rhs_msv_emr_grenadier_rpg",
    	"rhs_msv_at",
    	"rhs_msv_grenadier_rpg"
    ];
    
    
    // Get type of unit spawned
    
    _type = (typeOf _unit);
    
    
    // If unit is in above list, spawn code with delay to lower "aimingAccuracy" ....
    
    if (_type in typeList) then
    {
    	_null = [_unit] spawn
    	{
    		params ["_unit"];
    
    		private ["_aim", "_aimMod"];
    
    		waitUntil {!isNull _unit};
    
    		sleep 10;
    
    		_aim = _unit skill "aimingAccuracy";
    
    		_aimMod = (_aim * 0.3);
    
    		_unit setskill ["aimingAccuracy", _aimMod];
    	};
    };

    Then call it as usual in in the XEH "Man" Init

    class Extended_Init_EventHandlers
    {
    	class Man
    	{
    		init = "_this call (compile preprocessFileLineNumbers 'setSkill_MSV_AT.sqf')";
    	};
    };

    No guarantee the code works, but should point you in the right/some direction .....

 

or Sign Up to reply!