Hi There! This is my first time creating and sharing a script mod!
This mod is an update to the existing file obtained from
TomasFreeman15 post, and the original mod is from teh_bandit.
I don't know how to compile scripts, so I'm sharing the raw uncompiled text—but it works anyway!.
Description:
-
- Shield Health: I ran some tests and I noticed the shield's health in TranZit is higher than in later maps (MOTD and Origins); the shield's health in TranZit keeps at 2250, whereas in the other maps it is 1500.
-
- Shield Meter Value: In the original script, a fixed numerical value was displayed (which also adjusts automatically based on the map, as I mentioned earlier); I thought it would be more "better" to scale the shield health from 0 to 100 and have the color change (Green, Yellow, and Red) depending on the shield's damage recieved.
-
- Label: It seems to me that TranZit lacks a native shader specifically for the shield UI—which is why an icon couldn't be used there—so I opted to replace it and use the static "Shield" label instead.
And that’s it! I hope you find this useful. I decided to place this label on the right side of the screen so it wouldn't interfere with other mods that also display on-screen information.
Location you need to put the Script for it to work:
AppData\Local\Plutonium\storage\t6\scripts\zm\shield meter-uncompiled.gsc
SCRIPT:
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\zombies\_zm_utility;
#include maps\mp\gametypes_zm\_hud_util;
init()
{
level thread onPlayerConnect();
}
onPlayerConnect()
{
for(;;)
{
level waittill("connected", player);
player iprintln("^1Shield Meter Loaded");
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
level endon("end_game");
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self thread shield_hud();
}
}
shield_hud()
{
self endon("disconnect");
flag_wait("initial_blackscreen_passed");
shield_label = newClientHudElem(self);
shield_label.alignx = "right";
shield_label.aligny = "bottom";
shield_label.horzalign = "user_right";
shield_label.vertalign = "user_bottom";
shield_label.x = -75;
shield_label.y = -225;
shield_label.hidewheninmenu = 1;
shield_label.fontscale = 1.7;
shield_label.alpha = 0;
shield_label settext("Shield: ");
shield_text = newClientHudElem(self);
shield_text.alignx = "right";
shield_text.aligny = "bottom";
shield_text.horzalign = "user_right";
shield_text.vertalign = "user_bottom";
shield_text.x = -55;
shield_text.y = -225;
shield_text.hidewheninmenu = 1;
shield_text.fontscale = 1.7;
shield_text.alpha = 0;
max_health = 1500;
map = getdvar("mapname");
if(map == "zm_transit") { max_health = 2250; }
for(;;)
{
if (self hasweapon("riotshield_zm") || self hasweapon("alcatraz_shield_zm") || self hasweapon("tomb_shield_zm") )
{
shield_label.alpha = 1;
shield_text.alpha = 1;
}
else
{
shield_label.alpha = 0;
shield_text.alpha = 0;
}
if (!isdefined(self.shielddamagetaken))
{
self.shielddamagetaken = 0;
}
pct = int( ((max_health - self.shielddamagetaken) / max_health) * 100 );
if (pct < 0)
{
shield_text setvalue(0);
}
else
{
shield_text setvalue(pct);
}
if (pct > 66) { shield_text.color = (0.2, 1, 0.2); }
else if (pct > 33) { shield_text.color = (1, 1, 0.2); }
else { shield_text.color = (1, 0.2, 0.2); }
wait 0.05;
if(self.shielddamagetaken >= max_health)
{
shield_text.alpha = 0;
shield_label.alpha = 0;
}
}
}
SCREENSHOTS:
