Jump to content
Soapy_87

Help needed, Battlefield-like mCom System

Recommended Posts

Hello! I have played about with the editor forever but now I'm starting to get into scripting. I have come up with an idea to implement a battlefield-like "mCom" system. I am in need of some help, I'm not sure how to script correctly and am struggling to get this to work.

 

I have an sqf called "mCom" in it is the following;

mCom1Armed = false
mCom1Destroyed = false;

if (playerSide = WEST) then
[
    [
    _mCom1,    //// Object to add Action to, create this object in editor
        "Arm mCom",    //// Add Action title
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    //// Icon shown while Idle
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    //// Progression Icon shown
        "_this distance _target < 3",    //// Condition for the action to be shown
        "_caller distance _target < 3",  //// Condition for the action to be in progress
        {_this call s_fnc_armingStarted},    //// Code exectuted when Action starts
        {},    //// Code executed on every progression tick
        {_this call s_fnc_armingComplete, ,mCom1Armed = true},    //// Code on completion
        {_this call s-fnc_armingCancelled},    //// Code on interrupted
        [],
        15,    //// Activation duration (seconds)
        0,    //// Priority (not sure what this is for)
        true,    //// Remove on completion
        false,    //// Show in unconscious state
    ] remoteExec ["BIS_fnc_holdActionAdd", -2, _mCom1];
];

 

I have another sqf called "countDown" with the following code;

_timer = 300;

[
    _timer = _timer -1;
] call BIS_fnc_loop;

hint "The mCom has been Armed! /n it will detonate in 5 minutes!";

if (_timer = < 120 ) then
[
    hint "Two minutes until the mCom detonates!";
];


if (_timer = < 60 ) then
[
    hint "One minute until the mCom detonates!";
];


if (_timer = < 30 ) then
[
    hint "30 seconds until the mCom detonates!";
];


if (_timer = < 1) then
[
    bomb = "Bo_GBU12_LGB" create vehicle getmarkerPos "mCom1Mark";
    mCom1Destroyed = true;
];

Then I have a folder filled with custom functions. All sqf's

One being "s_fnc_armingStarted";

if (playerSide = WEST && mCom1Armed = true) then
[
    hintSilent "Your team are arming the mCom";
];

if (player side = EAST && mCom1Armed = true) then
[
    hintSilent "The enemy team are arming the mCom";
];

Another; "s_fnc_armingComplete";
 

if (playerSide = WEST && mCom1Armed = true) then
[
    hintSilent "Your team have armed the mCom!";
];

if (player side = EAST && mCom1Armed = true) then
[
    hintSilent "The enemy team have armed the mCom! /n quickly disarm it!";
];

execVM "countDown.sqf";

And one more, "s_fnc_armingCancelled";
 

if (playerSide = WEST && mCom1Armed = true) then
[
    hintSilent "You have stopped Arming the mCom!";
];

if (player side = EAST && mCom1Armed = true) then
[
    hintSilent "The enemy team have stopped Arming the mCom";
];

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×