Jump to content

[RELEASE] Custom GUI / Menu


theduke

Recommended Posts

Hi Epoch community,
Have you ever wanted a way for players to be able to see your server rules while in-game?
Are you tired of repeating yourself with simple answers to simple questions?
Looking for a different way to deploy items or call certain scripts?

Our community uses mostly scripts from this awesome epoch community. Its our time to give back :)
I've decided to make a release version of my GUI for everyone to use.

Download UPDATED FOR 1061: https://github.com/theduke77/Custom-Menu

Or follow this link
https://epochmod.com/forum/topic/43462-release-custom-gui-menu-updated-for-1061/In the video, i have my community colors in the GUI, the release version I tried to match the zupa colors.

 

Video

Spoiler

 

I've received tremendous help from SHIX. Most of the credit goes to him for explaining to me how to do this.
also, I've used the code he provided as a template and built this from that.
He kindly allowed me to share with all of you

Ok, now for the fun part.
This is NOT for someone new to the world of epoch server management. (probly because of my instructions lol)
This is NOT a plug-n-play addon. You must configure all the files and customize the menu
I would strongly suggest you have a test server to be able to test it as you create new pages.
Try one page to make sure it looks good, then go from there.
If you want to change the colors of stuff, check out the options section before creating pages.

I will do my best to explain to the best of my knowledge.
I'm far from being a coder lol

Tools required

Notepad ++
PBO Tool
patience...with my instructions ;)
TextView (optional)

Installation:

Spoiler

Extract your mission.pbo
Copy the menu folder from the download into your custom folder. If you don't have a custom folder create one.

open description.ext

add this at the bottom
Its important that the defines is at the top!!


#include"custom\menu\defines.hpp"
#include"custom\menu\menu.hpp"
#include"custom\menu\rules.hpp"
#include"custom\menu\rules2.hpp"

save and close

open your dayz_spaceInterrupt.sqf

In this section, I have it set when players hit "tab", it opens the menu.
you can browse available DiK codes on the Bohemia site to change it to anything you would like. 0x0F is the TAB key
https://community.bistudio.com/wiki/DIK_KeyCodes

Look for this


if (_dikCode in (actionKeys "GetOver")) then {
	
	if (player isKindOf  "PZombie_VB") then {
		_handled = true;
		DZE_PZATTACK = true;
	} else {
		_nearbyObjects = nearestObjects[getPosATL player, dayz_disallowedVault, 8];
		if (count _nearbyObjects > 0) then {
			if((diag_tickTime - dayz_lastCheckBit > 4)) then {
				[objNull, player, rSwitchMove,"GetOver"] call RE;
				player playActionNow "GetOver";
				dayz_lastCheckBit = diag_tickTime;
			} else {
				_handled = true;
			};
		};
	};
};

add this bellow


//ESLK Menu
if (_dikCode == 0x0F) then {  
	
_null = execVM "custom\menu\menu_init.sqf";

};

save and close

For players using Infistore, you will need to add the dialog numbers, 7777,7778,7779

7777 - menu.hpp
7778 - rules.hpp
7779 - rules2.hpp

Extract your dayz_server.pbo

Open your AHConfig.sqf
look for

_ALLOWED_Dialogs

add the dialogs. EX: ...9900,7777,7778,7779)  If you created 4 extra pages, you will need to add all those dialog numbers. (will explain a bit more later)

Now that the files are in place, its time to configure them.
First, make yourself a drink and get ready :)

Open menu_init.sqf. If you read the comments for each section it explains what you need to know
Here you can set the call lines or scripts for your actions, and deployables.

Second, open rules_init.sqf
In this file, the comments explain what you need to know.
I've included a couple files as templates to help you get started.

How to create new pages

Spoiler

Copy and paste  rules2_init.sqf and rules2.hpp.  Rename them rules3_init.sqf and rules3.hpp

Open your rules3.hpp

Things to pay attention to when creating a new page are Highlighted in bold

- The display name
At the very top, in this case its "rules2". Change it to rules3.


