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

Fancy Animated Zombie Counter

broken avatar :(
Created 12 years ago
by DidUknowiPwn
0 Members and 1 Guest are viewing this topic.
4,776 views
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
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
So this is a code by my friend WhiteDevilHD, he told me it was okay that I could use it in my GunGame mod and since it's public I wanted to share his fancy counter (that I helped created, not leeching here).

Basically the bar moves up/down based on zombies alive (over time so not instantly, so "ANIMATED"), so if you kill a zombie it'll go DOWN  :rainbow: and a zombie spawns it goes up  :derp:!

Thread this on an onPlayerSpawned() function (any doesn't matter but I prefer _zombiemode since ease-of-access), not to worry about the script redrawing as there's a check for if the ZM counter for said player exists (3rd line of BeginZMCounter()).
Spoiler: click to open...
If you don't know how to thread it then you do...
Code Snippet
Plaintext
self thread BeginZMCounter();
Code Snippet
Plaintext
//Code by WhiteDevilHD.
BeginZMCounter()
{
self endon( "disconnect" );

if( isDefined( self.ZM_Counter ) )
return;

self.ZM_Counter = CreateZMCounter(275, 465, "white", "white", (0,0,0), (0,1,0),true,(1,0,0) );
Previous_Percentage = 0;
while(1)
{
remainingZombies = (get_enemy_count() + level.zombie_total);
remainingZombies_percentage = ( 100 * remainingZombies ) / level.zombies_spawn_this_round;
if( Previous_Percentage != remainingZombies_percentage )
{
self.ZM_Counter thread UpdateProgressBar(0.5, int(remainingZombies_percentage) );
self.ZM_Counter thread UpdateProgressBarText(remainingZombies);
self.ZM_Counter thread colorOverTime(Previous_Percentage, remainingZombies_percentage);
Previous_Percentage = remainingZombies_percentage;
}
if( remainingZombies == 0 )
{
while(1)
{
remainingZombies = get_enemy_count() + level.zombie_total;

if(remainingZombies != 0 )
{
break;
}

wait 0.5;
}
}
wait 0.5;
}
}

CreateZMCounter(x, y, Shader_Background, Shader_ProgressBar, _BACKGROUND_COLOR, _BAR_COLOR, Text, _TEXT_COLOR)
{
HUD_BAR = [];
ProgressBar_BACKGROUND = newClientHudElem( self );
ProgressBar_BACKGROUND.x = x;
ProgressBar_BACKGROUND.y = y; // -265;
ProgressBar_BACKGROUND.alpha = 1;
ProgressBar_BACKGROUND.sort = -3;
ProgressBar_BACKGROUND SetShader(Shader_Background, 102, 6);

if( isDefined( _BACKGROUND_COLOR ) )
{
ProgressBar_BACKGROUND.color = _BACKGROUND_COLOR;
}

ProgressBar_BAR = newClientHudElem( self );
ProgressBar_BAR.x = (x+1);
ProgressBar_BAR.y = (y+1); // -265;
ProgressBar_BAR.frac = 0;
ProgressBar_BAR.alpha = 0;
ProgressBar_BAR.sort = -2;
ProgressBar_BAR SetShader(Shader_ProgressBar, 1, 4);

if( isDefined( _BAR_COLOR) )
{
ProgressBar_BAR.color = _BAR_COLOR;
}

if( isDefined( Text ) )
{
ZombiesLeft = newClientHudElem( self );
ZombiesLeft.x = (x+1);
ZombiesLeft.y = (y-11);
ZombiesLeft.foreground = 1;
ZombiesLeft.fontscale = 1.05;
ZombiesLeft.alpha = 1;
ZombiesLeft.sort = 0;
ZombiesLeft.color = ( _TEXT_COLOR );
ZombiesLeft SetText("Zombies Left: ");

ZombiesLeft_SHADOW = newClientHudElem( self );
ZombiesLeft_SHADOW.x = (x+2);
ZombiesLeft_SHADOW.y = (y-11);
ZombiesLeft_SHADOW.foreground = 1;
ZombiesLeft_SHADOW.fontscale = 1.05;
ZombiesLeft_SHADOW.alpha = 0.4;
ZombiesLeft_SHADOW.sort = -1;
ZombiesLeft_SHADOW.color = ( 0,0,0 );
ZombiesLeft_SHADOW SetText("Zombies Left: ");
HUD_BAR[2] = ZombiesLeft;
HUD_BAR[3] = ZombiesLeft_SHADOW;
}
HUD_BAR[0] = ProgressBar_BACKGROUND;
HUD_BAR[1] = ProgressBar_BAR;
return HUD_BAR;
}

UpdateProgressBar(Time, Value)
{
self[1].alpha = 1;
IsNull = false;
if(Value == 0)
{
Value = 1;
IsNull = true;
}

self[1] scaleOverTime(Time, Value, 4);
if(IsNull)
{
wait(time);
self[1].alpha = 0;
}
}

UpdateProgressBarText(Text)
{
if( isDefined( self[2] ) )
{
self[3] SetText("Zombies Left: " + Text + ".");
self[2] SetText("Zombies Left: " + Text + ".");
}
}

colorOverTime(FromValue,Tovalue)
{
AmmountEachTime = (Tovalue - FromValue) / 10;
for( i = 1; i < 11; i++ )
{
self[1].color = ( ( FromValue + ( i * AmmountEachTime ) ) / 100  , ( 100 - ( FromValue + ( i * AmmountEachTime ) ) ) / 100, 0 );
self[2].color = ( ( FromValue + ( i * AmmountEachTime ) ) / 100  , ( 100 - ( FromValue + ( i * AmmountEachTime ) ) ) / 100, 0 );
wait(0.05);
}
}
Just need to make one little change in _zombiemode.gsc and that's to create the initial variable and then set it to the total zombies of said wave.

Variable added: level.zombies_spawn_this_round
Code Snippet
Plaintext
	//Intricate - Declare variable for ZM counter
level.zombies_spawn_this_round = undefined;
//
// Sets up function pointers for animscripts to refer to
level.playerlaststand_func = ::player_laststand;
// level.global_kill_func = maps\_zombiemode_spawner::zombie_death;

Code Snippet
Plaintext
	//DUKIP - Edit for the ZM counter
level.zombies_spawn_this_round = max;
//
level.zombie_total = max;
mixed_spawns = 0; // Number of mixed spawns this round.  Currently means number of dogs in a mixed round

// DEBUG HACK:
//max = 1;
old_spawn = undefined;
while( count < max )

Images:




Spoiler: click to open...
Yes we were both lazy to spawn another elem for zombies alive so we just decided to do a setText and update that frequently.
If you want to change it then go ahead!
Last Edit: October 03, 2014, 01:45:36 am by DidUknowiPwn

 
Loading ...