Author Topic: [Guide] custom hud icons.  (Read 508 times)

So decaldata no longer works. Players with textures enabled will not see custom hud icons anymore.

But all you have to do is set the hud icon as AddDamageType. The CI will download normally through clients with textures enabled.


Quote
function showHUD(%client)
{
   if(%client.disableHUDUntil > $sim::time || $pref::server::TotalRPG::disableHUD)
      return;

   if(!isObject(%client.player) || %client.player.getDamageState() $= "Disabled")
   {
      %client.bottomPrint($pref::server::TotalRPG::deathMessage);
      return;
   }

   %health = mFloor(%client.player.getDatablock().maxDamage - %client.player.getDamageLevel());
   %mana = %client.player.mana;
   %Coins = %client.score;

   if(%Coins $= "")
      %Coins = 0;

   if(%client.currentSkill !$= "")
   {
      %skillHUD = %client.currentSkill SPC "Level" SPC %client.skillLevel[%client.currentSkill] SPC "(" @ %client.skillEXP[%client.currentSkill] SPC "/" SPC getLevelEXP(%client.skillLevel[%client.currentSkill] + 1) @ ") EXP";
   }
   
   if($totalRPGHUDExtensions > 0)
   {
      for(%i = 1; %i <= $totalRPGHUDExtensions; %i++)
      {
         %extension = $totalRPGHUDExtension[%i];
         
         %method = getField(%extension, 0);
         %target = getField(%extension, 1);
         %value = getField(%extension, 2);
         %name = getField(%extension, 3);
         %args = getField(%extension, 4);
         
         switch$(%target)
         {
            case "player":
               %target = %client.player;
            case "client":
               %target = %client;
            case "minigame":
               %target = %client.minigame;
         }
         
         if(!isObject(%target))
            continue;
         
         if(%method == 1)
         {
            %retrieveValue = %target.getAttribute(%value);
         }
         else if(%method == 2)
         {
            $temp = "";
            $tempC = %target;
            // Someone let me know if there is a better way to do this :/
            eval("$temp = $tempC." @ %value @ "(" @ %args @ ");");
            %retrieveValue = $temp;
         }
         
         %extensionStats = %extensionStats SPC "\c4" @ %name @ ":" SPC %retrieveValue;
      }
   }

   commandToClient(%client, 'bottomPrint', "\c2<bitmap:Add-Ons/server_totalrpg/CI_dinner>:" SPC %health @ (%mana $= "" ? "" : " \c1Mana:" SPC %mana) SPC "\c3" @ $pref::server::TotalRPG::currencyName @ ":" SPC %coins SPC "\c6" @ %skillHUD SPC %extensionStats, false);
}

//downloadable hud

AddDamageType("dinner",   '<bitmap:Add-Ons/server_totalRPG/CI_dinner> %1',    '%2 <bitmap:add-ons/server_totalRPG/CI_dinner> %1',0.5,1);

« Last Edit: September 29, 2018, 11:17:16 PM by King Tøny »

Now as far as having the HUD change icons based on damage similar to the classic DOOM marine icon, I don't know how to do that.


If anyone knows how to do that let me know and I'll put it in the OP.


Right now I can only have a normal and dead version, nothing in between. But that's only because of Peacon's cool totalRPG hud script.





« Last Edit: September 30, 2018, 01:49:00 AM by King Tøny »

I made 5 blockhead health icons, message me if you want the resource to add health tiers.

Here's the icons.

https://imgur.com/a/K4Bi36x


If someone is willing to edit the script to include these icons then we'd be all set for a fully animated-ish hud.

theres a way to just directly put the textures into the file manifest without any roundabout bullstuff but I forgot where I put the code for it

theres a way to just directly put the textures into the file manifest without any roundabout bullstuff but I forgot where I put the code for it

https://forum.blockland.us/index.php?topic=310808.0


you can't make clients download images without download textures off either way

You use to be able to with decaldata I believe.

new file system, you can no longer

Does anyone know how to make that animated hud though?

I made faces based on the amount of damage you receive.

Does anyone know how to make that animated hud though?
can you elaborate

can you elaborate

So I posted the script in the OP.

All someone has to do is change the HUD icon when a player receives some damage.

100 = normal

80 = battle damaged

50 = moderate battle damage

Etc