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

Plutonium

  1. Home
  2. MW3 Modding Releases & Resources
  3. Velocity Hud/Health Hud

Velocity Hud/Health Hud

Scheduled Pinned Locked Moved MW3 Modding Releases & Resources
6 Posts 5 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Slxxpyundefined Offline
    Slxxpyundefined Offline
    Slxxpy
    wrote on last edited by Slxxpy
    #1

    Simple gsc script to show your health(with color changing depending on how low your health is) and velocity Hud that shows you highest velocity reached and current velocity speed.

    Credits:
    Clipzor = Clippy
    Slxxpy = Sleepy

    スクリーンショット (1149).png

    #include maps\mp\_utility;
    #include common_scripts\utility;
    #include maps\mp\gametypes\_hud_util;
    //Coded by Slxxpy and Clippy
    
    init(){
    
        level thread onConnect();
    
    }
    
    onConnect()
    {
      for (;;)
      {
        level waittill("connected", player);
        player thread PlayerSpawnedConnected();  
        player thread hudposition();
        player thread Velocity();
        player thread healthPlayer();
      }
    }
    
    PlayerSpawnedConnected()
    {
      self endon("disconnect");
      for(;;)
      {
        self waittill("spawned_player");
        self.velhigh = 0;
        self.velhighmeter setText("^3(" +floor(self.velhigh) + ")" );
      }
    }
    
    hudposition()
    {
    	self endon("disconnect");
        level endon("game_ended");	
        self.velmeter = self createFontString( "default", 1.5 );
        self.velmeter setPoint( "BOTTOM", "BOTTOM", 0, -26  );
        self.velmeter.label = &"^7";
        self.velmeter.HideWhenInMenu = true;
    
        self.velhighmeter = self createFontString( "default", 1.5 );
        self.velhighmeter setPoint( "BOTTOM", "BOTTOM", 0, -41  );
        self.velhighmeter setText("^3(" +floor(self.velhigh) + ")" );
        self.velhighmeter.HideWhenInMenu = true;
    }
    Velocity()
    {
    		self endon("disconnect");
    		level endon("game_ended");	
        self.velhigh = 0;
        self.velhighmeter setValue(floor(self.velhigh));
    		while(true)
    		{
    		self.newvel = self getvelocity();
    		self.newvel = sqrt(float(self.newvel[0] * self.newvel[0]) + float(self.newvel[1] * self.newvel[1]));
    		self.vel = self.newvel;
    		self.velmeter setvalue(floor(self.vel));
    
        if(self.vel > self.velhigh)
               {
                self.velhigh = self.vel;
                 self.velhighmeter setText("^3(" +floor(self.velhigh) + ")" );
                }
    
    		wait 0.05;
    
    		}
    }
    healthPlayer()
    {
        self endon("disconnect");
        self.healthText = createFontString( "default", 1.4 );
        self.healthText setPoint( "BOTTOM", "BOTTOM", 0, -8  );
        self.healthText.glowalpha = 1; 
        self.healthText.glowcolor = (0.0, 1.0, 0.0); 
        self.healthText.HideWhenInMenu = true;
       
           for(;;)
            {
        self.healthText setText( "Health: "+ self.health);
        self.healthText.glowcolor = (
            1.0 - self.health / 100,
            self.health / 100,
            0.0
        );
                wait 0.5;
            }
    }
    
    1 Reply Last reply
    1
    • Artyxundefined Offline
      Artyxundefined Offline
      Artyx Contributor
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • mxveundefined Offline
        mxveundefined Offline
        mxve VIP
        wrote on last edited by mxve
        #3

        Slxxpy said in Velocity Hud/Health Hud:

                if(self.health >= 90)
                {
                    self.healthText.glowcolor = (0.0, 1.0, 0.0);
                }
                else if(self.health >= 80)
                {
                    self.healthText.glowcolor = (0.1, 0.9, 0.0);
                }
                else if(self.health >= 70)
                {
                    self.healthText.glowcolor = (0.2, 0.8, 0.0);
                }
                else if(self.health >= 60)
                {
                    self.healthText.glowcolor = (0.3, 0.7, 0.0);
                }
                else if(self.health >= 50)
                {
                    self.healthText.glowcolor = (0.4, 0.6, 0.0);
                }
                else if(self.health >= 40)
                {
                    self.healthText.glowcolor = (0.5, 0.5, 0.0);
                }
                else if(self.health >= 30)
                {
                    self.healthText.glowcolor = (0.6, 0.4, 0.0);
                }
                else if(self.health >= 20)
                {
                    self.healthText.glowcolor = (0.7, 0.3, 0.0);
                }
                else if(self.health >= 10)
                {
                    self.healthText.glowcolor = (0.8, 0.2, 0.0);
                }
                else if(self.health >= 0)
                {
                    self.healthText.glowcolor = (1.0, 0.0, 0.0);
                }
        

        You can do something like this instead of using so many ifs

            self.healthText.glowcolor = (
                1.0 - self.health / 100,
                self.health / 100,
                0.0
            );
        

        Which will calculate values like this
        100 hp = (0.0, 1.0, 0.0)
        90hp = (0.1, 0.9, 0.0)
        ...
        10hp = (0.9, 0.1, 0.0)
        0hp = (1.0, 0.0, 0.0)

        alt text

        Slxxpyundefined 1 Reply Last reply
        0
        • Slxxpyundefined Offline
          Slxxpyundefined Offline
          Slxxpy
          replied to mxve on last edited by
          #4

          mxve o i see, that makes sense thank you:)

          1 Reply Last reply
          1
          • thewindowlickerundefined Offline
            thewindowlickerundefined Offline
            thewindowlicker
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • Akif_123undefined Offline
              Akif_123undefined Offline
              Akif_123
              wrote on last edited by
              #6

              can this work on cod 4 singleplayer?

              1 Reply Last reply
              0

              • Login

              • Don't have an account? Register

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