Jump to content

wyattwic

Member
  • Content Count

    275
  • Joined

  • Last visited

  • Medals

Posts posted by wyattwic


  1. I made a good number of mistakes in that, will be editing it soon.

    Its a code blurb, this is right off the top of my head with limited bug testing so far.

    I am going to be using it in my next mission release.

    I did (isDedicated && isServer) for safety and paranoia sakes. If I remember correctly, I did that because at one point in time I was under the impression that isdedicated was true for headless clients.

    EDIT: If a moderator could move this to the scripting section, I may have posted in the wrong area.


  2. Hello everyone,

    Just today I decided to do a nitty gritty update to my old timekeeper.sqf from ArmA2. I have upgraded a few features and changed things around for A3.

    Features

    - Fast time via SetDate (Weather is not effected, easier on clients apparently. Only the sun, moon and stars observe the change in time.)

    - Reduced light cycles (Choose to cut the day or night in half)

    How to install

    1. Run on all clients and server via execvm. No variables should be passed via execvm.

    2. Set the following global variables via starting parameters or via script.

    Shorttime - [0, Disabled],[1, Daytime will be cut in half],[2, Nighttime will be cut in half]

    fasttime - [For every minute, skip X minutes - 0 will Disable]

    starttime - [Hour of the day you would like to start. This will not change day, month, year or minute set via the editor.]

    rundebug - [True will provide your debug log with plenty of information. False will do nothing, nil will flood your RPT]

    Here is my code -

    //[AWG] Wyatt's time management script
    /*    Disambiguation:
           This script is made to manage a few key game play features.
               - Game starting time
               - Fast time (We will use setdate to avoid clouds skipping around)
    
           Start time:  I want to keep this option simple.   I will give them the options of 
           sunrise, noon, sunset, midnight.
    
           Fast time: I know there has to be over a dozen different published ways to forward
           through time.  This script uses the more complex setdate wich in contrast to skiptime, advances players through time 
           without the lower clouds jumping around.   Forecast and clouds stay the same.
    
       Important notes and operation methodology:
           This script must be started via the global init file as it must be ran on the
           server as well as the client.
           Clients will check with the server every 10 minutes to make sure that the client
           time is correct and to avoid dsync.
    */
    private ["_date","_tm","_ct","_min","_hour","_day","_month","_year"];//Set game time in accordance to parameters.  JIP ready! XD
    if (isDedicated && isServer) then {
       PublicServerTime = date; 
       PublicServerTime set [3,starttime];
       publicvariable "PublicServerTime"; 
       setdate PublicServerTime;
       if (rundebug) then {diag_log text format["timekeeper.sqf - Server - Initial time sync has been pushed to clients as hour %1.",PublicServerTime select 3];};
       };
    
    
    if (!isDedicated && !isServer) then {
       waituntil {!isnil "PublicServerTime"};
       setdate PublicServerTime;
       if (rundebug) then {diag_log text format["timekeeper.sqf - Client - Initial time sync completed with server - %1", PublicServerTime];};
       };
    _ct = 0;                /*loop counter.  Used for counting the minutes since last server sync.*/
    //Fast time and skiptime below
    if (fasttime == 0) then {  /*Parameters requested no fast time.   24 hours in real life, 24 hours in game.  This if statement is here for good coding practices and debug log purposes.*/
    
     if (rundebug) then {diag_log text format["timekeeper.sqf - Fasttime parameter returned %1.  Fast time will not run.",fasttime];};
      			if (shorttime == 0) then {
    			if (rundebug) then {diag_log text format["timekeeper.sqf - Shorttime parameter returned %1.  Short days and nights will not run.",shorttime];};
    		};
    
    		if (shorttime == 1) then {
    			if (rundebug) then {diag_log text format["timekeeper.sqf - Shorttime parameter returned %1.  Daytime will be cut in half.",shorttime];};
    			while {true} do {
               sleep 60;                 /*Sleep one minute*/
               _date = date;            /*Get the date/time*/
    
               _min = _date select 4;    /*Turn the date array into something we can easily manipulate.*/
               _hour = _date select 3;
               _day = _date select 2;
               _month = _date select 1;
               _year = _date select 0;
    
    
    			if (_hour >= 5 && _hour < 19)   then {
    			if (rundebug) then {diag_log text format["timekeeper.sqf - Shorttime parameter returned %1 and it is %2 hour.  Daytime will be cut in half.",shorttime,_hour];};
    			_min = _min + 1; //daytime - If the sun is up and I am enabled, fast time is doubled during this period.
    
    
    
    
               //The following are setdate syntax checks.
               if (_min > 59) then {_min = _min - 60; _hour = _hour + 1;/*If minutes added go out of date range, modify hours as needed.*/
                   if (_hour > 23) then {_hour = _hour - 24; _day = _day + 1;/*If hours go out of date range, modify days as needed.*/
                       if (_day > 31) then {_day = _day - 30;_month = _month + 1;/*If days go out of date range, modify months as needed.*/
                           if (_month > 12) then {_month = _month - 12; _year = _year + 1;/*If months go out of range, modify year as needed.*/
               };    };    };    };   /*If statement, inside if statement, etc.   Thought process is, if we don't have to fix minutes, we don't have to fix hours and so on.*/
    
               setdate [_year,_month,_day,_hour,_min]; /*Use setdate to set the manipulated date.*/
    
    		};
               /*everything from this point on is to prevent clients from dsyncing too much.*/
               _ct=_ct+1; /*This is the master sync control counter.  Adds 1 every cycle.*/
               if (_ct >= 10) then {  
                   if (isDedicated && isServer) then {PublicServerTime = date; publicvariable "PublicServerTime"; if (rundebug) then {diag_log text format["timekeeper.sqf - Server - Time sync has been pushed to clients."];};};
                   sleep (random 15);
                   if (!isDedicated && !isServer) then {setdate PublicServerTime; if (rundebug) then {diag_log text format["timekeeper.sqf - Client - Time sync completed with server"];};};
                   _ct = 0;
               };
           };/////////////////////////////////////////////////
    
    
    
    		};
    		if (shorttime == 2) then {
    			if (rundebug) then {diag_log text format["timekeeper.sqf - Shorttime parameter returned %1.  Night time will be cut in half.",shorttime];};
    		while {true} do {
               sleep 60;                 /*Sleep one minute*/
               _date = date;            /*Get the date/time*/
    
               _min = _date select 4;    /*Turn the date array into something we can easily manipulate.*/
               _hour = _date select 3;
               _day = _date select 2;
               _month = _date select 1;
               _year = _date select 0;
    
    
    
    			if !(_hour >= 5 && _hour < 19) then {
    			if (rundebug) then {diag_log text format["timekeeper.sqf - Shorttime parameter returned %1 and it is %2 hour.  Nighttime will be cut in half.",shorttime,_hour];};
    			_min = _min + 1; //nighttime - If the sun is down and I am enabled, fast time is doubled during this period.
    
    
    
    
               //The following are setdate syntax checks.
               if (_min > 59) then {_min = _min - 60; _hour = _hour + 1;/*If minutes added go out of date range, modify hours as needed.*/
                   if (_hour > 23) then {_hour = _hour - 24; _day = _day + 1;/*If hours go out of date range, modify days as needed.*/
                       if (_day > 31) then {_day = _day - 30;_month = _month + 1;/*If days go out of date range, modify months as needed.*/
                           if (_month > 12) then {_month = _month - 12; _year = _year + 1;/*If months go out of range, modify year as needed.*/
               };    };    };    };   /*If statement, inside if statement, etc.   Thought process is, if we don't have to fix minutes, we don't have to fix hours and so on.*/
    
               setdate [_year,_month,_day,_hour,_min]; /*Use setdate to set the manipulated date.*/
           };
               /*everything from this point on is to prevent clients from dsyncing too much.*/
               _ct=_ct+1; /*This is the master sync control counter.  Adds 1 every cycle.*/
               if (_ct >= 10) then {  
                   if (isDedicated && isServer) then {PublicServerTime = date; publicvariable "PublicServerTime"; if (rundebug) then {diag_log text format["timekeeper.sqf - Server - Time sync has been pushed to clients."];};};
                   sleep (random 15);
                   if (!isDedicated && !isServer) then {setdate PublicServerTime; if (rundebug) then {diag_log text format["timekeeper.sqf - Client - Time sync completed with server"];};};
                   _ct = 0;
               };
           };
    
    		};
    
    
      } else {
       if (rundebug) then {diag_log text format["timekeeper.sqf - Fast time is running with a modifier of 1 to %1.",fasttime];};
       _tm = fasttime;    /*Set time multiplier into local variable.*/
           while {true} do {
               sleep 60;                 /*Sleep one minute*/
               _date = date;            /*Get the date/time*/
    
               _min = _date select 4;    /*Turn the date array into something we can easily manipulate.*/
               _hour = _date select 3;
               _day = _date select 2;
               _month = _date select 1;
               _year = _date select 0;
    
    		_min = _min + _tm;
    
    		/*This section enables the half day/night setting*/
    		if (shorttime == 0) then {
    			if (rundebug) then {diag_log text format["timekeeper.sqf - Shorttime parameter returned %1.  Short days and nights will not run.",shorttime];};
    		};
    		if (shorttime == 1) then { 
    			if (rundebug) then {diag_log text format["timekeeper.sqf - Shorttime parameter returned %1 and it is %2 hour.  Daytime will be cut in half.",shorttime,_hour];};
    			if (_hour >= 5 && _hour < 19)   then {_min = _min + _tm}; //daytime - If the sun is up and I am enabled, fast time is doubled during this period.
    			};
    		if (shorttime == 2) then { 
    			if (rundebug) then {diag_log text format["timekeeper.sqf - Shorttime parameter returned %1 and it is %2 hour.  Nighttime will be cut in half.",shorttime,_hour];};
    			if !(_hour >= 5 && _hour < 19) then {_min = _min + _tm}; //nighttime - If the sun is down and I am enabled, fast time is doubled during this period.
    			};
    
    
    
               //The following are setdate syntax checks.
               if (_min > 59) then {_min = _min - 60; _hour = _hour + 1;/*If minutes added go out of date range, modify hours as needed.*/
                   if (_hour > 23) then {_hour = _hour - 24; _day = _day + 1;/*If hours go out of date range, modify days as needed.*/
                       if (_day > 31) then {_day = _day - 30;_month = _month + 1;/*If days go out of date range, modify months as needed.*/
                           if (_month > 12) then {_month = _month - 12; _year = _year + 1;/*If months go out of range, modify year as needed.*/
               };    };    };    };   /*If statement, inside if statement, etc.   Thought process is, if we don't have to fix minutes, we don't have to fix hours and so on.*/
    
               setdate [_year,_month,_day,_hour,_min]; /*Use setdate to set the manipulated date.*/
    
               /*everything from this point on is to prevent clients from dsyncing too much.*/
               _ct=_ct+1; /*This is the master sync control counter.  Adds 1 every cycle.*/
               if (_ct >= 10) then {  
                   if (isDedicated && isServer) then {PublicServerTime = date; publicvariable "PublicServerTime"; if (rundebug) then {diag_log text format["timekeeper.sqf - Server - Time sync has been pushed to clients."];};};
                   sleep (random 15);
                   if (!isDedicated && !isServer) then {setdate PublicServerTime; if (rundebug) then {diag_log text format["timekeeper.sqf - Client - Time sync completed with server"];};};
                   _ct = 0;
               };
           };
       };  

    Its not perfect, so feel free to let me know if you spot anything.

    EDIT: Fixed many variable errors, other noob mistakes.

    Changelog

    6/14/14 - Fixed Variable errors

    6/15/14 - Fixed mathematical errors - Currently the short days/nights do not work.


  3. Haven't heard of that function before. Ill try it shortly.

    ---------- Post added at 13:12 ---------- Previous post was at 11:21 ----------

    No luck... I attempted running the following script on a dedicated and local multiplayer game.

    //Force disconnect test script.  Run via execvm
    //Wyatt 6/11/14
    //This script is being ran locally on the client.
    
    _target = _this select 0;
    
    hint "script running";
    sleep 60;
    hint "about to send disconnect";
    fnc_forceDisconnect = { sendAUMessage [[netId _this], "ConnectTo: 10.1.2.3"]; };  
    hint "variable set";
    [_target, "fnc_forceDisconnect", _target, false] spawn BIS_fnc_MP;  
    hint "disconnect completed";
    

    No errors were generated in the rpt and all the hints were successful. On another note I changed the IP to a random local IP thats outside of my subnet.

    any other ideas?


  4. Would ending the mission disconnect him from the server?

    I am attempting to build a automatic idle kick script. Got the idle detection down perfectly, its just kicking them.

    ---------- Post added at 13:11 ---------- Previous post was at 13:07 ----------

    Shouldn't a dedicated box with running that command server side be considered a proper admin? How has this command changed since ArmA2?

    ---------- Post added at 14:51 ---------- Previous post was at 13:11 ----------

    Im starting to get annoyed... No mater the locality, variation or authorization of this command, it wont execute.

    servercommand "#kick PlayerName";

    servercommand "#kick PlayerID";

    servercommand "#exec kick PlayerName";

    servercommand "#exec kick PlayerID";

    I have also attempted without any # as well as # behind exec and kick.

    They all have been ran at least twice from the dedicated server side and authenticated admin on a dedicated server.

    It looks like this command just does not work anymore.


  5. Hello again everyone!

    Ammoboxes act the same way (for my purposes) as ArmA 2 did. Awesome!

    I still cant figure out how to kick someone locally, or any way for that matter. Here is what I attempted.

    I attempted both on the client and server as well as locally hosting it and attempting with no luck.

    serverCommand "#kick myid";

    serverCommand "#exec kick myid";

    serverCommandAvailable shows true on all but exec on an unauthenticated client locally.


  6. Hello everyone!

    I have two questions,

    First, I need to kick Player1 via a script witch is local to him. How should I go about doing that?

    Second, Does ArmA3 ammo boxes work similar to ArmA2 ammo boxes? Can I use the following statement?

    In ArmA2 this would allow an admin to get anything they wanted while other users have similar statements to fill it with their stuff.

    _box = _this select 0;
    clearWeaponCargo _box;
    clearMagazineCargo _box;
    
    if ((getPlayerUID player) in Admin_array) then {
    //All items go here
    };
    
    


  7. Hello everyone!

    I am having some serious writers block, maybe someone would be able to help. Just finished a few other things and I guess I am a burnt bulb now...

    I need to write a simple script that will compare two position arrays and return true if there is more than X units of movement in any direction between them.

    Any help would be awesome!


  8. Hello everyone!

    I have been having a hard time with this one, so if someone wouldn't mind helping!

    _object = createVehicle ["Sign_Sphere25cm_F", _pos, [], 0, "CAN_COLLIDE"];
    _object setvehicleinit "this setObjectTexture [0,"textures\NATO V2.PAA"];
    _object attachTo [_target, [0,-2,1.329]]; 
    _object setVectorDirAndUp [[0,0,-1],[0,1,0]];

    _target is a vehicle, _pos is defined out of view

    The goal is to spawn this sphere, texture it, then position it.

    I have been told that Setvehicleinit no longer works and that BIS_fnc_MP is the new replacement. I cant seem to wrap my head around it. Would someone be willing to provide me a example?

    Thanks in advance!

    W


  9. Sixconfig is the only place where I have located a good hierarchical class tree, now I am just having issues calling upon a class.

    Whats wrong with this?

    {_x addEventHandler ["handleDamage", { false }];} foreach nearestObjects [base, ["Static"], 600];

    ---------- Post added at 04:43 ---------- Previous post was at 04:23 ----------

    Nevermind, was having it execute via a broken trigger... lol


  10. Did a little research on the feedback tracker and the issues with the HEMTT are known and very, very low priority. This becomes a major pain in my rump because cheap unarmed vehicles are the perfect thing to fight over! Think of the MHQ in ArmA2 Warfare BE! Its just a under-armed, no good, LAV!

    HEMTT Box - Box is proxy model. While all the proxy models ive seen dont have hidden selections, It would be nice.

    HEMTT Covered Transport - Not a proxy model and has a PAA! I do not understand why no one takes the minute or two to fix it.

    HEMTT Ambulance - Its a Covered transport with a modified PAA! Come on!

    Civilian Box Transport - It has a PAA, so why would it not have a hidden selection?

    Does anyone know of something unarmed and useless that can be used to transport 2-4 people? Preferably with working hidden selections?

    The issue with texturing the Civi box truck does not appear to be known in the feedback tracker. Will post when I get home tonight.


  11. Grumpy, You are correct for the proxy model on the HEMTT box, but this is not the situation of the Civi van.

    Interestingly enough, I am having the same issue with the HEMTT Covered transport. Same story as the Civi van, It has a PAA and is not a proxy model, just no hidden selection. Is there a work around or do we need to submit it as a bug?

×