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

Simple Script Problem

broken avatar :(
Created 11 years ago
by Dust
0 Members and 1 Guest are viewing this topic.
2,261 views
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 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
So I am trying to create a script similar to cs:go, where it displays the name of the area you are in in the top left of the screen. Well, I got this written down

Code Snippet
Plaintext
tspawn_area()
{
tspawn_area = getent("tspawn_area","targetname");
tspawn_area SetCursorHint("HINT_NOICON");
while(1)
{
wait 0.5;
tspawn_area waittill("trigger",player);
level notify("new_area_entered");
player thread tspawn_area_hud();
}
}

tspawn_area_hud()
{
level endon("new_area_entered");

    level.tspawn_area_text = create_simple_hud(self);
level.tspawn_area_text.foreground = true;
level.tspawn_area_text.sort = 4;
level.tspawn_area_text.hidewheninmenu = false;
level.tspawn_area_text.alignX = "left";
level.tspawn_area_text.alignY = "top";
level.tspawn_area_text.horzAlign = "left";
level.tspawn_area_text.vertAlign = "top";
level.tspawn_area_text.fontScale = 2;
level.tspawn_area_text.x = 0;
level.tspawn_area_text.y = 130;
level.tspawn_area_text.color = (0, 1, 0.510);
level.tspawn_area_text setText("T-Spawn");
level.outside_area_text destroy();
}

When I enter the 2nd area, the text for the 2nd area pops up but it overlaps the 1st area text, I want the 1st area text to disappear and just display the 2nd area text.

I thought just doing destroy(); would work but it doesn't, also tried using notify and endon and it still didnt fix it.
Marked as best answer by thezombiekilla6 11 years ago
broken avatar :(
×
broken avatar :(
RadihaX
Location: caCanada
Date Registered: 2 September 2012
Last active: 5 years ago
Posts
978
Respect
Forum Rank
The Decider
Primary Group
Mapper Elite
My Groups
More
My Contact & Social Links
More
Signature
Overrun
Lockdown
Overrun (Black Ops Mod)
Snowglobe
Leviathan
Abandoned School
Ski Resort
Leviathan Redux
×
JBird632'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.
Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods community.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
JBird632's Contact & Social LinksJBird632JBird632JBird632JBird632JBird632Mapper
Well I see a couple things that you could change. For instance I noticed that your hud variable is a level variable which would mess up on coop since it would be the same variable for all players. Its best to set it as a variable on the player instead. Secondly, I believe it would be better to only create the hud once and then just change the text each time you enter a new zone.

Here is an example:
Code Snippet
Plaintext
tspawn_area()
{
tspawn_area = getent("tspawn_area","targetname");
tspawn_area SetCursorHint("HINT_NOICON");

while(1)
{
wait(0.5); // also this really isn't needed if you have a waittill (just saying :P)
tspawn_area waittill("trigger",player);
player thread tspawn_area_hud("Tspawn Area");
}
}

tspawn_area_hud(text)
{
if(!isDefined(self.area_text))
{
self.area_text = create_simple_hud(self);
self.area_text.foreground = true;
self.area_text.sort = 4;
self.area_text.hidewheninmenu = false;
self.area_text.alignX = "left";
self.area_text.alignY = "top";
self.area_text.horzAlign = "left";
self.area_text.vertAlign = "top";
self.area_text.fontScale = 2;
self.area_text.x = 0;
self.area_text.y = 130;
self.area_text.color = (0, 1, 0.510);
}

self.area_text setText(text);
}

So each time you want to change the text just call the function and put the string that you want the text to change to.
Last Edit: September 06, 2015, 03:29:09 am by JBird632
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
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
Well I see a couple things that you could change. For instance I noticed that your hud variable is a level variable which would mess up on coop since it would be the same variable for all players. Its best to set it as a variable on the player instead. Secondly, I believe it would be better to only create the hud once and then just change the text each time you enter a new zone.

Here is an example:
Code Snippet
Plaintext
tspawn_area()
{
tspawn_area = getent("tspawn_area","targetname");
tspawn_area SetCursorHint("HINT_NOICON");

while(1)
{
wait(0.5); // also this really isn't needed if you have a waittill (just saying :P)
tspawn_area waittill("trigger",player);
player thread tspawn_area_hud("Tspawn Area");
}
}

tspawn_area_hud(text)
{
if(!isDefined(self.area_text))
{
self.area_text = create_simple_hud(self);
self.area_text.foreground = true;
self.area_text.sort = 4;
self.area_text.hidewheninmenu = false;
self.area_text.alignX = "left";
self.area_text.alignY = "top";
self.area_text.horzAlign = "left";
self.area_text.vertAlign = "top";
self.area_text.fontScale = 2;
self.area_text.x = 0;
self.area_text.y = 130;
self.area_text.color = (0, 1, 0.510);
}

self.area_text setText(text);
}

So each time you want to change the text just call the function and put the string that you want the text to change to.

Thanks worked perfectly! Figured I would need to use self instead of level, just had it set as that to test it.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I do this same thing in Orbit, but I don't display the zone, I use it for other reasons. I would prob use menu to display it myself, but to each his own.

I have two triggers at each door, trigger_multiples. I set a player attribute whenever they are triggered to the script_noteworthy of the trigger:

Code Snippet
Plaintext
init(){
trigs = getentarray("zonetracker", "targetname");
array_thread(trigs, ::CurrentZone);
}

CurrentZone(){
while(1){
self waittill("trigger",player);
if(player.currentZone != self.script_noteworthy){
player.currentZone = self.script_noteworthy;//not needed if you set text for hud in next line
//could setText for your hud here
//player SetClientDvar("currentzone",self.script_noteworthy);//used for menu instead
}
}
}
//hud stuff if you use that
Last Edit: September 06, 2015, 03:45:58 am by MakeCents
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
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.
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
theres also a zone check in the default code that returns the name of the zone ent is in, or undefined if not in a zone at all

you can then use

Code Snippet
Plaintext
if ( isDefined( ZONENAME ) )
{
  DO STUFF
}

to use this though, you would need a thread either checking all players on repeat, or a thread on each player, constantly checking
Last Edit: September 06, 2015, 03:52:34 am by Harry Bo21
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 22 September 2014
Last active: 6 years ago
Posts
360
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Here to make epic maps
×
pcmodder's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
pcmodder's Contact & Social Linksken5hir0pcmodderugx
Hewy can i add this to my map maybeif u could show me how?  Thanks
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
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.
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
just needs threading, and place the trigger in radiant

Code Snippet
Plaintext
tspawn_area();

under

Code Snippet
Plaintext
maps\_zombiemode::main(); // in mapname.gsc

and place a trigger multiple with

Code Snippet
Plaintext
"targetname" - "tspawn_area"



I only briefly looked, should work

 
Loading ...