Announcement

Collapse
No announcement yet.

Private Timer

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Private Timer

    For the training drill missions we thought it might be handy to have an in-game timer available while running drills. This timer is called a private timer because it only displays results to the player who called the scroll menu "Start Private Timer".

    To add this script as it is written you need to:
    1. have a folder within your mission "Unk" and in it put this file named "clientOnlyTimer.sqf"
    2. in your initPlayerLocal.sqf file in your root folder put the following line in
    Code:
    _startPrivateTimerScript = ["player","player",1,"firstRun"]execVM "Unk\clientOnlyTimer.sqf";
    Here is the script:

    Code:
    //client timer that displays only to this client
    //start this by adding the following line to initPlayerLocal.sqf
    //_startPrivateTimerScript = ["player","player",1,"firstRun"]execVM "Unk\clientOnlyTimer.sqf";
    
    _firstRun = _this select 3;
    _lastActionID = _this select 2;
    clientStartTimerAction = 78;
    clientEndTimerAction = -78;
    _availableActionTexts = [];
    _foundStopAction = -1;
    _foundStartAction = -1;
    _allCurrentActionIDs = actionIDs player;
    
    if  (_firstRun == "firstRun") exitWith {player addAction ["Start Private Timer","Unk\clientOnlyTimer.sqf","notFirstRun",-999,false,true,"","_target == player",-1,true];};
    
    //get the list of current addActions
    {_availableActionTexts pushBack ((player actionParams _x) select 0)}forEach _allCurrentActionIDs;
    _foundStartAction = _availableActionTexts find "Start Private Timer";
    _foundStopAction = _availableActionTexts find "Stop Private Timer";
    player removeAction _lastActionID;
    
    if (_foundStartAction == -1) then
    {
        clientStartTimerAction = player addAction ["Start Private Timer","Unk\clientOnlyTimer.sqf","notFirstRun",-999,false,true,"","_target == player",-1,true];
        totalTimer = time - startTimer;
        hint format ["Timer = %1 seconds.", totalTimer];
        totalTimer = 0;
    } else {
        clientEndTimerAction = player addAction ["Stop Private Timer","Unk\clientOnlyTimer.sqf","notFirstRun",999,false,true,"","_target == player",-1,true];
        hint "The timer has started...";
        startTimer = time;
    };
    Last edited by Unkl; 11-12-2016, 11:59 AM.
    |TG-189th| Unkl
    ArmA 3 Game Officer
    Dean of Tactical Gamer University
    189th Infantry Brigade Member

    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN

  • #2
    Note: this script does not display an ongoing timer on purpose. It is event driven which means there is no ongoing process that would affect it's performance or accuracy by adding work to the CPU. If you need a display, the in-game watch will work.
    |TG-189th| Unkl
    ArmA 3 Game Officer
    Dean of Tactical Gamer University
    189th Infantry Brigade Member

    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN

    Comment

    Connect

    Collapse

    TeamSpeak 3 Server

    Collapse

    Advertisement

    Collapse

    Twitter Feed

    Collapse

    Working...
    X