Saturday, January 09, 2016

Arma 3, Custom Scripting - Server Restart Messages

ArmA 3 Scripting

Lately, whilst making a slight diversion from my own scripting, I have been helping out the guys from 'The Whirlpool Resistance' aka 'WpR' who are an Australian/New Zealand based gaming group. The new WpR ArmA web site (forums) can be viewed here. *August 2016, The group in which I support split/changed/updated and can now be found at Total Annihilation Gaming who are an Australian/New Zealand based gaming group (and they have a few USA based players also).

Without the usage of a Battleye client (eg BEC) running on the hosted server to help with timed server messages, I attempted to put together my own version of a script/timer function that was able to be ran on a hosted gaming server, or a dedicated gaming server... and I succeeded.

Beforehand there was no able way to warn/notify the players on the server about when the server was going to be restarted, you just had to keep notice of the time yourself, and many (if not all) players including myself have been caught out many times, wonder why the server d/c us... only to check the current local time to realize it was an actual server restart.

serverRestartMessage.sqf code preview

I have now scripted a server side function/loop to grab the actual hosted server time (not in-game time) and run a timing schedule off of it. Currently server reset times (Australia, Sydney time) are 03:00, 09:00,15:00 and 21:00. The timing routine keeps track (to the second) of the current server time in HH:MM:SS, it then warns you in-game from 30/20/10/5/2/1 minute(s) until restart, in the middle of the screen in big bold colorful writing. There is also an option to have it count down in seconds from the 1 minute mark (as seen in the second screenshot below).

30 minute warning message
the 60 second countdown has begun
I enjoy small scripting challenges like this one, especially when I succeed. I'm happy, the group is happy, the host is happy and the players are happy that they now have proper timed on-screen warning messages for the server restarts. :)

You can check out/download the script here on my GitHub.

P.S. Back to my own mod scripting soon.