Blockland Forums > Suggestions & Requests

Animated HUD.

Pages: << < (5/6) > >>

Xenos109:

Use a switch statement, I forget the exact syntax in Torque, but something like this should work:

--- Code: ---%healthBitmap = "";

switch(mFloor(%health / 20))
{
    case 5: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/100%health>"; break;
    case 4: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/80%health>"; break;
    case 3: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/60%health>"; break;
    case 2: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/40%health>"; break;
    case 1: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/20%health>"; break;
    default: %healthBitmap = "Dead";
}

 commandToClient(%client, 'bottomPrint', ... %healthBitmap ... );

--- End code ---


Conan:

longtime nosee xenos

Xenos109:


--- Quote from: Conan on October 30, 2018, 11:34:06 PM ---longtime nosee xenos

--- End quote ---

These forums are a boredom magnet

King Tøny:


--- Quote from: Xenos109 on October 30, 2018, 09:26:34 PM ---Use a switch statement, I forget the exact syntax in Torque, but something like this should work:

--- Code: ---%healthBitmap = "";

switch(mFloor(%health / 20))
{
    case 5: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/100%health>"; break;
    case 4: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/80%health>"; break;
    case 3: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/60%health>"; break;
    case 2: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/40%health>"; break;
    case 1: %healthBitmap = "<bitmap:Add-Ons/server_totalrpg/20%health>"; break;
    default: %healthBitmap = "Dead";
}

 commandToClient(%client, 'bottomPrint', ... %healthBitmap ... );

--- End code ---

--- End quote ---

I'll try it but I think my script needs more coding than that.

phflack:

are you just trying to change the image in the bottomprint, or a whole new spot?

also, for those cutoffs it's probably better to use if statements than a switch

Pages: << < (5/6) > >>

Go to full version