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

BO3 Zombie Counter

broken avatar :(
Created 8 years ago
by Rampage_619
0 Members and 1 Guest are viewing this topic.
14,774 views
broken avatar :(
×
broken avatar :(
Date Registered: 15 August 2011
Last active: 7 years ago
Posts
6
Respect
Forum Rank
Legless Crawler
Primary Group
Community Scripter
My Groups
More
×
Rampage_619's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Rampage_619's Contact & Social Links
Zombie Counter for BO3 Custom maps






Go to Root>usermaps>zm_yourmapname(open the folder corresponding with your map)

Open zm_yourmapname.gsc

Find the following function
Code Snippet
Plaintext
function main()

add the following line inside
Code Snippet
Plaintext
zombiesleft_hud();

so it should look like this
Code Snippet
Plaintext
function main()
{
zm_usermap::main();

level._zombie_custom_add_weapons =&custom_add_weapons;

//Setup the levels Zombie Zone Volumes
level.zones = [];
level.zone_manager_init_func =&usermap_test_zone_init;
init_zones[0] = "start_zone";
level thread zm_zonemgr::manage_zones( init_zones );
//Zombie Counter
zombiesleft_hud();


// Added to allow On spawned functionality
callback::on_spawned( &on_player_spawned );

// Change this to TRUE if you would like the Weapon Box to spawn in a random location other than _start

level.random_pandora_box_start = false;


}

Now go to the bottom of the file and copy and paste the following code

Code Snippet
Plaintext
// Zombie Counter 1.0
function zombiesleft_hud()
{   
//Rampage_619: Beta 1.0
//Rampage_619: play with the x value to move the hud left and right
// Rampage_619: increase the " Remaining.x" if the numbers start to overlay
// Rampage_619: play with the Y value to push the hud up and down

Remaining = create_simple_hud();
  Remaining.horzAlign = "center";
  Remaining.vertAlign = "middle";
    Remaining.alignX = "middle";
    Remaining.alignY = "middle";
    Remaining.y = 230;
    Remaining.x = 5;
    Remaining.foreground = 1;
    Remaining.fontscale = 2.0;
    Remaining.alpha = 1;
    Remaining.color = ( 0.423, 0.004, 0 );


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


while(1)
{
//level.zombie_total = get_zombie_count_for_round( level.round_number, level.players.size );
//zw_total = zombie_utility::get_current_actor_count();
remainingZw = get_zw_count();
//= zw_total;
Remaining SetValue(remainingZw);

if(remainingZw ==  0 )
{
Remaining.alpha = 0;
ZombiesLeft.alpha = 0;
while(1)
{
remainingZw = get_zw_count();
//= zw_total;
Remaining SetValue(remainingZw);

if(remainingZw != 0  )
{
Remaining.alpha = 1;
ZombiesLeft.alpha = 1;                     
break;
}
wait 0.05;
}
}
wait 0.5;
}
}

function get_zw_count()
{
enemies = [];
level.current_zw_array = [];
enemies = GetAiSpeciesArray( level.zombie_team, "all" );

for( i = 0; i < enemies.size; i++ )
{
if ( IS_TRUE( enemies[i].ignore_enemy_count ) )
{
continue;
}
ARRAY_ADD( level.current_zw_array, enemies[i] );
}

level.current_zw_count = level.current_zw_array.size;

return level.current_zw_count;
}
function create_simple_hud( client, team )
{
if ( IsDefined( team ) )
{
hud = NewTeamHudElem( team );
hud.team = team;
}
else
{
if( IsDefined( client ) )
{
hud = NewClientHudElem( client );
}
else
{
hud = NewHudElem();
}
}

level.hudelem_count++;

hud.foreground = true;
hud.sort = 1;
hud.hidewheninmenu = false;

return hud;
}

Use launcher to select your map and only check the link option and build.

Will be updating this with more color tuts and different designs.

Post comments if any issue persists.

broken avatar :(
×
broken avatar :(
Location: auAustralia
Date Registered: 4 October 2016
Last active: 7 years ago
Posts
59
Respect
Forum Rank
Rotting Walker
Primary Group
Member
Signature
What is the meaning of life? Dank Memes.
×
SponsoredByCloro's Contact & Social Links
Good work, anyway we can change the "Souls Needed" text to just "Zombies Left"?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 4 May 2013
Last active: 3 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Signature
My name is Synd, a CoD4 mapper moving to BO3.. Wish me luck.
×
ZombieKills's Groups
ZombieKills's Contact & Social Links
Good work, anyway we can change the "Souls Needed" text to just "Zombies Left"?
In the script it looks like it already is, but all you need to do is change what is in the parenthesis after SetText
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 27 December 2014
Last active: 4 years ago
Posts
13
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Tomzen's Groups
Tomzen's Contact & Social Links
Using this script apparently breaks triggers. Me and a friend had to remove it in order for custom triggers to work.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
Using this script apparently breaks triggers. Me and a friend had to remove it in order for custom triggers to work.

This shouldn't break triggers since it doesn't reference them in any way.

The problem might be is you are not threading the function, OP should update the script.

This would only be a problem if you are trying to initialize other scripts/functions below this one, which is probably what you are doing if you have custom triggers.

Change the main function to this:
Code Snippet
Plaintext
function main()
{
zm_usermap::main();

level._zombie_custom_add_weapons =&custom_add_weapons;

//Setup the levels Zombie Zone Volumes
level.zones = [];
level.zone_manager_init_func =&usermap_test_zone_init;
init_zones[0] = "start_zone";
level thread zm_zonemgr::manage_zones( init_zones );
//Zombie Counter
thread zombiesleft_hud();


// Added to allow On spawned functionality
callback::on_spawned( &on_player_spawned );

// Change this to TRUE if you would like the Weapon Box to spawn in a random location other than _start

level.random_pandora_box_start = false;
}
Last Edit: October 10, 2016, 11:48:15 am by reckfullies
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 13 February 2014
Last active: 7 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
My Contact & Social Links
More
×
DuBCraft21's Groups
DuBCraft21's Contact & Social LinksDuBCraft21DubCraftDuBCraft21
I have a bit of a question... why in the get_zw_count function, why do you write:

Code Snippet
Plaintext
	if ( IS_TRUE( enemies[i].ignore_enemy_count ) )
{
continue;
}
ARRAY_ADD( level.current_zw_array, enemies[i] );
}

level.current_zw_count = level.current_zw_array.size;
return level.current_zw_count;

instead of:

Code Snippet
Plaintext
	if ( IS_TRUE( enemies[i].ignore_enemy_count ) )
{
continue;
}
level.current_zw_count++;
}
return level.current_zw_count;

This way is more efficient because the game doesn't need to handle memory allocation, as well as the counter which in your code is just hidden in the array. This is also more efficient because it doesn't have to handle as many function calls as the currently standing code does.
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 9 October 2016
Last active: 5 years ago
Posts
53
Respect
Forum Rank
Rotting Walker
Primary Group
Donator ♥
My Groups
More
×
kaizokuroof's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
kaizokuroof's Contact & Social Links
First of all - Thanks for releasing your script! Second of all, is this script just counting the zombies that have spawned? So it's max number would be that of 24 (the total possible instances of zombies on a map at one time).

Not a true representation of the zombies to go?


Snippy

I tried replacing your code, but it did not work for me?
broken avatar :(
×
broken avatar :(
Date Registered: 15 August 2011
Last active: 7 years ago
Posts
6
Respect
Forum Rank
Legless Crawler
Primary Group
Community Scripter
My Groups
More
×
Rampage_619's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Rampage_619's Contact & Social Links
First of all - Thanks for releasing your script! Second of all, is this script just counting the zombies that have spawned? So it's max number would be that of 24 (the total possible instances of zombies on a map at one time).

Not a true representation of the zombies to go?


I tried replacing your code, but it did not work for me?

this script is to get the total amount of zombies for the round, not the total amount of zombies alive.
broken avatar :(
×
broken avatar :(
Date Registered: 15 August 2011
Last active: 7 years ago
Posts
6
Respect
Forum Rank
Legless Crawler
Primary Group
Community Scripter
My Groups
More
×
Rampage_619's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Rampage_619's Contact & Social Links
I have a bit of a question... why in the get_zw_count function, why do you write:

Code Snippet
Plaintext
	if ( IS_TRUE( enemies[i].ignore_enemy_count ) )
{
continue;
}
ARRAY_ADD( level.current_zw_array, enemies[i] );
}

level.current_zw_count = level.current_zw_array.size;
return level.current_zw_count;

instead of:

Code Snippet
Plaintext
	if ( IS_TRUE( enemies[i].ignore_enemy_count ) )
{
continue;
}
level.current_zw_count++;
}
return level.current_zw_count;

This way is more efficient because the game doesn't need to handle memory allocation, as well as the counter which in your code is just hidden in the array. This is also more efficient because it doesn't have to handle as many function calls as the currently standing code does.

Dubcraft, why increase it one by one, when you can just take the entire array......
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
Dubcraft, why increase it one by one, when you can just take the entire array......

There is no point in using an array if you are still going to get the same results using an integer variable along with presumably better code performance.

It is essentially the same except you are getting the array every time when you could just be adding to a variable.
Last Edit: October 13, 2016, 04:37:57 pm by reckfullies
broken avatar :(
×
broken avatar :(
Location: es
Date Registered: 21 September 2014
Last active: 7 years ago
Posts
28
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Minepro14's Groups
Minepro14's Contact & Social Links
what i should change if i want that the counter shows me the total amount of zombies of the round??
broken avatar :(
×
broken avatar :(
Location: auAustralia
Date Registered: 4 October 2016
Last active: 7 years ago
Posts
59
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
SponsoredByCloro's Contact & Social Links
The script just counts how many zombies are alive, not how many left in the current round.
broken avatar :(
×
broken avatar :(
Location: no
Date Registered: 29 September 2013
Last active: 4 years ago
Posts
12
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
~The stupid one~
×
Rosasau100's Groups
Rosasau100's Contact & Social Linksrosasau100Rosasau100Rosasau100
this script is to get the total amount of zombies for the round, not the total amount of zombies alive.

Then it is not doing what it is suppose to, it just counts the zombies that are currently alive

 
Loading ...