Tip: Keeping your mission file smaller.

AlienX

Valued Member!
Hello everyone,
Just a little tip i thought i would show you here to keep your mission files extremely small when having to use new compiles.sqf and then other self action scripts.

Instead of using scripts that already exist inside the game, why not overload them (so to speak...)

Example (Remove parts from vehicles):
Files Required with tip: 2
(The mod itself, the custom script i will show you soon)

Files Required the "normal way": 3
(The mod itself, compiles.sqf and fn self actions sqf's).

Okay yes, two files is not that much of an improvement over three files, however this is a massive saving in mission file size.

This can be done for so many function calls inside dayz.

Example Self Actions File
Code:
        waitUntil {!isNil "fnc_usec_selfActions"};
        fnc_usec_selfActions2 = fnc_usec_selfActions;
     
        fnc_usec_selfActions = {
            [] call fnc_usec_selfActions2;
         
            _vehicle = vehicle player;
            _isMan = cursorTarget isKindOf "Man";
            _inVehicle = (_vehicle != player);
            _hasToolbox =    "ItemToolbox" in items player;
            _onLadder =        (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
            _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
         
            if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4)) then {
                if( !_isMan and _canDo and _hasToolbox and (silver_myCursorTarget != cursorTarget) and cursorTarget isKindOf "AllVehicles" and (getDammage cursorTarget < 0.95) ) then {
                    _vehicle = cursorTarget;
                    _invalidVehicle = (_vehicle isKindOf "Motorcycle") or (_vehicle isKindOf "Tractor");
                    if( !_invalidVehicle ) then {
                        {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
                        s_player_removeActions = [];
                        silver_myCursorTarget = _vehicle;
                     
                        _hitpoints = _vehicle call vehicle_getHitpoints;
                     
                        {
                            _damage = [_vehicle,_x] call object_getHit;
                         
                            if( _damage < 0.15 ) then {
                                _cmpt = toArray (_x);
                                _cmpt set [0,20];
                                _cmpt set [1,toArray ("-") select 0];
                                _cmpt set [2,20];
                                _cmpt = toString _cmpt;
                             
                                _configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _x;
                                _part = getText(_configVeh >> "part");
                                if (isnil "_part") then { _part = "PartGeneric"; };
                             
                                _string = format["<t color='#0096ff'>Remove%1</t>",_cmpt,_color];
                                _handle = silver_myCursorTarget addAction [_string, "fixes\ss_remove.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
                                s_player_removeActions set [count s_player_removeActions,_handle];
                            };
                        } forEach _hitpoints;
                    };
                };         
            } else {
                {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
                silver_myCursorTarget = objNull;
            };
        };

Example player Spawn Check File
This example shows how easy it is to change the loot spawning options without having to take up lots more mission file size by having to give your clients the whole file.

Code:
    waitUntil {!isNil "player_spawnCheck"};
    waitUntil {!isNil "dayz_spawnArea"};
    waitUntil {!isNil "dayz_canDelete"};
    waitUntil {!isNil "dayz_lootSpawnBias"};
    waitUntil {!isNil "dayz_localswarmSpawned"};
    dayz_spawnArea = 150;
    dayz_canDelete = 250;
    dayz_lootSpawnBias = 80;
    dayz_localswarmSpawned = 4;

This tiny file changes so much.


p.s.
I'm not that great with explaining things, sorry - if you have any questions please ask and i will do my best to help :p
 
Back
Top