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

[Tutorial]Zombie counter

broken avatar :(
Created 10 years ago
by InFInIX
0 Members and 1 Guest are viewing this topic.
4,484 views
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 18 October 2013
Last active: 3 weeks ago
Posts
652
Respect
Forum Rank
Zombie Enslaver
Primary Group
Donator ♥
My Groups
More
×
InFInIX's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Oil Rig Beta Access
Oil Rig Beta Access
InFInIX's Contact & Social Links
Go to mapname.gsc

and add this to the bottom

Code Snippet
Plaintext
zombiesleft_hud()
{   
Remaining = create_simple_hud();
  Remaining.horzAlign = "center";
  Remaining.vertAlign = "middle";
    Remaining.alignX = "Left";
    Remaining.alignY = "middle";
    Remaining.y = 230;
    Remaining.x = 60;
    Remaining.foreground = 1;
    Remaining.fontscale = 8.0;
    Remaining.alpha = 1;
    Remaining.color = ( 0.423, 0.004, 0 );


    ZombiesLeft = create_simple_hud();
    ZombiesLeft.horzAlign = "center";
    ZombiesLeft.vertAlign = "middle";
    ZombiesLeft.alignX = "center";
    ZombiesLeft.alignY = "middle";
    ZombiesLeft.y = 230;
    ZombiesLeft.x = -1;
    ZombiesLeft.foreground = 1;
    ZombiesLeft.fontscale = 8.0;
    ZombiesLeft.alpha = 1;
    ZombiesLeft.color = ( 0.423, 0.004, 0 );
    ZombiesLeft SetText("Zombies Left: ");


while(1)
{
remainingZombies = get_enemy_count() + level.zombie_total;
Remaining SetValue(remainingZombies);

if(remainingZombies == 0 )
{
Remaining.alpha = 0;
while(1)
{
remainingZombies = get_enemy_count() + level.zombie_total;
if(remainingZombies != 0 )
{
Remaining.alpha = 1;
break;
}
wait 0.5;
}
}
wait 0.5;
}
}

now call the function after

Code Snippet
Plaintext
maps\_zombiemode::main(); 

with

Code Snippet
Plaintext
thread zombiesleft_hud();

If you want to change the text

search for

Code Snippet
Plaintext
ZombiesLeft SetText("Zombies Left: ");

And change the Zombies left:

WARNIG:

Leave the "" or you will get a bad syntax error

[Script by: Mrhankey91]
Last Edit: March 22, 2014, 06:57:35 pm by Xcept
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
I could be wrong, but I don't think this tutorial was made by you. In that case, you might want to credit the original creator.

- Phil.
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Code Snippet
Plaintext
get_enemy_count()

Wouldn't this get all Axis characters in a level? Wouldn't it be more accurate to make it like this:

Code Snippet
Plaintext
zombiesleft_hud()
{   
Remaining = create_simple_hud();
  Remaining.horzAlign = "center";
  Remaining.vertAlign = "middle";
    Remaining.alignX = "Left";
    Remaining.alignY = "middle";
    Remaining.y = 230;
    Remaining.x = 60;
    Remaining.foreground = 1;
    Remaining.fontscale = 8.0;
    Remaining.alpha = 1;
    Remaining.color = ( 0.423, 0.004, 0 );


    ZombiesLeft = create_simple_hud();
    ZombiesLeft.horzAlign = "center";
    ZombiesLeft.vertAlign = "middle";
    ZombiesLeft.alignX = "center";
    ZombiesLeft.alignY = "middle";
    ZombiesLeft.y = 230;
    ZombiesLeft.x = -1;
    ZombiesLeft.foreground = 1;
    ZombiesLeft.fontscale = 8.0;
    ZombiesLeft.alpha = 1;
    ZombiesLeft.color = ( 0.423, 0.004, 0 );
    ZombiesLeft SetText("Zombies Left: ");


while(1)
{
level.zombie_total SetValue(level.zombie_total);

if(level.zombie_total == 0 )
{
Remaining.alpha = 0;
while(1)
{
if(level.zombie_total != 0 )
{
Remaining.alpha = 1;
break;
}
wait 0.5;
}
}
wait 0.5;
}
}
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Well, first of all, this is not going to work anyway:
Code Snippet
Plaintext
level.zombie_total SetValue(level.zombie_total);
And yes, get_enemy_count() returns all living axis AI, which is most likely what you want, as zombie_total is decremented when an AI spawns. That means, zombie_total + get_enemy_count() gives the number of zombies yet to spawn in this round plus the number of zombies currently alive, which is, in total, the number of zombies remaining to be killed this round.

- Phil.
Last Edit: March 22, 2014, 10:36:55 am by YaPh1l
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 9 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Either your authorship needs to be proven or the original author needs to be credited before this can be moved to the tutorials section.

 
Loading ...