UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[TUT] Make a button do something + add a keybind option to a menu

broken avatar :(
Created 9 years ago
by BluntStuffy
0 Members and 1 Guest are viewing this topic.
7,010 views
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 4 weeks ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
This tutorial will show you how you can make any button preform an action, and how to add a keybind option for it in a menu. After this tutorial it will only print a line on the screen, you have to work from there on..
( i'm not 100% sure if there's a better way to get this working, menu-scripting is still kinda new to me. This was pretty much the only thing i got working so far though )

-I'll start with the menu, in this example we'll add the line to the main menu so it's easy to find, but you can put it in any menu in the same way ( controlls-options, pause menu etc ).


Go to your root\raw\ui\ folder and find the file main.menu copy that file and rename it to anything you like, i'll use:

main_new.menu

open the renamed file, and look for this line:

Code Snippet
Plaintext
CHOICE_BUTTON_VIS( 1, "@MENU_SOLO_CAP", SETUP_ACTION_SOLO; LOCAL_ZOMBIE_RESET, when( !localvarBool( ui_hideBack ) ); )


Above that line add:
Code Snippet
Plaintext
CHOICE_BIND( 11, "Print text on screen:", "openScriptMenu print_text print_text" , ; )
CHOICE_KEYBINDHELP

Note: The number 11 determine's at wich position the tekst will appear in the menu, the lower the number the higher it will appear to the top of your screen.

Open launcher and add this line to your mod.csv fastfile:

Code Snippet
Plaintext
menufile,ui/main_new.menu



Now we need to make a script to make something happen. Create a new .gsc in your mods\mapname\maps\ folder and give it any name, i'll use:

button_print.gsc

inside it, paste this:
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

init()
{
level thread opc();
}

opc()
{
while(1)
{
level waittill( "connecting", player );
player thread player_ops();
}
}


player_ops()
{
self endon( "disconnect" );
while(1)
{
self waittill( "spawned_player" );
self thread button_response();
}
}


button_response()
{
self endon("death");
self endon("disconnect");
while(1)
{
self waittill("menuresponse", menu, response );

self thread button_pressed(response);
}
}
button_pressed(response)
{
self endon("death");
self endon("disconnect");

switch( response )
{
case "print_text":
self iprintlnbold( "^2Button Pressed" );
break;

default:
break;
}
}




Last thing to do is call the script from _zombiemode.gsc, open it and under this line:
Code Snippet
Plaintext
	maps\_zombiemode_auto_turret::init();

Add:
Code Snippet
Plaintext
	maps\button_print::init();

Last Edit: August 18, 2015, 10:19:26 pm by BluntStuffy
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,006Add +1
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
I needed this so bad, legend, thank you
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 4 weeks ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
You are a beast man! This will definitely come in handy.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,006Add +1
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
Oh no you definitely are a legend :)
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 4 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
Signature
Money isn't everything but everything has a price
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
1+.... For being a legend :please:
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 4 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
Not sure why but i dont have this line in the menu file
Code Snippet
Plaintext
CHOICE_BUTTON_VIS( 1, "@MENU_SOLO_CAP", SETUP_ACTION_SOLO; LOCAL_ZOMBIE_RESET, when( !localvarBool( ui_hideBack ) ); )
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 4 weeks ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
Not sure why but i dont have this line in the menu file
Code Snippet
Plaintext
CHOICE_BUTTON_VIS( 1, "@MENU_SOLO_CAP", SETUP_ACTION_SOLO; LOCAL_ZOMBIE_RESET, when( !localvarBool( ui_hideBack ) ); )

Are you using UGX-mod? Try looking for this line instead:

Code Snippet
Plaintext
CHOICE_BUTTON_VIS( 1, "", SETUP_ACTION_SOLO, when( !localvarBool( ui_hideBack )); )
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 23 April 2015
Last active: 4 years ago
Posts
165
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
×
Eternal_Fire's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Eternal_Fire's Contact & Social Links
Are you using UGX-mod? Try looking for this line instead:

Code Snippet
Plaintext
CHOICE_BUTTON_VIS( 1, "", SETUP_ACTION_SOLO, when( !localvarBool( ui_hideBack )); )

I'm not using the ugx mod, i am using the ugx script placer and it cannot find ^^ code either.
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 3 months ago
Posts
3,997
Respect
1,024Add +1
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I'm not using the ugx mod, i am using the ugx script placer and it cannot find ^^ code either.

Just search for
Code Snippet
Plaintext
CHOICE_BUTTON_VIS( 1,

Script placers modify the solo button to work. I have done it manually, so mine looks like this:
Code Snippet
Plaintext
CHOICE_BUTTON_VIS( 1, "SOLO", exec "map nazi_zombie_tworema"; , when( !localvarBool( ui_hideBack ) ); )
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
most people i know would disagree  :D :D
Meanwhile, I know more menufile stuff and I'm called a legend only by jammy.
broken avatar :(
×
broken avatar :(
The Last of Us
Location: scotland
Date Registered: 28 September 2013
Last active: 14 hours ago
Posts
1,463
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
ฏ๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎
Signature
×
smasher248's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
smasher248's Contact & Social Linkssmasher248smasher248
Meanwhile, I know more menufile stuff and I'm called a legend only by jammy.

do u want a hug?

 
Loading ...