← Go back

Arma 3 - Cool ass looking messages!

Posted on November 05, 2017 at 12:55 (GMT +00:00) by Colin

I've been quite busy this past couple of weeks moving all my gear back into my home office in preparation for the cold winter, but I wanted to make a new post. I am going to show you my "coolmsg" functionality I have written for my Arma 3 missions and upcoming game mode. As per usual, this is very easy for you to add into your mission, just remember to give credit where due.

First create your folder "PX" inside your mission folder if it does not already exist, then create the file px_coolmsg.sqf and place the following code inside:

// Cool Message - part of PixeL_GaMMa library.
// A function that displays a cool fading message log.
// Copyright (c) Colin J.D. Stewart. All rights reserved
// APL-ND License - https://www.bistudio.com/community/licenses/arma-public-license-nd

if (hasInterface) then {
	msglines = [];
	func_pxCoolMsg = {			
		_ctrl = (findDisplay 46) ctrlCreate ["RscStructuredText", -1];
		msgLines pushBack _ctrl;
		_ctrl ctrlSetFont "PuristaMedium";					
		_ctrl ctrlSetPosition [safeZoneX, safeZoneY + safeZoneH - 0.05, safeZoneW, safeZoneH];	
		_ctrl ctrlSetStructuredText parseText format["<t align='right'>%1</t>", _this];			
		_ctrl ctrlCommit 0;
		_ctrlCount = (count msglines) -1; 
		_deleteCount = 0;
		_pos = 0.05 + (_ctrlCount * 0.03); //[0,0];
			if (ctrlFade _x == 1) then {
				_deleteCount = _deleteCount + 1;
				ctrlDelete _x;
			} else {
				_x ctrlSetPosition [safeZoneX, safeZoneY + safeZoneH - _pos, safeZoneW, safeZoneH];	
				_x ctrlCommit 1;		
			_pos = _pos - 0.03;			
		} foreach msgLines;		

		_ctrl ctrlSetFade 1;
		_ctrl ctrlCommit 20;	
		// remove any old...
		msgLines deleteRange [0, _deleteCount];

if (isServer) then {
	func_pxSendCoolMsg = {
		_this remoteExec ["func_pxCoolMsg", 0]; 

Next, inside your init.sqf file place the following line:

call compileFinal preprocessFile "PX\px_coolmsg.sqf";

Now you're ready to go, to use these functions you use them pretty much the same way as any other function.

// Send hello world to the local client
"Hello <t color='#f0f0f0'>World</t>" call func_pxCoolMsg;

// You can use the helper function for sending over the network to all clients
"Hello <t color='#f0f0f0'>World</t>" call func_pxSendCoolMsg;

Here is a sample below (in this case I have used it for my kill detection scripts:

I hope you enjoy using this script, if you do, please add a credit notice where possible and leave me a comment below! Thanks! :)
/Scripting/Programming/Game Modding