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

Plutonium

  1. Home
  2. WAW Modding Releases & Resources
  3. Health Zombie Indicator + Zombie Counter

Health Zombie Indicator + Zombie Counter

Scheduled Pinned Locked Moved WAW Modding Releases & Resources
5 Posts 3 Posters 548 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.
  • Darkness105undefined Offline
    Darkness105undefined Offline
    Darkness105
    wrote last edited by Darkness105
    #1

    (01661904-49de-4f57-a72b-a7b4d1715a6f-image.png

    #include maps\_utility;
    #include common_scripts\utility;
    #include maps\_zombiemode_utility;
    
    init()
    {
        thread onConnect();
    }
    
    onConnect()
    {
        for(;;)
        {
            level waittill( "connecting", player );
            player thread zombiesleft_hud();
    		player thread zombie_health_hud();
        }
    }
    
                                                                ///////////////////////////////////////////////////////////
                                                                ////////////////////////COUNTER ZM/////////////////////////
                                                                ///////////////////////////////////////////////////////////
    
    zombiesleft_hud()
    {
    	Remaining = create_simple_hud(); //Hud Zombie Value
    	Remaining.horzAlign = "center";
    	Remaining.vertAlign = "bottom";
    	Remaining.alignX = "left";
    	Remaining.alignY = "bottom";
    	Remaining.y = -5;
    	Remaining.x = 0;
    	Remaining.foreground = 1;
    	Remaining.fontscale = 1.5;
    	Remaining.alpha = 0;
    	Remaining.color = ( 0, 255, 0  );
    
    	ZombiesLeft = create_simple_hud(); //Hud Zombie Text
    	ZombiesLeft.horzAlign = "center";
    	ZombiesLeft.vertAlign = "bottom";
    	ZombiesLeft.alignX = "left";
    	ZombiesLeft.alignY = "bottom";
    	ZombiesLeft.y = -5;
    	ZombiesLeft.x = -29;
    	ZombiesLeft.foreground = 1;
    	ZombiesLeft.fontscale = 1.5;
    	ZombiesLeft.alpha = 0;
    	ZombiesLeft.color = (0.7, 0, 0);
    	ZombiesLeft SetText("ZM:");
    
    	thread fade_in(Remaining, 1, 0.5);
    	thread fade_in(ZombiesLeft, 1, 0.5);
    
    	while(1)
    	{
    		remainingZombies = get_enemy_count() + level.zombie_total;
    		Remaining SetValue(remainingZombies);
    
    		if(remainingZombies == 0 )
    		{
    			Remaining SetText("Waiting...");
    			thread fade_out(Remaining, 0, 0.5);
    			thread fade_out(ZombiesLeft, 0, 0.5);
    			while(1)
    			{
    				remainingZombies = get_enemy_count() + level.zombie_total;
    				if(remainingZombies != 0 )
    				{
    					thread fade_in(Remaining, 1, 0.5);
    					thread fade_in(ZombiesLeft, 1, 0.5);
    					break;
    				}
    				wait 0.5;
    			}
    		}
    		wait 0.5;
    	}
    }
    
    fade_in(hudElem, targetAlpha, duration)
    {
    	steps = 10;
    	stepTime = duration / steps;
    	for(i = 0; i <= steps; i++)
    	{
    		hudElem.alpha = i * (targetAlpha / steps);
    		wait stepTime;
    	}
    	hudElem.alpha = targetAlpha;
    }
    
    fade_out(hudElem, targetAlpha, duration)
    {
    	steps = 10;
    	startAlpha = hudElem.alpha;
    	stepTime = duration / steps;
    	for(i = 0; i <= steps; i++)
    	{
    		hudElem.alpha = startAlpha - i * ((startAlpha - targetAlpha) / steps);
    		wait stepTime;
    	}
    	hudElem.alpha = targetAlpha;
    }
    
                                                            ////////////////////////////////////////////////////////////////////
                                                            ////////////////////////VIEWER ZOMBIE HP////////////////////////////
                                                            ////////////////////////////////////////////////////////////////////
    
    zombie_health_hud()
    {
        level endon("game_ended");
        self endon("disconnect");
    
    	health_hud = NewHudElem();
    	health_hud.alignX = "center";
    	health_hud.alignY = "middle";
    	health_hud.horzAlign = "center";
    	health_hud.vertAlign = "middle";
    	health_hud.y = 50;
    	health_hud.alpha = 0;
    	health_hud.fontScale = 1.4;
    	health_hud.color = (1, 0.8, 0);
    	health_hud.hidewheninmenu = true;
    
    	health_bar = NewHudElem();
    	health_bar.alignX = "center";
    	health_bar.alignY = "middle";
    	health_bar.horzAlign = "center";
    	health_bar.vertAlign = "middle";
    	health_bar.y = 80;
    	health_bar.x = -75;
    	health_bar.alpha = 0;
    	health_bar.width = 150;
    	health_bar.height = 12;
    	health_bar.foreground = 1;
    	health_bar.hidewheninmenu = true;
    	health_bar.color = (0, 1, 0);
    
    	last_target = undefined;
    
    	while(1)
    	{
    		zombie = self get_zombie_in_crosshair();
    		if(isDefined(zombie) && isAlive(zombie))
    		{
    			if(!isDefined(last_target) || zombie != last_target)
    			{
    				health_hud FadeOverTime(0.3);
    				health_hud.alpha = 1;
    				health_bar FadeOverTime(0.3);
    				health_bar.alpha = 1;
    				last_target = zombie;
    			}
    			health = zombie.health;
    			if(isDefined(zombie.maxhealth))
    				max_health = zombie.maxhealth;
    			else
    				max_health = 150;
    			enemy_type = "Enemy";
    			if(isDefined(zombie.model) && (zombie.model == "zombie_dog" || zombie.classname == "actor_zombie_dog"))
    				enemy_type = "Hellhound";
    			else if(isDefined(zombie.is_zombie))
    				enemy_type = "Zombie";
    			health_hud SetText(enemy_type + " HP: " + health + "/" + max_health);
    			health_hud.alpha = 1;
    
    			health_percent = health / max_health;
    			if(health_percent > 0.5)
    				health_bar.color = (0, 1, 0);
    			else if(health_percent > 0.25)
    				health_bar.color = (1, 1, 0);
    			else
    				health_bar.color = (1, 0, 0);
    
    			health_bar.width = int(150 * health_percent);
    			health_bar.alpha = 1;
    		}
    		else
    		{
    			if(isDefined(last_target))
    			{
    				health_hud FadeOverTime(0.3);
    				health_hud.alpha = 0;
    				health_bar FadeOverTime(0.3);
    				health_bar.alpha = 0;
    				last_target = undefined;
    			}
    		}
    		wait 0.05;
    	}
    }
    
    get_zombie_in_crosshair()
    {
        self endon("death");
    
        start = self.origin + (0,0,60);
        end = start + AnglesToForward(self.angles) * 1000;
    
        trace = BulletTrace(start, end, true, self);
    
        if(!isDefined(trace["entity"]))
            return undefined;
    
        entity = trace["entity"];
    
        if(!isDefined(entity))
            return undefined;
    
        distance = Distance(self.origin, entity.origin);
        if(distance > 400)
            return undefined;
    
        return entity;
    }
    

    This script shows the health status of zombies and, of course, hellhounds, etc. (When aiming at a zombie or a dog.)

    (If you want to turn off the zombie hp indicator, just comment in line 16 and then it will not be displayed.)

    Этот скрипт показывает состояние здоровья зомби и конечно же, адских гончих и т.д. (когда наводишь прицел на зомби или на собаку.)

    (Если хотите выкл индикатор здоровье зомби то просто закоментируйте в 16 строке и тогда не будет отображаться.)

    //player thread zombie_health_hud();
    

    Tutorial

    1. Go to the plutonium folder C:\Users\YOU_NAME\AppData\Local\Plutonium\storage\t4\raw\scripts\sp
    2. Create a text document and name it whatever you want, but replace the extension of this .txt with this .gsc
    3. We enter my code in the notepad
    4. And we check if you did everything right.

    Руководство

    1. Заходим в папку plutonium C:\Users\YOU_NAME\AppData\Local\Plutonium\storage\t4\raw\scripts\sp
    2. Создаем текстовый документ и называем его как хотите, но заменяем расширение это .txt на .gsc
    3. Вставляем мой код в блокнот
    4. И проверяем, все ли вы сделали правильно.
    1 Reply Last reply
    1
    • Ohmyundefined Offline
      Ohmyundefined Offline
      Ohmy
      wrote last edited by
      #2

      it doesn't work for me

      1 Reply Last reply
      0
      • Ohmyundefined Offline
        Ohmyundefined Offline
        Ohmy
        wrote last edited by
        #3

        It works in solo mode, not a server.

        DirkRockfaceundefined 1 Reply Last reply
        0
        • Ohmyundefined Ohmy

          It works in solo mode, not a server.

          DirkRockfaceundefined Offline
          DirkRockfaceundefined Offline
          DirkRockface
          Contributor
          wrote last edited by
          #4

          Ohmy that's normal, it would be silly for you to be able to load your own scripts that took effect on other's servers. Scripts are for solo or servers you host.

          1 Reply Last reply
          0
          • Darkness105undefined Offline
            Darkness105undefined Offline
            Darkness105
            wrote last edited by
            #5

            well, if you create your own server, then all players will have it.

            1 Reply Last reply
            0
            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
            • Donate