Skip to content
  • 0 Unread 0
  • Recent
  • Popular
  • Users
  • Donate
Collapse
Home Docs Stats Discord Donate
Download
  1. Home
  2. BO2 Modding Releases & Resources
  3. Powerup Timer Countdown

Powerup Timer Countdown

Scheduled Pinned Locked Moved BO2 Modding Releases & Resources
3 Posts 2 Posters 727 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • vnm_420
    vnm_420
    vnm_420
    wrote on last edited by
    #1

    script that displays power up timers

    Lines 27-30 allow you to change where the timers are displayed on the screen

    Screenshot 2026-04-30 221037.png

    #include maps\mp_utility;
    #include common_scripts\utility;
    #include maps\mp\gametypes_zm_hud_util;
    #include maps\mp\zombies_zm_powerups;

    init()
    {
    level thread onPlayerConnect();
    }

    onPlayerConnect()
    {
    for(;;)
    {
    level waittill("connected", player);
    player thread playerPowerupTimers();
    }
    }

    playerPowerupTimers()
    {
    self endon("disconnect");
    level endon("end_game");

    flag_wait("initial_blackscreen_passed");
    
    self.doublePointsTimer = self createPowerupTimerHud(-42, -36);
    self.instaKillTimer = self createPowerupTimerHud(-14, -36);
    self.fireSaleTimer = self createPowerupTimerHud(14, -36);
    self.zombieBloodTimer = self createPowerupTimerHud(42, -36);
    
    zombieBloodWasActive = false;
    zombieBloodSeconds = 0;
    zombieBloodTick = 0;
    
    for(;;)
    {
    	self updatePowerupTimer(self.doublePointsTimer, getTeamPowerupTime("zombie_powerup_point_doubler_on", "zombie_powerup_point_doubler_time"));
    	self updatePowerupTimer(self.instaKillTimer, getTeamPowerupTime("zombie_powerup_insta_kill_on", "zombie_powerup_insta_kill_time"));
    	self updatePowerupTimer(self.fireSaleTimer, getGlobalPowerupTime("zombie_powerup_fire_sale_on", "zombie_powerup_fire_sale_time"));
    	
    	zombieBloodActive = self isZombieBloodActive();
    
    	if(zombieBloodActive && !zombieBloodWasActive)
    	{
    		zombieBloodSeconds = 30;
    		zombieBloodTick = 0;
    	}
    
    	if(zombieBloodSeconds > 0)
    	{
    		self updatePowerupTimer(self.zombieBloodTimer, zombieBloodSeconds);
    		zombieBloodTick++;
    
    		if(zombieBloodTick >= 4)
    		{
    			zombieBloodSeconds--;
    			zombieBloodTick = 0;
    		}
    	}
    	else
    		self updatePowerupTimer(self.zombieBloodTimer, 0);
    
    	zombieBloodWasActive = zombieBloodActive;
    
    	wait 0.25;
    }
    

    }

    createPowerupTimerHud(x, y)
    {
    hud = createFontString("small", 1.25);
    hud setpoint("CENTER", "BOTTOM", x, y);
    hud.alpha = 0;
    hud.sort = 30;
    hud.color = (1, 1, 1);
    return hud;
    }

    updatePowerupTimer(hud, timeLeft)
    {
    if(!isDefined(hud))
    return;

    if(timeLeft > 0)
    {
    	hud.alpha = 1;
    	hud setvalue(getWholeSeconds(timeLeft));
    }
    else
    {
    	hud setText("");
    	hud.alpha = 0;
    }
    

    }

    getTeamPowerupTime(activeVar, timeVar)
    {
    if(!isDefined(level.zombie_vars))
    return 0;

    team = "allies";
    
    if(isDefined(self.team))
    	team = self.team;
    
    if(!isDefined(level.zombie_vars[team]))
    	return 0;
    
    if(!isDefined(level.zombie_vars[team][activeVar]))
    	return 0;
    
    if(!level.zombie_vars[team][activeVar])
    	return 0;
    
    if(!isDefined(level.zombie_vars[team][timeVar]))
    	return 0;
    
    return level.zombie_vars[team][timeVar];
    

    }

    getGlobalPowerupTime(activeVar, timeVar)
    {
    if(!isDefined(level.zombie_vars))
    return 0;

    if(!isDefined(level.zombie_vars[activeVar]))
    	return 0;
    
    if(!level.zombie_vars[activeVar])
    	return 0;
    
    if(!isDefined(level.zombie_vars[timeVar]))
    	return 0;
    
    return level.zombie_vars[timeVar];
    

    }

    getWholeSeconds(timeLeft)
    {
    seconds = 0;

    while(seconds < timeLeft)
    	seconds++;
    
    return seconds;
    

    }

    isZombieBloodActive()
    {
    if(isDefined(self.ignoreme) && self.ignoreme)
    return true;

    if(isDefined(self.zombie_blood) && self.zombie_blood)
    	return true;
    
    if(isDefined(self.zombie_blood_on) && self.zombie_blood_on)
    	return true;
    
    if(isDefined(self.zombieblood) && self.zombieblood)
    	return true;
    
    return false;
    

    }

    1 Reply Last reply
    1
    • vnm_420
      vnm_420
      vnm_420
      wrote on last edited by vnm_420
      #2

      Updated HUD https://drive.google.com/file/d/1_F2WEZNLCL2GV6dguHE5enHGog8DpD9L/view?usp=sharing
      https://www.virustotal.com/gui/file/3304407c442f22354198464eefa2d12a0cb1ae453e133f377004b188803077b8

      1 Reply Last reply
      0
      • iTzLoveSniper
        iTzLoveSniper
        iTzLoveSniper
        wrote last edited by
        #3

        Hi vnm_420, I used your GameTimer script as a starting point and built a reworked mod from it: powerup timers that follow the game’s real icon order, plus Insta-Kill Pro, permanent Fire Sale, Mob of the Dead afterlife and game-over handling. I’d like to post it in the releases section with full credit to you

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Unread 0
        • Recent
        • Popular
        • Users
        • Donate