class rules2
{
    idd = 7779;
    movingenable=false;
    class Controls
    { 

- The Dialog number, also at the very top
For each new page you create, you will need to change the dialog number and increase its number by 1

change
 


class rules2
{
    idd = 7779;
    movingenable=false;
	class Controls
	{ 

to
 


class rules3
{
    idd = 7780;
    movingenable=false;
	class Controls
	{ 

- The NEXT and PREVIOUS buttons
For this scenario, we will work as if page 3 is our last page for our "rules" section. Do a search for "previous", without the quotes. you should fine this block of code

class slk_previous: slkRscButton
{
    idc = 1602;
    text = "Previous Page"; //--- ToDo: Localize;
    x = 0.396862 * safezoneW + safezoneX;
    y = 0.8102 * safezoneH + safezoneY;
    w = 0.0979687 * safezoneW;
    h = 0.044 * safezoneH;
    sizeEx = 0.050;
    style = 2;
    colorBackground[] = {0.047,0.376,0.776,1};
    onButtonClick = "call previous2script;";
};

Highlighted in black is the call from line 21 from rules2_init.sqf (will get to that just bellow).  As we are creating a new page, we will need to change it.

onButtonClick = "call previous3script;";

In rules3_init.sqf, line 21 changes from
previous2script = {((ctrlParent (_this select 0)) closeDisplay 7779); execvm 'custom\menu\YOUR_SCRIPT.sqf';}; //script that Previous button will use 

to

previous3script = {((ctrlParent (_this select 0)) closeDisplay 7780); execvm 'custom\menu\rules2_init.sqf';}; //script that Previous button will use 

pay attention to the dialog number and execvm line. our new dialog number has become 7780, so the call line must know which dialog to close when the button is pressed.
As this is a previous button, you want the execvm to call the rules2_init.sqf

For the next button, you would do the opposite. but in this example we don't need the next button because its our last page.
To remove the button from the page, you need to comment out the block of code. In bold is what you need to add to comment out the code.
 this /* opens the comment block
 this */ close the comment block

/*
class slk_next: slkRscButton
{
    idc = 1600;
    text = "Next Page"; //--- ToDo: Localize;
    x = 0.503082 * safezoneW + safezoneX;
    y = 0.8102 * safezoneH + safezoneY;
    w = 0.0979687 * safezoneW;
    h = 0.044 * safezoneH;
    sizeEx = 0.050;
    style = 2;
    colorBackground[] = {0.047,0.376,0.776,1};
    onButtonClick = "call next2script;";
};
*/

- The CLOSE MENU and RETURN buttons.

In each new page you create, you will need to find these 2 buttons in the *.hpp you created, just like the next and previous buttons.
Block of code looks like this

class slk_return: slkRscButton
{
    idc = 1601;
    text = "Return to Menu"; //--- ToDo: Localize;
    x = 0.226719 * safezoneW + safezoneX;
    y = 0.808 * safezoneH + safezoneY;
    w = 0.103125 * safezoneW;
    h = 0.044 * safezoneH;
    sizeEx = 0.050;
    style = 2;
    colorBackground[] = {0.047,0.376,0.776,1};
    onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 7779); ExecVM 'custom\menu\menu_init.sqf';";
};

The only thing you need to pay attention to in this line is the dialog number.  So in this case our new page dialog number is 7780, we change it to this

onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 7780); ExecVM 'custom\menu\menu_init.sqf';";

Do the same for the CLOSE MENU button

Alright so now you've created a new page. Open the rules3_init.sqf and configure the rules as needed.

In each new "rules_init.sqf" you will create, you will need to change the display name
Around line 25 you will see some something like this

createDialog "rules2";

change it to 

createDialog "rules3";

For each new page you've created, you will need to add the dialog number to the infistore list (explained above)
For each new page you've created, you need to add only the HPP file to the bottom of your description.ext (#include "custom\menu\rules3.hpp")

And thats it for the install and configuration of the menu. Time for another drink ;)

 

OPTIONAL

Spoiler

- Adding a logo to the top left of the menu

Open the menu.hpp

Look for this block of code

class slk_picl: slkRscPicture
{
    idc = 1200;
    text = "custom\menu\logo.paa";
    x = 0.221562 * safezoneW + safezoneX;
    y = 0.137 * safezoneH + safezoneY;
    w = 0.128906 * safezoneW;
    h = 0.077 * safezoneH;
};

The highlighted line is the path to your logo. I just used my watermark logo. It needs to be in paa format.
create a PNG and import it into TextView made by bohemia. Save it as a PAA file.

I've also included a sample logo to use as a template.
If you don't want to use the logo, just comment out the block of code.

- Changing the colors of buttons and text
I would STRONGLY SUGGEST doing this before making a bunch of pages.

Visit this page to choose the colour you want
http://html-color-codes.info/

Visit this page to copy the HTML code into Kill Zone kids amazing converter for arma
http://killzonekid.com/hex-2-arma-gui-colour-converter/

Open menu.hpp
look for 

colorBackground[] = {0.047,0.376,0.776,1};

that is the line of code you need to change for the background color of the button.  Do the same thing for the pages

As for the text, you will need to go in each block in each page and add the color you choose.
each block will have slk_rules1 or slk_rules2 and so on...
Example:


class slk_rules1: slkRscStructuredText
{
	idc = 1100;

