Jump to content

mcnools

Member
  • Content Count

    1156
  • Joined

  • Last visited

  • Medals

Posts posted by mcnools


  1. Thanks for the replies, I will give it a try!

     

    Couldn't find suitable animations so I made a little workaround. I hide the unit inside a room with a pistol in his hand and when anyone gets nere it this script executes:

     

    unit1 fire currentMuzzle unit1;
    sleep 0.2;
    unit1 setDamage 1;

     

    That way we hear a gunshot when we approach and he's dead when we enter the room, seems to work okay!

    • Like 1

  2. Ok, this is pretty grim, but I'm working a mission where a AI-unit is supposed to shoot himself rather than get captured etc, I've searched far and wide for a script but I haven't found anything that works. Does anyone know of a script for this? I do believe that there are animations for this ingame but maybe I'm mistaken. Best thing would be if the script is activated when we close in on the unit, it plays the animation and the gun fires, killing the unit.


  3. 6 hours ago, JCataclisma said:

    Are you planning to do that for a specific class, let's say, only for pilots?
    Or maybe only for a specific SteamID whether in MP?
    .
    EDIT:
    But as you mentioned "one specific playable unit", your idea is to do that for a specific unit name, correct?

     

    Yes, the idea is to do it for a specific unit name, I've given all the units in our squad ID's (the one who should be able to open the crate is RadioOperator).


  4. Well, it seems I might have managed to solve it in the end. I "simply" mashed the scripts together and added the skill-level stuff into the loadout script and it seems to be working (might have faults that will appear later though). Figured I'd post it all here so it's available to anyone looking to do the same thing.  Big thanks to Larrow, couldn't have done it without you!

     

    initserver.sqf

    Spoiler
    
    //initServer.sqf
    //include function
    
    _handle = [] execVM "onTrackerSpawn.sqf";
    _handle = [] execVM "customizeTrackerLoadout.sqf";
    
    waitUntil{ scriptDone _handle };
    
    //Tell the monitoring function the Module to monitor, the Function to call when new units are spawned by the module
    [ Trackermodule1, vet_fnc_customizeTrackerLoadout] call vet_fnc_onTrackerSpawn;

     

    onTrackerSpawn.sqf

    Spoiler
    
    /*
        Author: veteran29
        Description:
            Execute custom callback on groups spawned by the Tracker Area module.
        Parameter(s):
            _module       - Tracker Area module [OBJECT]
            _fnc_callback - Function to execute on newly created groups, arguments passed to the callback are: [_group, _module] [CODE]
            _interval     - How often to check for new groups [NUMBER, defaults to 3]
    */
    vet_fnc_onTrackerSpawn = {
        if (!canSuspend) exitWith {_this spawn vet_fnc_onTrackerSpawn};
        params [
            ["_module", objNull, [objNull]],
            ["_fnc_callback", {}, [{}]],
            ["_interval", 3, [0]]
        ];
    
        private _fsmId = _module getVariable ["vn_fsm", -1];
        if (_fsmId == -1) exitWith {
            diag_log text format ["Could not get Tracker FSM from module: %1", _module];
        };
    
        private _handledGroups = [];
        private _fsmGroups = [];
        while {true} do {
            waitUntil {
                sleep _interval;
                // last element always contains all Overlord managed groups
                _fsmGroups = _fsmId call vn_ms_fnc_tracker_overlord_getGroups;
                reverse _fsmGroups;
                _fsmGroups = _fsmGroups select 0;
    
                _handledGroups isNotEqualTo _fsmGroups
            };
            private _newGroups = _fsmGroups - _handledGroups;
            _handledGroups = _fsmGroups;
    
            {[_x, _module] call _fnc_callback} foreach _newGroups;
        };
    };

     

    customizeTrackerLoadout.sqf (also sets the skill)

    Spoiler
    
    /*
        This script shows example usage of vet_fnc_onTrackerSpawn to customize the loadouts of spawned groups.
        vet_trackerLoadoutsHash         - hash map of tracker type and parameters for setUnitLoadout
        vet_fnc_customizeTrackerLoadout - function that randomly assigns loadouts to the group units depending on type of the tracker group
    */
    
    
    vet_trackerLoadoutsHash = createHashMapFromArray [
        ["sentry", ["vn_o_men_nva_dc_01", "vn_o_men_nva_dc_02", "vn_o_men_nva_dc_03", "vn_o_men_nva_dc_04", "vn_o_men_nva_dc_05", "vn_o_men_nva_dc_06", "vn_o_men_nva_dc_08", "vn_o_men_nva_dc_09", "vn_o_men_nva_dc_10", "vn_o_men_nva_dc_11", "vn_o_men_nva_dc_13", "vn_o_men_nva_dc_14", "vn_o_men_nva_dc_18"]],
        ["stalker", ["vn_o_men_nva_dc_01", "vn_o_men_nva_dc_02", "vn_o_men_nva_dc_03", "vn_o_men_nva_dc_04", "vn_o_men_nva_dc_05", "vn_o_men_nva_dc_06", "vn_o_men_nva_dc_08", "vn_o_men_nva_dc_09", "vn_o_men_nva_dc_10", "vn_o_men_nva_dc_11", "vn_o_men_nva_dc_13", "vn_o_men_nva_dc_14", "vn_o_men_nva_dc_18"]],
        ["patrol", ["vn_o_men_nva_15", "vn_o_men_nva_16", "vn_o_men_nva_17", "vn_o_men_nva_18", "vn_o_men_nva_19", "vn_o_men_nva_20", "vn_o_men_nva_21", "vn_o_men_nva_22", "vn_o_men_nva_23", "vn_o_men_nva_24", "vn_o_men_nva_25", "vn_o_men_nva_26", "vn_o_men_nva_27", "vn_o_men_nva_28"]],
        ["avalanche", ["vn_o_men_nva_15", "vn_o_men_nva_16", "vn_o_men_nva_17", "vn_o_men_nva_18", "vn_o_men_nva_19", "vn_o_men_nva_20", "vn_o_men_nva_21", "vn_o_men_nva_22", "vn_o_men_nva_23", "vn_o_men_nva_24", "vn_o_men_nva_25", "vn_o_men_nva_26", "vn_o_men_nva_27", "vn_o_men_nva_28"]]
    ];
    
    vet_fnc_customizeTrackerLoadout = {
        params [["_group", grpNull, [grpNull]]];
    
        systemChat str ["Changing loadout of", _group];
    
        private _groupType = _group getVariable ["vn_type", ""];
        private _loadouts = vet_trackerLoadoutsHash getOrDefault [_groupType, []];
        if (_loadouts isEqualTo []) exitWith {
            diag_log text format ["Could not get loadouts for group %1 of type %2", _group, _groupType];
        };
    
        {
            _x setUnitLoadout selectRandom _loadouts;
    	_x params[ "_unit" ];
    	_unit setSkill 0.40;
        } forEach units _group;
    };
    
    [ Trackermodule1, vet_fnc_customizeTrackerLoadout] call vet_fnc_onTrackerSpawn;

     

     


  5. Thanks for taking the time trying to help me, unfortunately once again it doesn't work, this time neither the loadouts nor the skill level seems to set correctly. Strangely enough I don't get any error messages at all.

    If I change initserver.sqf to just init.sqf (just took a chance) I get the error message "Could not get tracker FSM from module TrackerModule1" though. Not sure if that can be a clue or if it's just because the script doesn't work properly in init.sqf.


  6. 19 hours ago, Larrow said:

    May just be a timing problem due to execVM scheduling the code and its not ready before function gets called.

    See updated code in previous post.

     

     

    So, of course I have to go complicate things now, I hope you can help out with this issue too. The skill-script works perfectly but now I also wanted to look into changing the loadout of the spawned groups using the script from the same page.

    So, I went ahead and added the customizeTrackerLoadout.sqf  to my mission and then added _handle = [] execVM "customizeTrackerLoadout.sqf";  to my initserver.sqf. However, that seems to override the skill-level script so they spawn with the new loadouts I've given them but with max skill. Of course I have no idea why.

     

    Currently my initserver sqf looks like this:

    Spoiler
    
    //initServer.sqf
    
    //include function
    _handle = [] execVM "onTrackerSpawn.sqf";
    _handle = [] execVM "customizeTrackerLoadout.sqf";
    
    waitUntil{ scriptDone _handle };
    
    //Function to call when new units are spawned
    TAG_fnc_setTrackerGroupSkill = {
    	params[ "_group", "_module" ];
    	
    	{
    		_x params[ "_unit" ];
    		
    		_unit setSkill 0.30;
    	}forEach units _group;
    };
    
    //Tell the monitoring function the Module to monitor, the Function to call when new units are spawned by the module
    [ TrackerModule1, TAG_fnc_setTrackerGroupSkill ] call vet_fnc_onTrackerSpawn;

     

     

    customizeTrackerLoadout.sqf looks like this:

    Spoiler
    
    /*
        This script shows example usage of vet_fnc_onTrackerSpawn to customize the loadouts of spawned groups.
        vet_trackerLoadoutsHash         - hash map of tracker type and parameters for setUnitLoadout
        vet_fnc_customizeTrackerLoadout - function that randomly assigns loadouts to the group units depending on type of the tracker group
    */
    
    
    vet_trackerLoadoutsHash = createHashMapFromArray [
        ["sentry", ["vn_o_men_nva_dc_01", "vn_o_men_nva_dc_02", "vn_o_men_nva_dc_03", "vn_o_men_nva_dc_04", "vn_o_men_nva_dc_05", "vn_o_men_nva_dc_06", "vn_o_men_nva_dc_08", "vn_o_men_nva_dc_09", "vn_o_men_nva_dc_10", "vn_o_men_nva_dc_11", "vn_o_men_nva_dc_13", "vn_o_men_nva_dc_14", "vn_o_men_nva_dc_18"]],
        ["stalker", ["vn_o_men_nva_dc_01", "vn_o_men_nva_dc_02", "vn_o_men_nva_dc_03", "vn_o_men_nva_dc_04", "vn_o_men_nva_dc_05", "vn_o_men_nva_dc_06", "vn_o_men_nva_dc_08", "vn_o_men_nva_dc_09", "vn_o_men_nva_dc_10", "vn_o_men_nva_dc_11", "vn_o_men_nva_dc_13", "vn_o_men_nva_dc_14", "vn_o_men_nva_dc_18"]],
        ["patrol", ["vn_o_men_nva_15", "vn_o_men_nva_27", "vn_o_men_nva_23", "vn_o_men_nva_18", "vn_o_men_nva_19", "vn_o_men_nva_16", "vn_o_men_nva_17", "vn_o_men_nva_20", "vn_o_men_nva_22", "vn_o_men_nva_25", "vn_o_men_nva_28"]],
        ["avalanche", ["vn_o_men_nva_15", "vn_o_men_nva_27", "vn_o_men_nva_23", "vn_o_men_nva_18", "vn_o_men_nva_19", "vn_o_men_nva_16", "vn_o_men_nva_17", "vn_o_men_nva_20", "vn_o_men_nva_22", "vn_o_men_nva_25", "vn_o_men_nva_28"]]
    ];
    
    vet_fnc_customizeTrackerLoadout = {
        params [["_group", grpNull, [grpNull]]];
    
        systemChat str ["Changing loadout of", _group];
    
        private _groupType = _group getVariable ["vn_type", ""];
        private _loadouts = vet_trackerLoadoutsHash getOrDefault [_groupType, []];
        if (_loadouts isEqualTo []) exitWith {
            diag_log text format ["Could not get loadouts for group %1 of type %2", _group, _groupType];
        };
    
        {
            _x setUnitLoadout selectRandom _loadouts;
        } forEach units _group;
    };
    
    
    [Trackermodule1, vet_fnc_customizeTrackerLoadout] call vet_fnc_onTrackerSpawn;

     

     

    and onTrackerSpawn.sqf looks like this:

    Spoiler
    
    /*
        Author: veteran29
        Description:
            Execute custom callback on groups spawned by the Tracker Area module.
        Parameter(s):
            _module       - Tracker Area module [OBJECT]
            _fnc_callback - Function to execute on newly created groups, arguments passed to the callback are: [_group, _module] [CODE]
            _interval     - How often to check for new groups [NUMBER, defaults to 3]
    */
    vet_fnc_onTrackerSpawn = {
        if (!canSuspend) exitWith {_this spawn vet_fnc_onTrackerSpawn};
        params [
            ["_module", objNull, [objNull]],
            ["_fnc_callback", {}, [{}]],
            ["_interval", 3, [0]]
        ];
    
        private _fsmId = _module getVariable ["vn_fsm", -1];
        if (_fsmId == -1) exitWith {
            diag_log text format ["Could not get Tracker FSM from module: %1", _module];
        };
    
        private _handledGroups = [];
        private _fsmGroups = [];
        while {true} do {
            waitUntil {
                sleep _interval;
                // last element always contains all Overlord managed groups
                _fsmGroups = _fsmId call vn_ms_fnc_tracker_overlord_getGroups;
                reverse _fsmGroups;
                _fsmGroups = _fsmGroups select 0;
    
                _handledGroups isNotEqualTo _fsmGroups
            };
            private _newGroups = _fsmGroups - _handledGroups;
            _handledGroups = _fsmGroups;
    
            {[_x, _module] call _fnc_callback} foreach _newGroups;
        };
    };

     

     


  7. Thanks for replying! I really appreciate you helping out man. I've tried it but it gives me this error message:

    TnhR7Lk.jpg

     

    I'm guessing for some reason it doesn't recognize the vet_fnc_onTrackerSpawn-command but I have no idea why. I've tested in both SP and MP (but not on a dedicated server) and it gives me the same error each time.

    EDIT: if I include all the code from onTrackerSpawn.sqf in my initserver.sqf it seems to work fine, so I'm guessing the issue is that onTrackerSpawn.sqf isn't being included properly? Are there any downsides to having all the code in initserver.sqf or is it mostly just to keep things neat and tidy?

     

    In my missions folder I have:

    initServer.sqf

    with the code:

    //initServer.sqf
    
    //include function
    [] execVM "onTrackerSpawn.sqf";
    
    //Function to call when new units are spawned
    TAG_fnc_setTrackerGroupSkill = {
    	params[ "_group", "_module" ];
    	
    	{
    		_x params[ "_unit" ];
    		
    		_unit setSkill 0.5;
    	}forEach units _group;
    };
    
    //Tell the monitoring function the Module to monitor, the Function to call when new units are spawned by the module
    [ TrackerModule1, TAG_fnc_setTrackerGroupSkill ] call vet_fnc_onTrackerSpawn;

    and onTrackerSpawn.sqf with the code:

    /*
        Author: veteran29
        Description:
            Execute custom callback on groups spawned by the Tracker Area module.
        Parameter(s):
            _module       - Tracker Area module [OBJECT]
            _fnc_callback - Function to execute on newly created groups, arguments passed to the callback are: [_group, _module] [CODE]
            _interval     - How often to check for new groups [NUMBER, defaults to 3]
    */
    vet_fnc_onTrackerSpawn = {
        if (!canSuspend) exitWith {_this spawn vet_fnc_onTrackerSpawn};
        params [
            ["_module", objNull, [objNull]],
            ["_fnc_callback", {}, [{}]],
            ["_interval", 3, [0]]
        ];
    
        private _fsmId = _module getVariable ["vn_fsm", -1];
        if (_fsmId == -1) exitWith {
            diag_log text format ["Could not get Tracker FSM from module: %1", _module];
        };
    
        private _handledGroups = [];
        private _fsmGroups = [];
        while {true} do {
            waitUntil {
                sleep _interval;
                // last element always contains all Overlord managed groups
                _fsmGroups = _fsmId call vn_ms_fnc_tracker_overlord_getGroups;
                reverse _fsmGroups;
                _fsmGroups = _fsmGroups select 0;
    
                _handledGroups isNotEqualTo _fsmGroups
            };
            private _newGroups = _fsmGroups - _handledGroups;
            _handledGroups = _fsmGroups;
    
            {[_x, _module] call _fnc_callback} foreach _newGroups;
        };
    };

     


  8. EDIT: Updating my initial post with a probable solution.

     

    Well, it seems I might have managed to solve it in the end. I "simply" mashed the scripts together and added the skill-level stuff into the loadout script and it seems to be working (might have faults that will appear later though). Figured I'd post it all here so it's available to anyone looking to do the same thing.  Big thanks to Larrow, couldn't have done it without you!

     

    initserver.sqf

      Reveal hidden contents
    
    //initServer.sqf
    //include function
    
    _handle = [] execVM "onTrackerSpawn.sqf";
    _handle = [] execVM "customizeTrackerLoadout.sqf";
    
    waitUntil{ scriptDone _handle };
    
    //Tell the monitoring function the Module to monitor, the Function to call when new units are spawned by the module
    [ Trackermodule1, vet_fnc_customizeTrackerLoadout] call vet_fnc_onTrackerSpawn;

     

    onTrackerSpawn.sqf

      Reveal hidden contents
    
    /*
        Author: veteran29
        Description:
            Execute custom callback on groups spawned by the Tracker Area module.
        Parameter(s):
            _module       - Tracker Area module [OBJECT]
            _fnc_callback - Function to execute on newly created groups, arguments passed to the callback are: [_group, _module] [CODE]
            _interval     - How often to check for new groups [NUMBER, defaults to 3]
    */
    vet_fnc_onTrackerSpawn = {
        if (!canSuspend) exitWith {_this spawn vet_fnc_onTrackerSpawn};
        params [
            ["_module", objNull, [objNull]],
            ["_fnc_callback", {}, [{}]],
            ["_interval", 3, [0]]
        ];
    
        private _fsmId = _module getVariable ["vn_fsm", -1];
        if (_fsmId == -1) exitWith {
            diag_log text format ["Could not get Tracker FSM from module: %1", _module];
        };
    
        private _handledGroups = [];
        private _fsmGroups = [];
        while {true} do {
            waitUntil {
                sleep _interval;
                // last element always contains all Overlord managed groups
                _fsmGroups = _fsmId call vn_ms_fnc_tracker_overlord_getGroups;
                reverse _fsmGroups;
                _fsmGroups = _fsmGroups select 0;
    
                _handledGroups isNotEqualTo _fsmGroups
            };
            private _newGroups = _fsmGroups - _handledGroups;
            _handledGroups = _fsmGroups;
    
            {[_x, _module] call _fnc_callback} foreach _newGroups;
        };
    };

     

    customizeTrackerLoadout.sqf (also sets the skill)

      Reveal hidden contents
    
    /*
        This script shows example usage of vet_fnc_onTrackerSpawn to customize the loadouts of spawned groups.
        vet_trackerLoadoutsHash         - hash map of tracker type and parameters for setUnitLoadout
        vet_fnc_customizeTrackerLoadout - function that randomly assigns loadouts to the group units depending on type of the tracker group
    */
    
    
    vet_trackerLoadoutsHash = createHashMapFromArray [
        ["sentry", ["vn_o_men_nva_dc_01", "vn_o_men_nva_dc_02", "vn_o_men_nva_dc_03", "vn_o_men_nva_dc_04", "vn_o_men_nva_dc_05", "vn_o_men_nva_dc_06", "vn_o_men_nva_dc_08", "vn_o_men_nva_dc_09", "vn_o_men_nva_dc_10", "vn_o_men_nva_dc_11", "vn_o_men_nva_dc_13", "vn_o_men_nva_dc_14", "vn_o_men_nva_dc_18"]],
        ["stalker", ["vn_o_men_nva_dc_01", "vn_o_men_nva_dc_02", "vn_o_men_nva_dc_03", "vn_o_men_nva_dc_04", "vn_o_men_nva_dc_05", "vn_o_men_nva_dc_06", "vn_o_men_nva_dc_08", "vn_o_men_nva_dc_09", "vn_o_men_nva_dc_10", "vn_o_men_nva_dc_11", "vn_o_men_nva_dc_13", "vn_o_men_nva_dc_14", "vn_o_men_nva_dc_18"]],
        ["patrol", ["vn_o_men_nva_15", "vn_o_men_nva_16", "vn_o_men_nva_17", "vn_o_men_nva_18", "vn_o_men_nva_19", "vn_o_men_nva_20", "vn_o_men_nva_21", "vn_o_men_nva_22", "vn_o_men_nva_23", "vn_o_men_nva_24", "vn_o_men_nva_25", "vn_o_men_nva_26", "vn_o_men_nva_27", "vn_o_men_nva_28"]],
        ["avalanche", ["vn_o_men_nva_15", "vn_o_men_nva_16", "vn_o_men_nva_17", "vn_o_men_nva_18", "vn_o_men_nva_19", "vn_o_men_nva_20", "vn_o_men_nva_21", "vn_o_men_nva_22", "vn_o_men_nva_23", "vn_o_men_nva_24", "vn_o_men_nva_25", "vn_o_men_nva_26", "vn_o_men_nva_27", "vn_o_men_nva_28"]]
    ];
    
    vet_fnc_customizeTrackerLoadout = {
        params [["_group", grpNull, [grpNull]]];
    
        systemChat str ["Changing loadout of", _group];
    
        private _groupType = _group getVariable ["vn_type", ""];
        private _loadouts = vet_trackerLoadoutsHash getOrDefault [_groupType, []];
        if (_loadouts isEqualTo []) exitWith {
            diag_log text format ["Could not get loadouts for group %1 of type %2", _group, _groupType];
        };
    
        {
            _x setUnitLoadout selectRandom _loadouts;
    	_x params[ "_unit" ];
    	_unit setSkill 0.40;
        } forEach units _group;
    };
    
    [ Trackermodule1, vet_fnc_customizeTrackerLoadout] call vet_fnc_onTrackerSpawn;

     

     

     

     

    ORIGINAL POST:
     

    Spoiler


     

     

    NEW PROBLEM:

    Quote

    So, of course I have to go complicate things now, I hope you can help out with this issue too. The skill-script works perfectly but now I also wanted to look into changing the loadout of the spawned groups using the script from the same page.

    So, I went ahead and added the customizeTrackerLoadout.sqf  to my mission and then added _handle = [] execVM "customizeTrackerLoadout.sqf";  to my initserver.sqf. However, that seems to override the skill-level script so they spawn with the new loadouts I've given them but with max skill. Of course I have no idea why.

     

    Currently my initserver sqf looks like this:

    Spoiler
    
    
    
    //initServer.sqf
    
    //include function
    _handle = [] execVM "onTrackerSpawn.sqf";
    _handle = [] execVM "customizeTrackerLoadout.sqf";
    
    waitUntil{ scriptDone _handle };
    
    //Function to call when new units are spawned
    TAG_fnc_setTrackerGroupSkill = {
    	params[ "_group", "_module" ];
    	
    	{
    		_x params[ "_unit" ];
    		
    		_unit setSkill 0.30;
    	}forEach units _group;
    };
    
    //Tell the monitoring function the Module to monitor, the Function to call when new units are spawned by the module
    [ TrackerModule1, TAG_fnc_setTrackerGroupSkill ] call vet_fnc_onTrackerSpawn;

     

     

    customizeTrackerLoadout.sqf looks like this:

    Spoiler
    
    
    
    /*
        This script shows example usage of vet_fnc_onTrackerSpawn to customize the loadouts of spawned groups.
        vet_trackerLoadoutsHash         - hash map of tracker type and parameters for setUnitLoadout
        vet_fnc_customizeTrackerLoadout - function that randomly assigns loadouts to the group units depending on type of the tracker group
    */
    
    
    vet_trackerLoadoutsHash = createHashMapFromArray [
        ["sentry", ["vn_o_men_nva_dc_01", "vn_o_men_nva_dc_02", "vn_o_men_nva_dc_03", "vn_o_men_nva_dc_04", "vn_o_men_nva_dc_05", "vn_o_men_nva_dc_06", "vn_o_men_nva_dc_08", "vn_o_men_nva_dc_09", "vn_o_men_nva_dc_10", "vn_o_men_nva_dc_11", "vn_o_men_nva_dc_13", "vn_o_men_nva_dc_14", "vn_o_men_nva_dc_18"]],
        ["stalker", ["vn_o_men_nva_dc_01", "vn_o_men_nva_dc_02", "vn_o_men_nva_dc_03", "vn_o_men_nva_dc_04", "vn_o_men_nva_dc_05", "vn_o_men_nva_dc_06", "vn_o_men_nva_dc_08", "vn_o_men_nva_dc_09", "vn_o_men_nva_dc_10", "vn_o_men_nva_dc_11", "vn_o_men_nva_dc_13", "vn_o_men_nva_dc_14", "vn_o_men_nva_dc_18"]],
        ["patrol", ["vn_o_men_nva_15", "vn_o_men_nva_27", "vn_o_men_nva_23", "vn_o_men_nva_18", "vn_o_men_nva_19", "vn_o_men_nva_16", "vn_o_men_nva_17", "vn_o_men_nva_20", "vn_o_men_nva_22", "vn_o_men_nva_25", "vn_o_men_nva_28"]],
        ["avalanche", ["vn_o_men_nva_15", "vn_o_men_nva_27", "vn_o_men_nva_23", "vn_o_men_nva_18", "vn_o_men_nva_19", "vn_o_men_nva_16", "vn_o_men_nva_17", "vn_o_men_nva_20", "vn_o_men_nva_22", "vn_o_men_nva_25", "vn_o_men_nva_28"]]
    ];
    
    vet_fnc_customizeTrackerLoadout = {
        params [["_group", grpNull, [grpNull]]];
    
        systemChat str ["Changing loadout of", _group];
    
        private _groupType = _group getVariable ["vn_type", ""];
        private _loadouts = vet_trackerLoadoutsHash getOrDefault [_groupType, []];
        if (_loadouts isEqualTo []) exitWith {
            diag_log text format ["Could not get loadouts for group %1 of type %2", _group, _groupType];
        };
    
        {
            _x setUnitLoadout selectRandom _loadouts;
        } forEach units _group;
    };
    
    
    [Trackermodule1, vet_fnc_customizeTrackerLoadout] call vet_fnc_onTrackerSpawn;

     

     

    and onTrackerSpawn.sqf looks like this:

    Spoiler
    
    
    
    /*
        Author: veteran29
        Description:
            Execute custom callback on groups spawned by the Tracker Area module.
        Parameter(s):
            _module       - Tracker Area module [OBJECT]
            _fnc_callback - Function to execute on newly created groups, arguments passed to the callback are: [_group, _module] [CODE]
            _interval     - How often to check for new groups [NUMBER, defaults to 3]
    */
    vet_fnc_onTrackerSpawn = {
        if (!canSuspend) exitWith {_this spawn vet_fnc_onTrackerSpawn};
        params [
            ["_module", objNull, [objNull]],
            ["_fnc_callback", {}, [{}]],
            ["_interval", 3, [0]]
        ];
    
        private _fsmId = _module getVariable ["vn_fsm", -1];
        if (_fsmId == -1) exitWith {
            diag_log text format ["Could not get Tracker FSM from module: %1", _module];
        };
    
        private _handledGroups = [];
        private _fsmGroups = [];
        while {true} do {
            waitUntil {
                sleep _interval;
                // last element always contains all Overlord managed groups
                _fsmGroups = _fsmId call vn_ms_fnc_tracker_overlord_getGroups;
                reverse _fsmGroups;
                _fsmGroups = _fsmGroups select 0;
    
                _handledGroups isNotEqualTo _fsmGroups
            };
            private _newGroups = _fsmGroups - _handledGroups;
            _handledGroups = _fsmGroups;
    
            {[_x, _module] call _fnc_callback} foreach _newGroups;
        };
    };

     

     

    OLD PROBLEM:

    Quote

     

    Hello, I'm making a SOG: Prairie Fire campaign for my group and I'm planning on using the tracker module for some missions where we operate behind enemy lines. Now the default skill level for units spawned in the module seems to be set to 100% which is probably too much for my group to handle, so I was hoping to be able to set it lower.  From what I've gathered it should be possible to modify this script and add a "handler" to it in order to set the skill of spawned units (the SetSkill command I suppose). However, I'm terrible at understanding scripting and I don't even understand what a handler is so I need some help. I also don't really understand where to put the onTrackerSpawn.sqf and activate it but that's a different story I suppose.

     

    I would be really grateful if someone with more scripting experience could help me out here.

     

     

     


     

     


  9. I'm working on a vietnam-campaign using SOG Prairie Fire for my group, and for different missions I want different insignias on the left arm and chest (like an Aircav-patch for example).

    However, when playing the missions with my friend on his dedicated server I can only see the insignias on my own character model, not on my friends (and he cannot see them on my character either). Same goes for AI Characters, however, when testing it in SP the insignias show up on AI characters. Chest insignias chosen in the arsenal show up fine for both me and my friend after exiting the arsenal so my guess is the insignias aren't applied properly on mission start on dedicated for some reason.

    Anyone know any solution to this? Our unit insignia (on the right arm) works fine.  I've added the insignias/patches using the options in the editor. If my friend instead hosts the mission himself without a dedicated server, he can see my insignias but I cannot see his.

     

    Picture showing what insignias/patches I'm talking about (note, having the aircav-patch all around is just an example! haha):

    YGfLal4.jpeg

     

    and the editor options:

    4ZPCJYw.jpg

     

×