Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Bugs with Health Bar mod

Bugs with Health Bar mod

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
4 Posts 3 Posters 1.6k 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.
  • Base 115undefined Offline
    Base 115undefined Offline
    Base 115
    wrote on last edited by
    #1

    I'm having problems working the following script taken from this topic here on the forum:

    Script:

    init()
    {
    	level.clientid = 0;
    	level.perk_purchase_limit = 9;
    	level thread onplayerconnect();
    }
    
    onplayerconnect()
    {
    	for ( ;; )
    	{
    		level waittill( "connecting", player );
    		player thread onplayerspawned();
    		player.clientid = level.clientid;
    		level.clientid++;
    		player thread healthPlayer(); // Here I call my HUD HEALTH function
    		
    	}
    }
    
    healthPlayer()
    {
    	self endon("disconnect");
    	//self iprintln( "HEALTH: "+ self.health);
    	self.healthText = createFontString("Objective" , 1.7); //Fixed
            self.healthText setPoint("CENTER", "TOP", 300, "CENTER");
            while(true)
                  {
                   self.healthText setText( "^2HEALTH: ^7"+ self.health);
                   wait 0.5;
                  }
    }
    

    Console Errors:

    **** 3 script error(s):
    **** Unresolved external :  "onplayerspawned" with 0 parameters in "health_bar" at line 1 ****
    **** Unresolved external :  "createfontstring" with 2 parameters in "health_bar" at line 1 ****
    **** Unresolved external :  "setpoint" with 4 parameters in "hea
    

    Can you help me resolve this?

    1 Reply Last reply
    0
    • ThugDuck12undefined Offline
      ThugDuck12undefined Offline
      ThugDuck12
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • ThugDuck12undefined Offline
        ThugDuck12undefined Offline
        ThugDuck12
        wrote on last edited by
        #3
        #include maps/mp/_utility;
        #include common_scripts/utility;
        #include maps/mp/zombies/_zm;
        #include maps/mp/zombies/_zm_perks;
        #include maps/mp/zombies/_zm_utility;
        #include maps/mp/gametypes_zm/_hud_util;
        #include maps/mp/gametypes_zm/_hud_message;
        
        init()
        {
        	level thread onPlayerConnect();
        }
        
        onPlayerConnect()
        {
        	for(;;)
        	{
        		level waittill("connected", player);
        		player iprintln("^1Health ^7Bar ^2ON");
        		player thread onPlayerSpawned();
        	}
        }
        
        
        onPlayerSpawned()
        {
        	level endon("end_game");
        	self endon("disconnect");
        	self waittill("spawned_player");
        	self thread health_bar_hud();
        }
        
        health_bar_hud()
        {
        	level endon("end_game");
        	self endon("disconnect");
        	flag_wait("initial_blackscreen_passed");
        
        	health_bar = self createprimaryprogressbar();
        	if (level.script == "zm_buried")
        	{
        		health_bar setpoint(undefined, "BOTTOM", 0, -5);
        	}
        	else if (level.script == "zm_tomb")
        	{
        		health_bar setpoint(undefined, "BOTTOM", 0, -5);
        	}
        	else
        	{
        		health_bar setpoint(undefined, "BOTTOM", 0, -5);
        	}
        	health_bar.hidewheninmenu = 1;
        	health_bar.bar.hidewheninmenu = 1;
        	health_bar.barframe.hidewheninmenu = 1;
        
        	health_bar_text = self createprimaryprogressbartext();
        	if (level.script == "zm_buried")
        	{
        		health_bar_text setpoint(undefined, "BOTTOM", -75, -5);
        	}
        	else if (level.script == "zm_tomb")
        	{
        		health_bar_text setpoint(undefined, "BOTTOM", -75, -5);
        	}
        	else
        	{
        		health_bar_text setpoint(undefined, "BOTTOM", -75, -5);
        	}
        	health_bar_text.hidewheninmenu = 1;
        
        	while (1)
        	{
        		if (isDefined(self.e_afterlife_corpse))
        		{
        			if (health_bar.alpha != 0)
        			{
        				health_bar.alpha = 0;
        				health_bar.bar.alpha = 0;
        				health_bar.barframe.alpha = 0;
        				health_bar_text.alpha = 0;
        			}
        			
        			wait 0.05;
        			continue;
        		}
        
        		if (health_bar.alpha != 1)
        		{
        			health_bar.alpha = 1;
        			health_bar.bar.alpha = 1;
        			health_bar.barframe.alpha = 1;
        			health_bar_text.alpha = 1;
        		}
        
        		health_bar updatebar(self.health / self.maxhealth);
        		health_bar_text setvalue(self.health);
        
        		wait 0.05;
        	}
        }
        

        try this, its a health bar, with a bar, in the center just above the drops

        1 Reply Last reply
        1
        • C0NFU510Nundefined Offline
          C0NFU510Nundefined Offline
          C0NFU510N
          wrote on last edited by
          #4

          gsc file?

          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
          • Recent
          • Tags
          • Popular
          • Users
          • Groups