	text = ""; //--- ToDo: Localize;
	x = 0.226718 * safezoneW + safezoneX;
	y = 0.2778 * safezoneH + safezoneY;
	w = 0.546562 * safezoneW;
	h = 0.066 * safezoneH;
};

add your colour like so

class slk_rules1: slkRscStructuredText
{
    idc = 1100;

    text = ""; //--- ToDo: Localize;
    x = 0.226718 * safezoneW + safezoneX;
    y = 0.2778 * safezoneH + safezoneY;
    w = 0.546562 * safezoneW;
    h = 0.066 * safezoneH;
    colorText[] = {1,1,1,1}; //White
};

Known issues

Spoiler

If you hit the menu button twice, it seems to overlap the menu. Havnt figured that out yet

Players with smaller resolutions, the text can be cut out. I havnt figured that one out either.
If someone knows how i can fix either issue please let me know :)

Also I thought it might be possible to create one config file. Not sure if it is possible. If so, please share the info :)

Many thanks to SHIX. Without him explaining this GUI stuff to me I wouldn't of made it lol
Thanks to Kill Zone kids blogs, they are amazing to learn from.

Hope you guys enjoy it.
I will support this to the best of my knowledge :)

 

16/02/2017 UPDATE

Thank you to @Casual_Jeff for this 1.0.6 FIX

 

Link to comment
Share on other sites

A guy i know told me about this the other day, hopped a few servers and seen that there are already multiple servers that have this.  Good to see .pbo theifs are still everywhere.

In any case, good job i see it suits your needs and its well presented.  Not my cup of tea tho i try to keep my server as vanilla like as possible.

 

Its good to see that there is still some people developing stuff for a2.

Link to comment
Share on other sites

On 04/03/2016 at 11:59 AM, Tweety060286 said:

So i have worked verry hard for this.

But now im finished :D

verry verry thanks for this "The Duke" !

Here a Pic of mine

my menue.jpg

You give your players the ability to add or subtract humanity? 

Link to comment
Share on other sites

I'm using the default deploy bike script it came whit as a test. I've noticed that every time I make a bike and ride on it, I just auto die and appear at Debug for a brief second. Is this normal or am I missing something? 

Edit: BTW it says this on my RTP. I'm NOT using Infistar and I do not have this  AHConfig.sqf inside my Server.pbo. So do I need to add an exception somewhere else?

