I am trying to add triggers

Mrpotpot

New Member
Hello, I am currently scripting my own fuel pump script, it is working... YAY.
But, I do not know where to paste the triggers from the main mission.sql to the dayz_mission mission.sql. Can anyone help me?

Code:
activateAddons [
];
 
activateAddons [];
initAmbientLife;
 
_this = createCenter west;
_center_0 = _this;
 
_this = createTrigger ["EmptyDetector", [9498.5029, 2012.4744, 6.3388586]];
_this setTriggerArea [7, 9, 4.6810107, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [10, 10, 10, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\x_reload.sqf"";", ""];
fp1 = _this;
_trigger_8 = _this;
 
_this = createTrigger ["EmptyDetector", [9498.5195, 2012.5531, -0.025699139]];
_this setTriggerArea [7, 9, 4.6810107, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [1, 1, 1, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\wait.sqf"";", ""];
wait1 = _this;
_trigger_9 = _this;
 
_this = createTrigger ["EmptyDetector", [13391.027, 6604.5161, 6.4325647]];
_this setTriggerArea [7, 9, 75.5075, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [10, 10, 10, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\x_reload.sqf"";", ""];
fp1 = _this;
_trigger_12 = _this;
 
_this = createTrigger ["EmptyDetector", [13391.098, 6604.5322, 0.066878796]];
_this setTriggerArea [7, 9, 75.5075, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [1, 1, 1, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\wait.sqf"";", ""];
wait1 = _this;
_trigger_13 = _this;
 
_this = createTrigger ["EmptyDetector", [2685.0142, 5604.4053]];
_this setTriggerArea [7, 9, -83.697342, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [10, 10, 10, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\x_reload.sqf"";", ""];
fp1 = _this;
_trigger_16 = _this;
 
_this = createTrigger ["EmptyDetector", [2684.9399, 5604.4131, -6.3643494]];
_this setTriggerArea [7, 9, -83.697342, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [1, 1, 1, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\wait.sqf"";", ""];
wait1 = _this;
_trigger_17 = _this;
 
_this = createTrigger ["EmptyDetector", [4731.3013, 6379.9253]];
_this setTriggerArea [7, 9, 72.106812, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [10, 10, 10, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\x_reload.sqf"";", ""];
fp1 = _this;
_trigger_20 = _this;
 
_this = createTrigger ["EmptyDetector", [4731.3901, 6379.937, -6.3588562]];
_this setTriggerArea [7, 9, 72.106812, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [1, 1, 1, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\wait.sqf"";", ""];
wait1 = _this;
_trigger_21 = _this;
 
_this = createTrigger ["EmptyDetector", [10728.077, 10783.682]];
_this setTriggerArea [7, 9, 106.38529, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [10, 10, 10, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\x_reload.sqf"";", ""];
fp1 = _this;
_trigger_24 = _this;
 
_this = createTrigger ["EmptyDetector", [10728.146, 10783.675, -6.3701935]];
_this setTriggerArea [7, 9, 106.38529, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [1, 1, 1, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\wait.sqf"";", ""];
wait1 = _this;
_trigger_25 = _this;
 
_this = createTrigger ["EmptyDetector", [12994.314, 10074.972, 6.3838997]];
_this setTriggerArea [7, 9, -80.08828, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [10, 10, 10, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\x_reload.sqf"";", ""];
fp1 = _this;
_trigger_28 = _this;
 
_this = createTrigger ["EmptyDetector", [12994.243, 10074.991, 0.018610001]];
_this setTriggerArea [7, 9, -80.08828, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [1, 1, 1, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\wait.sqf"";", ""];
wait1 = _this;
_trigger_29 = _this;
 
_this = createTrigger ["EmptyDetector", [2997.6738, 7471.9941]];
_this setTriggerArea [7, 9, 94.951355, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [10, 10, 10, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\x_reload.sqf"";", ""];
fp1 = _this;
_trigger_32 = _this;
 
_this = createTrigger ["EmptyDetector", [2997.748, 7471.98, -6.3665771]];
_this setTriggerArea [7, 9, 94.951355, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [1, 1, 1, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\wait.sqf"";", ""];
wait1 = _this;
_trigger_33 = _this;
 
_group_1 = createGroup _center_0;
 
_unit_6 = objNull;
if (true) then
{
  _this = _group_1 createUnit ["Camo1_DZ", [6684.5503, 2980.4333, 0], [], 0, "CAN_COLLIDE"];
  _unit_6 = _this;
  _this setUnitAbility 0.60000002;
  if (true) then {_group_1 selectLeader _this;};
  if (true) then {selectPlayer _this;};
  if (true) then {setPlayable _this;};
};
 
_this = createTrigger ["EmptyDetector", [6703.0327, 2995.3855]];
_this setTriggerArea [7, 9, -210.77126, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [10, 10, 10, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\x_reload.sqf"";", ""];
fp1 = _this;
_trigger_40 = _this;
 
_this = createTrigger ["EmptyDetector", [6703.0664, 2995.3074, -6.3655138]];
_this setTriggerArea [7, 9, -210.77126, true];
_this setTriggerActivation ["ANY", "PRESENT", true];
_this setTriggerTimeout [1, 1, 1, true];
_this setTriggerStatements ["this and ((getpos (thislist select 0)) select 2 < 1)", "_xhandle= [(thislist select 0)] execVM ""scripts\wait.sqf"";", ""];
wait1 = _this;
_trigger_41 = _this;
 
processInitCommands;
runInitScript;
finishMissionInit;
 
Refuel.sqf
Code:
private ["_target", "_caller", "_id", "_isNearFeed"];
 
_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;
 
if (isNil "ib_refueling_in_progress") then { ib_refueling_in_progress = false; };
 
if (!ib_refueling_in_progress) then
{
    _isNearFeed = count ((position _caller) nearObjects ["Land_A_FuelStation_Feed", 10]) > 0;
 
    if (!_isNearFeed) then
    {
        titleText ["You must be near a fuel station pump.", "PLAIN DOWN", 3];
        titleFadeOut 3;
    }
    else
    {
        ib_refueling_in_progress = true;
 
        titleText ["Refueling", "PLAIN", 3];
 
        while {(vehicle _caller == _target) and (local _target)} do
        {
            private ["_velocity", "_fuel"];
           
            _velocity = velocity _target;
            _fuel = fuel _target;
 
            if ((_velocity select 0 > 1) or (_velocity select 1 > 1) or (_velocity select 2 > 1)) exitWith { };
            if (_fuel >= 1.0) exitWith { };
 
            sleep 0.5;
       
            _fuel = _fuel + 0.005;
 
            if (_fuel >= 1.0) then { _fuel = 1.0; };
 
            _target setFuel _fuel;
        };
 
        titleFadeOut 1;
 
        ib_refueling_in_progress = false;
    };
};

Addaction.sqf
Code:
private ["_vehicle", "_vehicle_refuel_id"];
 
_vehicle = objNull;
 
while {true} do
{
    if (!isNull player) then {
        private ["_currentVehicle"];
        _currentVehicle = vehicle player;
 
        if (_vehicle != _currentVehicle) then
        {
            if (!isNull _vehicle) then {
                _vehicle removeAction _vehicle_refuel_id;
                _vehicle = objNull;
            };
 
            if (_currentVehicle != player) then {
                _vehicle = _currentVehicle;
                _vehicle_refuel_id = _vehicle addAction ["Refuel", "actions\refuel.sqf", [], -1, false, false, "", "vehicle _this == _target && local _target"];
            };
        };
    };
 
    sleep 2;
}

atleast add that in your init.sqf :

Code:
[] execVM "addaction.sqf";
 
Back
Top