Jump to content

Texeiro

Member
  • Content Count

    34
  • Joined

  • Last visited

  • Medals

Posts posted by Texeiro


  1. I m trying to spawn an specific vehicle type  Spawning from a "buy vehicle script" (modified  from Adler shop or similar, can t remember) so I guess it s a resáwning. The script that i tried to exe is the CH mmobile hq script. :

    Quote

    CHHQ_fnc_deploy = {
        _veh = _this select 0;
        _caller = _this select 1;
        _side = _this select 3 select 0;
        _cargoInfo = _this select 3 select 1;
        _composition = _this select 3 select 2;
        _cargo = _veh getVariable ["CHHQ_cargo", objNull];
        
        if (_veh getVariable ["CHHQ_compositionRadius", -1] < 0) then {
            _sortedByDist = [_composition,[],{
                _frstNum = abs (_x select 1 select 0);
                _secNum = abs (_x select 1 select 1);
                if (_frstNum > _secNum) then {_frstNum} else {_secNum}
            },"DESCEND"] call BIS_fnc_sortBy;    
            _biggestOffset = (_sortedByDist select 0) select 1;
            _biggestOffsetAbs = if (abs (_biggestOffset select 0) > abs (_biggestOffset select 1)) then {abs (_biggestOffset select 0)} else {abs (_biggestOffset select 1)};
            
            _boundingSize = [_sortedByDist select 0 select 0] call CHHQ_fnc_boundingSize;
            _radius = _biggestOffsetAbs + _boundingSize;
            
            _sortedBySize = [_composition,[],{sizeOf (_x select 0)},"DESCEND"] call BIS_fnc_sortBy;
            _boundingSize = [_sortedBySize select 0 select 0] call CHHQ_fnc_boundingSize;    
            
            if (_boundingSize > _radius) then {
                _radius = _boundingSize;
            };
            _veh setVariable ["CHHQ_compositionRadius", _radius, true];
        };
        _radius = _veh getVariable ["CHHQ_compositionRadius", -1];
        
        _flatPos = (getPosASL _veh) isFlatEmpty [
            _radius,    //--- Minimal distance from another object
            0,                //--- If 0, just check position. If >0, select new one
            0.4,            //--- Max gradient
            _radius max 5,    //--- Gradient area
            0,                //--- 0 for restricted water, 2 for required water,
            false,            //--- Has to have shore nearby!
            objNull            //--- Ignored object
        ];
        
        if (count _flatPos isEqualTo 0) exitWith {systemChat format ["You can't deploy HQ here! Find a flat position without any objects nearby (%1m).", round _radius]};
        if (_veh getVariable ["CHHQ_inProgress", false]) exitWith {};
        
        _veh setVariable ["CHHQ_inProgress", true, true];
        
        [[_veh], "CHHQ_fnc_removeAction", _side] call BIS_fnc_MP;
        _nearestPlayers = [];
        {
            if (isPlayer _x && _x distance _veh < 25) then {
                _nearestPlayers pushBack _x
            };
        } forEach (playableUnits + switchableUnits);
        [["CHHQ_deployBlackout"],"BIS_fnc_blackOut",_nearestPlayers,false,true] call BIS_fnc_MP;
        [["DEPLOYING HQ"],"BIS_fnc_dynamicText",_nearestPlayers] call BIS_fnc_MP;
        sleep 3;    
        {moveOut _x} forEach crew _veh;
        {_x allowDamage false; _x enableSimulationGlobal false} forEach _nearestPlayers;
        
        deleteVehicle _cargo;
        
        _veh enableSimulationGlobal false;
        _veh allowDamage false;
        
        [[_veh, _side, "HQ"],"CHHQ_fnc_drawMarker",_side] call BIS_fnc_MP;
        _objArray = [];
        {
            _type = _x select 0;
            _offset = _x select 1;
            _newdir = _x select 2;
            _code = [_x, 3, "", ["", {}]] call BIS_fnc_param;
            
            _obj = createVehicle [_type, [0,0,0], [], 0, "CAN_COLLIDE"];
            _obj allowDamage false;
            [_veh,_obj,_offset,_newdir, true, true] call BIS_fnc_relPosObject;
            _objArray pushBack _obj;
            
            if !(_code isEqualTo "") then {
                _code = [_code] call CHHQ_fnc_compileCode;
                [[[_obj,_veh], _code],"BIS_fnc_spawn",true] call BIS_fnc_MP;
            };
        } forEach _composition;
        
        /*
        _grp = createGroup _side;
        _unitType = switch _side do {
            case east: {"O_soldier_F"};
            case west: {"B_soldier_F"};
            case resistance: {"I_soldier_F"};
            default {"C_man_1"};
        };
        _unit = _grp createUnit [_unitType, [0,0,0], [], 0, "NONE"];
        [[_unit,{hideObject _this}],"BIS_fnc_spawn",true] call BIS_fnc_MP;
        _unit moveInCargo _veh;
        _veh setPilotLight false;
        _veh setCollisionLight false;
        _veh engineOn false;
        _grp setBehaviour "CARELESS";
        {_unit disableAI _x} forEach ["MOVE","TARGET","AUTOTARGET","ANIM","FSM"];
        _objArray pushBack _unit;
        */
        
        [[_veh, 2],"lock",true] call BIS_fnc_MP;
            
        _veh enableSimulationGlobal true;
        _veh allowDamage true;
        {_x allowDamage true} forEach _objArray;    
        {_x setPos ((getPosASL _x) findEmptyPosition [0, 25, "CAManBase"]); _x allowDamage true; _x enableSimulationGlobal true} forEach _nearestPlayers;
        
        sleep 3;
        [["CHHQ_deployBlackout"],"BIS_fnc_blackIn",_nearestPlayers,false,true] call BIS_fnc_MP;
        [[_veh, ["Undeploy HQ", "_this spawn CHHQ_fnc_undeploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"]], "CHHQ_fnc_addAction", _side] call BIS_fnc_MP;
        [["RespawnAdded",["DEPLOYMENT POINT",format ["HQ deployed at grid %1", mapGridPosition (getPos _veh)],"\A3\ui_f\data\map\markers\nato\b_hq.paa"]],"BIS_fnc_showNotification",_side] call BIS_fnc_MP;

        _veh setVariable ["CHHQ_inProgress", false, true];
        _veh setVariable ["CHHQ_deployed", true, true];
        _veh setVariable ["CHHQ_objArray", _objArray, true];
        [[_veh], "CHHQ_fnc_deleteVehicleEH", false] call BIS_fnc_MP;
    };
    CHHQ_fnc_undeploy = {
        _veh = _this select 0;
        _caller = _this select 1;
        _side = _this select 3 select 0;
        _cargoInfo = _this select 3 select 1;
        _cargoType = _cargoInfo select 0;
        _cargoOffset = _cargoInfo select 1;
        _cargoDir = _cargoInfo select 2;
        _cargoCode = [_cargoInfo, 3, "", ["", {}]] call BIS_fnc_param;
        _composition = _this select 3 select 2;
        
        if (_veh getVariable ["CHHQ_inProgress", false]) exitWith {};    
        _veh setVariable ["CHHQ_inProgress", true, true];
        
        [[_veh], "CHHQ_fnc_removeAction", _side] call BIS_fnc_MP;
        
        _nearestPlayers = [];
        {
            if (isPlayer _x && _x distance _veh < 25) then {
                _nearestPlayers pushBack _x
            };
        } forEach (playableUnits + switchableUnits);
        [["CHHQ_deployBlackout"],"BIS_fnc_blackOut",_nearestPlayers,false,true] call BIS_fnc_MP;
        [["UNDEPLOYING HQ"],"BIS_fnc_dynamicText",_nearestPlayers] call BIS_fnc_MP;
        sleep 3;
        {_x allowDamage false; _x enableSimulationGlobal false} forEach _nearestPlayers;    
        
        {deleteVehicle _x} forEach (_veh getVariable ["CHHQ_objArray", []]);
        _veh setVariable ["CHHQ_deployed", false, true];    
        
        [[_veh, _side, "MHQ"],"CHHQ_fnc_drawMarker",_side] call BIS_fnc_MP;    
        [[_veh, false],"lock",true] call BIS_fnc_MP;    
        [[_veh, true],"lockCargo",true] call BIS_fnc_MP;
        [[_veh, [0,false]],"lockCargo",true] call BIS_fnc_MP;
        
        _cargo = createVehicle [_cargoType, [0,0,0], [], 0, "CAN_COLLIDE"];        
        _cargo attachTo [_veh, _cargoOffset];
                        
        _veh setPos (getPos _veh);
        _veh setDir (getDir _veh);
        _cargo setDir _cargoDir;    
        _veh setVariable ["CHHQ_cargo", _cargo, true];
                
        if !(_cargoCode isEqualTo "") then {
            _cargoCode = [_cargoCode] call CHHQ_fnc_compileCode;
            [[[_cargo,_veh], _cargoCode],"BIS_fnc_spawn",true] call BIS_fnc_MP;
        };
        
        sleep 3;    
        _veh enableSimulationGlobal true;
        _veh allowDamage true;
        {_x setPos ((getPosASL _x) findEmptyPosition [0, 25, "CAManBase"]); _x allowDamage true; _x enableSimulationGlobal true} forEach _nearestPlayers;
        [["CHHQ_deployBlackout"],"BIS_fnc_blackIn",_nearestPlayers,false,true] call BIS_fnc_MP;
        [[_veh,["Deploy HQ", "_this spawn CHHQ_fnc_deploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"]], "CHHQ_fnc_addAction", _side] call BIS_fnc_MP;
        
        _veh setVariable ["CHHQ_inProgress", false, true];
        [[_veh, "cargo"], "CHHQ_fnc_deleteVehicleEH", false] call BIS_fnc_MP;
    };
    CHHQ_fnc_boundingSize = {
        _type = _this select 0;
        _bbdummy = _type createVehicleLocal [0,0,0];
        _boundingBox = (boundingBox _bbdummy) select 1;
        deleteVehicle _bbdummy;
        _boundingSize = if (_boundingBox select 0 > _boundingBox select 1) then {_boundingBox select 0} else {_boundingBox select 1};
        _boundingSize
    };
    CHHQ_fnc_compileCode = {
        _code = [_this, 0, "", ["", {}]] call BIS_fnc_param;
        
        if (toLower typeName _code == "code") then {
            _array = toArray str _code;
            _array deleteAt 0;
            _array deleteAt count _array - 1;
            _code = toString _array;
        };
        if !(_code isEqualTo "") then {
            _prefix = "_target = _this select 1; _this = _this select 0; ";
            _code = _prefix + _code;
        };
        compile _code
    };
    CHHQ_fnc_deleteVehicleEH = {
        _veh = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
        _type = [_this, 1, "", [""]] call BIS_fnc_param;
        _objArray = _veh getVariable ["CHHQ_objArray", []];
        _cargo = _veh getVariable ["CHHQ_cargo", objNull];
            
        waitUntil {isNull _veh};
        if (_type isEqualTo "cargo") then {
            deleteVehicle _cargo;
        } else {
            {deleteVehicle _x} forEach _objArray;
        };
    };
    CHHQ_fnc_arrayUpdateEH = {
        _array = _this select 0;
        _code = _this select 1;
        
        for "_i" from 0 to 1 step 0 do {
            _countArray = count _array;
            waitUntil {count _array != _countArray};
            call _code;
        };
    };
    CHHQ_fnc_drawMarker = {
        if !(CHHQ_showMarkers) exitWith {};
        private ["_color","_icon","_mrkName"];
        _veh = _this select 0;
        _side = _this select 1;
        _text = _this select 2;
        terminate (_veh getVariable ["CHHQ_drawMarkerHandle", scriptNull]);
        
        switch _side do {
            case west: {
                _color = "ColorWEST";
                _icon = "b_hq";
            };
            case east: {
                _color = "ColorEAST";
                _icon = "o_hq";
            };
            case resistance: {
                _color = "ColorGUER";
                _icon = "n_hq";
            };
            default {
                _color = "ColorUNKNOWN";
                _icon = "n_hq";
            };
        };
        
        if (_veh getVariable ["CHHQ_mrkName", ""] isEqualTo "") then {
            _veh setVariable ["CHHQ_mrkName", format ["CHHQ_%1", [str _veh] call BIS_fnc_filterString]];
        };
        _mrkName = _veh getVariable ["CHHQ_mrkName", format ["CHHQ_%1", [str _veh] call BIS_fnc_filterString]];
        
        if (getMarkerPos _mrkName isEqualTo [0,0,0]) then {
            createMarkerLocal [_mrkName, getPos _veh];
        } else {
            _mrkName setMarkerPosLocal (getPos _veh);
        };
        _mrkName setMarkerShapeLocal "ICON";
        _mrkName setMarkerTypeLocal _icon;
        //_mrkName setMarkerSizeLocal [0.7,0.7];
        _mrkName setMarkerColorLocal _color;

        _handle = [_veh, _mrkName, _text] spawn {
            _veh = _this select 0;
            _mrkName = _this select 1;
            while {alive _veh} do {
                _text = if (count CHHQ_HQarray > 1) then {format ["%1-%2", _this select 2, _veh getVariable ["CHHQ_index", -1]]} else {_this select 2};
                _mrkName setMarkerTextLocal _text;
                _mrkName setMarkerPosLocal (getPos _veh);
                sleep 1;
            };
            deleteMarkerLocal _mrkName;
        };
        _veh setVariable ["CHHQ_drawMarkerHandle", _handle];
    };
    CHHQ_fnc_addAction = {
        _veh = _this select 0;
        _settings = _this select 1;

        _id = _veh addAction _settings;
        _veh setVariable ["CHHQ_actionID",_id];
    };
    CHHQ_fnc_removeAction = {
        _obj = _this select 0;
        _obj removeAction (_obj getVariable ["CHHQ_actionID",-1]);
    };
    CHHQ_fnc_actionConditions = {
        _target = _this select 0;
        _caller = _this select 1;

        (speed _target isEqualTo 0 && {alive _target} && {_caller distance _target < 8} && {vehicle _caller isEqualTo _caller})
    };
    CHHQ_fnc_teleportActionConditions = {
        _target = _this select 0;
        _caller = _this select 1;
        _veh = _this select 2;

        (_veh getVariable ["CHHQ_deployed", false] && {!isNil "_veh"} && {alive _veh} && {_caller distance _target < 8} && {vehicle _caller isEqualTo _caller})    
    };
    CHHQ_fnc_teleportToHQ = {
        _obj = _this select 0;
        _caller = _this select 1;
        _veh = _this select 3 select 0;
        
        ["CH_teleportToHQblackout"] call BIS_fnc_blackOut;
        sleep 3;
        _caller setPos ((getPosASL _veh) findEmptyPosition [0, 25, "CAManBase"]);    
        ["CH_teleportToHQblackout"] call BIS_fnc_blackIn;
        [] call CHHQ_fnc_BISshowOSD;
    };
    CHHQ_fnc_BISshowOSD = {
        /*
            Author: Jiri Wainar

            Description:
            Display OSD with location, time and possibly some other campaign related info.

            Parameter(s):
            _this select 0: array (optional)    - position (default: player's position)
            _this select 1: array (optional)    - date in format [_year,_month,_day,_hour,_min] (default: current date)

            Example:
            [] call BIS_fnc_camp_showOSD;

            Returns:
            - nothing -
        */

        if (missionNamespace getVariable ["BIS_fnc_camp_showOSD__running",false]) exitWith {};

        BIS_fnc_camp_showOSD__running = true;

        private["_fn_getSector"];

        _fn_getSector =
        {
            private["_map","_posX","_posY","_gridX","_gridY","_secWidth","_secHeight"];
            private["_bottomLeftX","_bottomLeftY","_topRightX","_topRightY"];

            _map = toLower worldName;

            if !(_map in ["altis","stratis"]) exitWith
            {
                -1
            };

            if (_map == "stratis") then
            {
                _bottomLeftX = 1302;
                _bottomLeftY = 230;
                _topRightX   = 6825;
                _topRightY   = 7810;
            }
            else
            {
                _bottomLeftX = 1765;
                _bottomLeftY = 4639;
                _topRightX   = 28624;
                _topRightY   = 26008;
            };

            _posX = _this select 0;
            _posY = _this select 1;

            //check if player is outside the map grid
            if !(_posX > _bottomLeftX && _posX < _topRightX && _posY > _bottomLeftY && _posY < _topRightY) exitWith
            {
                0
            };

            //offset player pos to [0,0]
            _posX      = _posX - _bottomLeftX;
            _posY      = _posY - _bottomLeftY;

            _secWidth  = (_topRightX - _bottomLeftX)/3;
            _secHeight = (_topRightY - _bottomLeftY)/3;

            _gridX = floor (_posX/_secWidth);
            _gridY = floor (_posY/_secHeight);

            ((_gridY * 3) + _gridX + 1)
        };


        private["_position","_date","_output","_showDate","_showLocation","_showMap"];
        private["_tLoc","_tMap","_tDate","_tTime","_tTimeH","_tTimeM","_tDay","_tMonth","_tYear"];

        _showDate     = true;


        _position      = [_this, 0, getPos player, [[]]] call BIS_fnc_param;
        _date            = [_this, 1, date, [[]]] call BIS_fnc_param;
        _tMap        = [_this, 2, "auto", [""]] call BIS_fnc_param;
        _tLoc        = [_this, 3, "auto", [""]] call BIS_fnc_param;

        //safecheck _date to make sure no values are out of boundries
        _date = _date call BIS_fnc_fixDate;

        if (_tMap != "") then
        {
            _showMap = true;
        }
        else
        {
            _showMap = false;
        };

        if (_tLoc != "") then
        {
            _showLocation = true;
        }
        else
        {
            _showLocation = false;
        };

        //get map text
        if (_showMap && _tMap == "auto") then
        {
            private["_sector","_map","_template"];

            _sector = _position call _fn_getSector;

            if (_sector == -1) then
            {
                ["Map not recognized! Only 'Altis' and 'Stratis' are supported."] call BIS_fnc_error;

                _showMap     = false;
                _showLocation     = false;
            };

            _map = gettext (configfile >> "cfgworlds" >> worldname >> "description");

            _template = switch (_sector) do
            {
                case 7: {localize "STR_A3_SectorNorthWest"};
                case 8: {localize "STR_A3_SectorNorth"};
                case 9: {localize "STR_A3_SectorNorthEast"};
                case 4: {localize "STR_A3_SectorWest"};
                case 5: {localize "STR_A3_SectorCentral"};
                case 6: {localize "STR_A3_SectorEast"};
                case 1: {localize "STR_A3_SectorSouthWest"};
                case 2: {localize "STR_A3_SectorSouth"};
                case 3: {localize "STR_A3_SectorSouthEast"};

                default
                {
                    _showLocation = false;

                    //hardcoded for Stratis and Altis only
                    if (worldname == "Stratis") then
                    {
                        localize "STR_A3_NearStratis"
                    }
                    else
                    {
                        localize "STR_A3_NearAltis"
                    };
                };
            };

            _tMap = format[_template,_map];
        };

        //get current location text
        if (_showLocation && _tLoc == "auto") then
        {
            private["_locations","_loc"];

            _locations = nearestLocations [getPos player, ["NameCity","NameCityCapital","NameLocal","NameMarine","NameVillage"], 500];

            //filter-out locations without names
            {
                if (text _x == "") then
                {
                    locations set [_forEachIndex, objNull];
                };
            }
            forEach _locations; _locations = _locations - [objNull];

            if (count _locations > 0) then
            {
                _loc = _locations select 0;

                if ((getPos player) in _loc) then
                {
                    _tLoc  = text _loc;
                }
                else
                {
                    _tLoc = format[localize "STR_A3_NearLocation", text _loc];        //tolocalize: "Pobl? lokace %1"
                };
            }
            else
            {
                _tLoc = "";
                _showLocation = false;
            };
        };

        //get daytime data
        _tYear     = _date select 0;
        _tMonth = _date select 1;
        _tDay     = _date select 2;

        if (_tMonth < 10) then {_tMonth = format["0%1",_tMonth]};
        if (_tDay < 10) then {_tDay = format["0%1",_tDay]};

        //get date text
        _tDate = format["%1-%2-%3 ",_tYear,_tMonth,_tDay];

        //get time text
        _tTimeH = _date select 3;
        _tTimeM = _date select 4;

        if (_tTimeH < 10) then {_tTimeH = format["0%1",_tTimeH]};
        if (_tTimeM < 10) then {_tTimeM = format["0%1",_tTimeM]};

        _tTime = format["%1:%2",_tTimeH,_tTimeM];

        /*
        A3 fonts:

        PuristaLight
        PuristaMedium
        PuristaSemiBold
        PuristaBold
        */


        //sum the output params & print it
        _output =
        [
            [_tDate,""],
            [_tTime,"font='PuristaMedium'"],["","<br/>"]
        ];

        if (_showLocation) then
        {
            _output = _output + [[toUpper _tLoc,""],["","<br/>"]];
        };

        if (_showMap) then
        {
            _output = _output + [[_tMap,""],["","<br/>"]];
        };

        private["_handle"];

        //vertically align to cinematic border
        _handle = [_output,safezoneX - 0.01,safeZoneY + (1 - 0.125) * safeZoneH,true,"<t align='right' size='1.0' font='PuristaLight'>%1</t>"] spawn BIS_fnc_typeText2;

        waitUntil
        {
            scriptDone _handle;
        };

        BIS_fnc_camp_showOSD__running = false;
    };
    CHHQ_fnc_startingSetup = {
        private ["_cargo"];
        _veh = _this select 0;
        _side = _this select 1;
        _cargoInfo = _this select 2;
        _cargoType = _cargoInfo select 0;
        _cargoOffset = _cargoInfo select 1;
        _cargoDir = _cargoInfo select 2;
        _cargoCode = [_cargoInfo, 3, "", ["", {}]] call BIS_fnc_param;
        _composition = _this select 3;
            
        if (_veh getVariable ["CHHQ_deployed",false]) then {
            _veh lock 2;
            
            if (playerSide isEqualTo _side) then {        
                {
                    _obj = (_veh getVariable ["CHHQ_objArray", []]) select _forEachIndex;
                    _code = [_x, 3, "", ["", {}]] call BIS_fnc_param;
                
                    if !(_code isEqualTo "") then {
                        _code = [_code] call CHHQ_fnc_compileCode;
                        [_obj, _veh] spawn _code;
                    };
                } forEach _composition;
                
                [_veh, _side, "HQ"] call CHHQ_fnc_drawMarker;
                
                if (isNil "CHHQ_HQarray") then {
                    CHHQ_HQarray = [];
                };
                CHHQ_HQarray pushBack _veh;
                if (_veh getVariable ["CHHQ_index", -1] < 0) then {
                    _veh setVariable ["CHHQ_index", (CHHQ_HQarray find _veh) + 1, true];
                };
                
                _id = _veh addAction ["Undeploy HQ", "_this spawn CHHQ_fnc_undeploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"];
                _veh setVariable ["CHHQ_actionID",_id];
            };
        } else {
            _veh lock false;
            _veh lockCargo true;    
            _veh lockCargo [0, false];
            if (isServer) then {
                _cargo = createVehicle [_cargoType, [0,0,0], [], 0, "NONE"];    
                {_x enableSimulation true} forEach [_veh, _cargo];
                _cargo attachTo [_veh, _cargoOffset];
                        
                _veh setPos (getPos _veh);
                _veh setDir (getDir _veh);
                _cargo setDir _cargoDir;
                _veh setVariable ["CHHQ_cargo", _cargo, true];
            };
            _cargo = _veh getVariable ["CHHQ_cargo", objNull];
            
            if (playerSide isEqualTo _side) then {
                [_veh, _side, "MHQ"] call CHHQ_fnc_drawMarker;
                
                if (isNil "CHHQ_HQarray") then {
                    CHHQ_HQarray = [];
                };
                CHHQ_HQarray pushBack _veh;
                if (_veh getVariable ["CHHQ_index", -1] < 0) then {
                    _veh setVariable ["CHHQ_index", (CHHQ_HQarray find _veh) + 1, true];
                };
                
                _id = _veh addAction ["Deploy HQ", "_this spawn CHHQ_fnc_deploy", [_side, _cargoInfo, _composition], 0, false, true, "", "[_target, _this] call CHHQ_fnc_actionConditions"];    
                _veh setVariable ["CHHQ_actionID",_id];    

                [[_veh, "cargo"], "CHHQ_fnc_deleteVehicleEH", false] call BIS_fnc_MP;    

                if !(_cargoCode isEqualTo "") then {
                    _cargoCode = [_cargoCode] call CHHQ_fnc_compileCode;
                    [_cargo, _veh] spawn _cargoCode;
                };            
            };
        };
    };
    CHHQ_fnc_updateTeleportActions = {
        _obj = _this select 0;
        
        {
            _obj removeAction _x;
        } forEach (_obj getVariable ["CHHQ_actionIDarray",[]]);
        
        _actionIDarray = [];
        {
            _vehString = "CHHQ_HQarray select " + str _forEachIndex;
            _actionText = if (count CHHQ_HQarray > 1) then {format ["Move to HQ-%1", _x getVariable ["CHHQ_index", -1]]} else {"Move to HQ"};
            _id = _obj addAction [_actionText, "_this spawn CHHQ_fnc_teleportToHQ", [_x], 6, true, true, "", format ["[_target, _this, %1] call CHHQ_fnc_teleportActionConditions", _vehString]];
            _actionIDarray pushBack _id;
        } forEach CHHQ_HQarray;
        _obj setVariable ["CHHQ_actionIDarray", _actionIDarray];
    };
    CHHQ_fnc_clearNullFromArray = {
        [] spawn {
            waitUntil {!isNil "CHHQ_HQarray"};
            for "_i" from 0 to 1 step 0 do {
                waitUntil {{isNull _x} count CHHQ_HQarray > 0};
                CHHQ_HQarray = CHHQ_HQarray - [objNull];
            };
        };
    };

    waitUntil {time > 1};
    _obj = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
    _side = [_this, 1, sideUnknown, [sideUnknown]] call BIS_fnc_param;
    CHHQ_showMarkers = if (isNil "CHHQ_showMarkers") then {true} else {CHHQ_showMarkers};

    if (_side isEqualTo sideUnknown && toLower typeOf _obj != toLower "MapBoard_altis_F") then {
        _sideNum = getNumber (configFile >> "CfgVehicles" >> typeOf _obj >> "side");
        _side = switch _sideNum do {
            case 0: {east};
            case 1: {west};
            case 2: {resistance};
            default {sideUnknown};
        };
    };
    [] call CHHQ_fnc_clearNullFromArray;
    switch (toLower typeOf _obj) do {
        case (toLower "B_Truck_01_transport_F"): {
            _composition = [["Land_PowerGenerator_F",[-2.99756,2.07959,0.0971174],180.556],["CamoNet_BLUFOR_big_F",[0.013916,-0.0551758,0.0971174],337.248],["Land_ToiletBox_F",[3.71655,3.98242,0.097096],181.571],["MapBoard_altis_F",[4.04272,1.50049,0.0449162],359.984],["Land_CampingTable_F",[-3.40649,-1.95361,0.0971169],252.548],["Land_CampingChair_V1_F",[-4.34302,-1.66504,0.100242],253.27],["Land_Cargo20_grey_F",[4.11963,-0.677246,0.0971179],271.612,{_this animate ["Door_1_rot",1]; _this animate ["Door_2_rot",1]}]];
            _cargoInfo = ["Land_Cargo20_grey_F",[0.045,-2.31,1.15],270,{_this setVariable ['bis_disabled_Door_1',1]; _this setVariable ['bis_disabled_Door_2',1]}];
            [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;
        };
        case (toLower "O_Truck_02_transport_F"): {
            _composition = [["CamoNet_OPFOR_big_F",[0.0947266,-0.0610352,0.0315285],345.578],["Land_PowerGenerator_F",[-2.4873,2.33643,0.0315285],182.122],["Land_WaterTank_F",[3.85596,0.42627,0.0315242],4.92499],["Land_CampingTable_F",[-2.77075,-1.10254,0.031528],276.314],["Land_CampingChair_V1_F",[-3.8562,-0.631348,0.0346532],288.003],["Land_Cargo10_sand_F",[3.70703,-2.79932,0.0315285],274.286]];    
            _cargoInfo = ["Land_Cargo10_sand_F",[0.07,-2,0.5],270];
            [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;
        };
        case (toLower "I_Truck_02_transport_F"): {
            _composition = [["CamoNet_INDP_big_F",[0.0947266,-0.0610352,0.0315285],345.578],["Land_PowerGenerator_F",[-2.4873,2.33643,0.0315285],182.122],["Land_WaterTank_F",[3.85596,0.42627,0.0315242],4.92499],["Land_CampingTable_F",[-2.77075,-1.10254,0.031528],276.314],["Land_CampingChair_V1_F",[-3.8562,-0.631348,0.0346532],288.003],["Land_Cargo10_military_green_F",[3.70703,-2.79932,0.0315285],274.286]];    
            _cargoInfo = ["Land_Cargo10_military_green_F",[0.07,-2,0.5],270];        
            [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;
        };
        case (toLower "O_Truck_03_transport_F"): {
            _composition = [["Land_PowerGenerator_F",[-2.74097,0.837891,0.0376329],182.12],["Land_CampingTable_F",[-3.02441,-2.60107,0.0376248],276.309],["Land_CampingChair_V1_F",[-4.10986,-2.13037,0.0407581],288.114],["Land_FieldToilet_F",[4.37451,-0.489258,0.0376129],195.192],["Land_Cargo10_sand_F",[3.79224,-3.17822,0.0376348],285.205],["CamoNet_OPFOR_big_F",[0,-0.568848,0.119837],350.522]];
            _cargoInfo = ["Land_Cargo10_sand_F",[0.07,-3.46,0.8],270];
            [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;
        };
        case (toLower "B_G_Van_01_transport_F"): {
            _composition = [["CamoNet_BLUFOR_big_F",[0.0947266,-0.0610352,0.0315285],345.578],["Land_Portable_generator_F",[-2.4873,2.33643,0.0315285],182.122],["Land_WaterBarrel_F",[3.85596,0.42627,0.0315242],4.92499],["Land_CampingTable_F",[-2.77075,-1.10254,0.031528],276.314],["Land_CampingChair_V1_F",[-3.8562,-0.631348,0.0346532],288.003],["CargoNet_01_box_F",[3.70703,-2.79932,0.0315285],274.286]];
            _cargoInfo = ["CargoNet_01_box_F",[0,-1.2,0],0];
            [_obj, _side, _cargoInfo, _composition] call CHHQ_fnc_startingSetup;    
        };
        default {
            waitUntil {!isNil "CHHQ_HQarray"};
            [_obj] call CHHQ_fnc_updateTeleportActions;
            [CHHQ_HQarray, {[[_obj], "CHHQ_fnc_updateTeleportActions", _side] call BIS_fnc_MP}] call CHHQ_fnc_arrayUpdateEH;
        };
    };

     


  2. 15 minutes ago, darkxess said:

    You knew exactly what I meant, he wanted someone to carry on his work, not just give to someone without the dedication to carry it on and give up after a few months or see how such of a task/cost it was then passing it once more to another person

    Yes, deleted are better 🙄

    17 minutes ago, SzepyCZ said:
      15 minutes ago, darkxess said:


    THIS PEOPLE ^^ is exactly why you did not get your files! Thank people like @SzepyCZ 

    No. The files were lost because you decided to delete them. Not even Foxhound, the one who had to choose someone appropriate to maintain his legacy. You. There were 150k registered users. How many were disrespectful? 100? You should assume two things. One that all this was for money, there is no need to be ashamed. And the other, that the decision to delete the files was yours, putting yourself in the role of executioner of the knowledge and work of thousands of people.

    5 minutes ago, fingolfin said:

    But anyhow, since the files are gone there is no use debating this any further... Kind of sad, that this turn of events will leave everyone disappointed.

      Sadly you´re rigth.

    • Like 6

  3. I  made a small contribution to the comunity . Foxhound without asking  published it in AH. There was no problem, as I wanted to share mi work. Then, I found he was asking for money..... And later his friend (It seems as a second  Foxhound account to me) post he deletes all....I guess, that he was afraid about legal problems regarding selling content created by 3rd parties or a rage quit properly form a child.  FX owed the community. He was making money sharing content not created by him. no one asked him to share the benefit of this, but at leas he could have had a more elegant output by creating a torrent for example. Justifying your actions is unfortunate. It was always about money. May it serve us as learning as a community. It is a shame the loss, but we will continue forward, creating, sharin, etc.... The world keeps spinning, with or without AH .AH will always be a good memory. Foxhound no.

    1 hour ago, darkxess said:

    I deleted them!

    • Like 2

  4. Well, i don't know if this is considered an addon, it just addsnew  images to the ACE3 tagging  functionality. Anyway, I am happy with the result, although I will continue working with this, adding textures and more images. Thanks to the ACE 3 team, I hope you enjoy vandalizing Arma 3 maps.


    https://steamcommunity.com/sharedfiles/filedetails/?id=2371766923

    • Like 3

  5. Hello everyone. I am trying to add some tags to ACE tagging. I made it from the description.ext method and works fine,  but I want to make a PBO to share it. I can compress the PBO, but I get "ace_tags.PBO outdated" every time I load a mission. I guess I am making mistakes in the config.cpp so I post it here so someone can help me if possible. Thanks

    My config:
     

    class CfgPatches
    {
    	class Grafitti
    	{
    		author="Guevara";
    		name="Grafitti";
    		url="https://www.arma3.com";
    		requiredAddons[]=
    		{
    			""
    		};
    		version=0.1
    		versionStr="0.1";
    		versionAr[]={0,1};
    		units[]={};
    		weapons[]={};
    	};
    
    class ACE_Tags {
        class yourTagClass {
            displayName = "My Tag";  // Name of your tag being displayed in the interaction menu
            requiredItem = "ACE_SpraypaintBlack";  // Required item to have in the inventory to be able to spray your tag (eg. `"ACE_SpraypaintBlack"`, `"ACE_SpraypaintRed"`, `"ACE_SpraypaintGreen"`, `"ACE_SpraypaintBlue"` or any custom item from `CfgWeapons`)
           textures[] = {"images\che2.paa","images\VP.paa","images\penguin.paa", "images\morito.paa", "images\12MONOS.paa" , "images\12.paa" , "images\canalla.paa",};
            materials[] = {"path\to\material.rvmat"}; // Optional: List of material variations (one is randomly selected). Keep empty if you don't need a custom material.
            icon = "images\ic.paa";  // Icon being displayed in the interaction menu
            tagModel = "UserTexture1m_F"; // Optional: The 3D Model that will be spawned with the texture on it, can either be CfgVehicles classname or P3D file path.
        };
    };
    };

     


  6. 48 minutes ago, POLPOX said:

    That's not even correct syntax for if, nor sqf. Do just like before.

    
    if (magazinesAmmo box1 findif {_x#0 == "DemoCharge_F"} != -1) then {
    	box2  addMagazineCargoGlobal  ["SatchelCharge_F", 10]
    };

    DemoCharge_F and SatchelCharge_F aren't correct ammo name BTW (at least in vanilla Arma 3), so this won't work also. You probably looking for those classes: DemoCharge_Remote_Mag and SatchelCharge_Remote_Mag. 

    yes Polpox,  thanks a lot, you re rigth with the classnames.
    I changedit. 

    Now script show no error but still  nothing hapens.


  7. want to make a script in which if certain conditions are met, a specific result is produced. Specifically what I am trying to do is an IED factory. There are two requirements inicially: The presence of a "technician" ( will do with a trigger) and the other the raw material. The raw material must be placed in" box a "and "box B" will show the finished product. this is what i tried so far and i can't get it to work:

     

    Spoiler

     _items = magazinesAmmo box1;

    if ( "DemoCharge_F" in _items) then { box2  addMagazineCargoGlobal  ["SatchelCharge_F", 10]  }

    Can someone say me what I m doing wrong? Thanks i advance


  8. 3 hours ago, Dedmen said:
    11 hours ago, Texeiro said:

    while {_ammo <= 10} do
    { crate addMagazineCargo ["SatchelCharge_Remote_Mag", 1];

    Your _ammo variable is never updated. It will always keep the same value, so either you are adding infinite magazines or none.

    I thought I had defined _ammmo in the previous line

    Yes you re rigth, It must be used AddmagazineCargoGlobal.

    The typos, are typos in  here, in the sqf are ok.

    3 hours ago, Dedmen said:
    11 hours ago, Texeiro said:

    I tried also defining a varible as _explosive = SatchelCarge_Remote_Mag, but for some reason it wasn´t "readable".

    You tried to read a variable called "SatchelCarge_Remote_Mag" which most likely is not defined.

    mmmm....Again I m making an error defining a variable...I thougth that _explosive = SatchelCarge_Remote_Mag was ok. Please, could you tell me whats the right way to do it?

     

    And thank you Dedmen,  vey much for your answer and your patience. 


  9. Quote

     

    Tried a  couple new approarchs,, didn t work....

     

    This:

    _crateCont = getItemCargo crate;
    _ammo = _crateCont select 1;
    hint format [" satchels %1", _crateCont select 1 ];
    while {_ammo <= 10} do
    { crate addMagazineCargo ["SatchelCharge_Remote_Mag", 1];
    sleep 2;

    -----------------------------------------------------------------------------

    adn this:

    magazinesqw = count (magazineCargo crate);
    while {magazinesqw <= 10}  do
     { crate addMagazineCargo ["SatchelCharge_Remote_Mag", 1];
    sleep 1;
                  hint format ["Total explosives %1",magazinesqw + 1];
                 sleep 0.5;
                   magazinesqw = magazinesqw + 1; };

     

    with magazomesqw = 0 in init.sqf

    REfreshing what I m trying to do:

    Bombmaker sits in area factory.

    Bombmaker is alive

    Bombmaker has material (i.e. C4 in the ammobox)

    Bombmaker build an IED each 30 minutes and puts it in ammo box.

    If a player takes 1/2/3  IED´s, and above conditions are still on------->

    bombmaker will buil 1/2/3  IED´s in the next 3 minutes

    Of course, if player take explosives from ammo box, loop would work again...

     

    I tried also defining a varible as _explosive = SatchelCarge_Remote_Mag, but for some reason it wasn´t "readable".

    Please, If someone could give me a hand at this...

     

     


  10. thanks Mr. H! I ll check your script, but I want a limited cargo in box, not unlimited. I ll explain my whole intention:

    I want to set an IED factory with this logic:

    Bombmaker sits in area factory.

    Bombmaker is alive

    Bombmaker has material (i.e. C4 in the ammobox)

    Bombmaker build an IED each 30 minutes and puts it in ammo box.

    If a player takes 1/2/3  IED´s, and above conditions are still on------->

    bombmaker will buil 1/2/3  IED´s in the next 3 minutes.

     


  11. Hi, Im trying to make a script to refiil an ammo box only with explosives, until a max number.

    Also, I want to made that when I take some explosives out of the box, the box refill again.

    What I did:

     

    _magazines = count (magazineCargo crate);
    for [{_magazines=1},{_magazines<=10},{_magazines=_magazines+1}] do
     { crate addMagazineCargo ["SatchelCharge_Remote_Mag", 1];
    sleep 1;
                  hint format ["Total explosives %1",_magazines + 1];
                 sleep 0.5;
                   _magazines = _magazines + 1;
    };

    That code fill the box, but when I take a cargo out, it doesn´t refill. Could anyone help me?

     

     


  12. Maybe this is the starting point to a good use of "Papers please mod" (https://steamcommunity.com/sharedfiles/filedetails/?id=1249483448) It has a few interactions and functions:

    Functions:

    Spoiler

    Functions:
    ----------------------------------------------------------------------------
    Function: PapersPlease_fnc_documents

    Description:
        Gets a list of all documents a unit has
     
    Parameters:
        _unit - The unit to check [Unit]
        
    Returns:
        List of documents the unit has [Array of strings]

    Example:
        _documents = player call PapersPlease_fnc_documents;
        
        _allowEntry = ("PapersPlease_PermitEntry" in _documents);
    ----------------------------------------------------------------------------
    Function: PapersPlease_fnc_giveDocument

    Description:
        Forces the _unit to give _document to _target if possible
        
        *_unit and _target must be < 5m apart
        *_document must be in items _unit
     
    Parameters:
        _target - The unit receiving the document [Unit]
        _unit - The unit giving the document [Unit]
        _document - Classname of the document [String]
        
    Returns:
        Success [Boolean]

    Example:
        [_unit, player, "PapersPlease_PermitEntry"] call PapersPlease_fnc_giveDocument
    ----------------------------------------------------------------------------
    Function: PapersPlease_fnc_showDocument

    Description:
        Forces the _unit to show _document to _target if possible
        
        *_unit and _target must be < 5m apart
        *_document must be in items _unit
     
    Parameters:
        _target - The unit being show the document [Unit]
        _unit - The unit showing the document [Unit]
        _document - Classname of the document [String]
        
    Returns:
        Success [Boolean]

    Example:
        [_unit, player, "PapersPlease_PermitEntry"] call PapersPlease_fnc_showDocument
    ----------------------------------------------------------------------------

    CBA Events:
    ----------------------------------------------------------------------------
    Event Name: PapersPlease_shownDocument

    Description:
        Thrown when a unit shows another unit papers successfully

    Locality:
        Global

    Arguments:
        _target - The unit being show the document [Unit]
        _unit - The unit showing the document [Unit]
        _document - Classname of the document [String]
    ----------------------------------------------------------------------------
    Event Name: PapersPlease_givenDocument

    Description:
        Thrown when a unit gives another unit papers successfully

    Locality:
        Global

    Arguments:
        _target - The unit being given the document [Unit]
        _unit - The unit giving the document [Unit]
        _document - Classname of the document [String]
    ----------------------------------------------------------------------------

     


  13. 10 hours ago, opusfmspol said:

    If not already, for debugging purposes, use -showScriptErrors in startup params and do not use -noLogs.

    - Using -showScriptErrors gives a black error box on screen when an error occurs.  Let's you know when there is an error encountered which is quite helpful.

    - Not using -noLogs will catch errors in the .rpt log and lets you review the encountered error.  But using -noLogs prevents the .rpt from logging errors

    Great! I will do!

     

    10 hours ago, opusfmspol said:

    The problem is here . . .

    On 4/2/2019 at 6:55 PM, Texeiro said:

    _objType = ["Land_TentA_F","Land_TentDome_F,"Land_Sleeping_bag_F",];

    "Land_TentDome_F" is missing a string quote ( " ) at its end, and there is a comma ( , ) after last item of the array.  One would think it should have errored on those.

     

    and here . . .

    On 4/2/2019 at 6:55 PM, Texeiro said:

    obj1 = _objType createVehicle [0,0,0];  

    createVehicle command needs a string classname to create.  You made _objType an array.  createVehicle can't do anything with it.  One would think it should have given a "type array, expected string" error on that.

    I ll check if I could modify this to work.

     

    10 hours ago, opusfmspol said:

    An array could be used, but it really is simpler to create three objects in a row from string.

    I thought that!  At least I am on the rigth path!

    Thank you very much for your help Opus!

×