13:08:25 "PDEATH: Player Died xxxxxxxxxxxxxxxxxxxxx"
13:08:35 "get: STRING (xxxxxxxxxxxxxxxxxxx), sent: STRING (xxxxxxxxxxxxxxxxxxxxxx)"
13:08:35 "DISCONNECT: Jyggs (xxxxxxxxxxxxxxxxxxxxxxxx) Object: B 1-1-B:1 (Jyggs) REMOTE, _characterID: 40 at loc [-7239.67,19539.3,0.245514]"
13:09:24 "CLEANUP: Deleted 2 Loot Piles out of 6"
13:12:01 "DELETE: Jyggs Deleted by ID: 1"
13:13:22 "CLEANUP: KILLING A HACKER Jyggs B 1-1-B:1 (Jyggs) REMOTE IN Old_bike_TK_CIV_EP1"
13:13:22 Client: Object 4:100 (type Type_70) not found.
13:13:22 Client: Object 4:100 (type Type_69) not found.
13:13:22 Client: Object 4:99 (type Type_70) not found.

 

Link to comment
Share on other sites

39 minutes ago, Jyggs said:

I'm using the default deploy bike script it came whit as a test. I've noticed that every time I make a bike and ride on it, I just auto die and appear at Debug for a brief second. Is this normal or am I missing something? 

Edit: BTW it says this on my RTP. I'm NOT using Infistar and I do not have this  AHConfig.sqf inside my Server.pbo. So do I need to add an exception somewhere else?


13:08:25 "PDEATH: Player Died xxxxxxxxxxxxxxxxxxxxx"
13:08:35 "get: STRING (xxxxxxxxxxxxxxxxxxx), sent: STRING (xxxxxxxxxxxxxxxxxxxxxx)"
13:08:35 "DISCONNECT: Jyggs (xxxxxxxxxxxxxxxxxxxxxxxx) Object: B 1-1-B:1 (Jyggs) REMOTE, _characterID: 40 at loc [-7239.67,19539.3,0.245514]"
13:09:24 "CLEANUP: Deleted 2 Loot Piles out of 6"
13:12:01 "DELETE: Jyggs Deleted by ID: 1"
13:13:22 "CLEANUP: KILLING A HACKER Jyggs B 1-1-B:1 (Jyggs) REMOTE IN Old_bike_TK_CIV_EP1"
13:13:22 Client: Object 4:100 (type Type_70) not found.
13:13:22 Client: Object 4:100 (type Type_69) not found.
13:13:22 Client: Object 4:99 (type Type_70) not found.

 

you add the Classname from your Bike 

Old_bike_TK_CIV_EP1

in your Variables.sqf into the allowed objects [....]

Link to comment
Share on other sites

1 hour ago, Tweety060286 said:

you add the Classname from your Bike 


Old_bike_TK_CIV_EP1

in your Variables.sqf into the allowed objects [....]

NVMD, I just removed the option since it's not working properly for me. I'm using Deploy Anything and it has an option for Bikes. Still I have no clue how to add it to the menu itself since it doesn't run on a single sqf file like the example. Probably will work on a modified version just so I can click Build Bike on the menu itself and not have to right click my Toolbox.

Link to comment
Share on other sites

  • 3 weeks later...
3 hours ago, juandayz said:

HEY DUKE! im in love whit your MENU!!! I will try to remove all script and make a just  info panel.

 

U think is possible add a server players rank into your menu?

 

 

 

 

Judging by the other menus that people have made and posted here you could probbly display anything you can get the info for.  But unfortunately thats beyond my knowledge.  Would be interesting if other players that have made changes would post it in this thread what they did so others can attempt to do similar things.

Link to comment
Share on other sites

  • 1 month later...
5 minutes ago, seelenapparat said:

try to adjust your interface resolution in your arma 2 menu -> options -> video options.

No my resolution fits my monitor perfectly. I appreciate the response but that doesn't help me. I need to know how to make the text smaller in the hpp files.

Link to comment
Share on other sites

Awesome that definitely helps... what about the bodies of text? For example under Rules. He estimates that you can fit about 300 characters but Im not getting that many before it gets cut off. How would I make that body of text smaller? There is no sizeEx for bodies of text, only the buttons.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...