Changing max health/suit power? Created 5 years ago2019-04-17 13:00:54 UTC by pakikakiker pakikakiker

Created 5 years ago2019-04-17 13:00:54 UTC by pakikakiker pakikakiker

Posted 5 years ago2019-04-17 13:00:54 UTC Post #342479
For example, I'd like to lower the suit's power cap to 50 instead of 100. How would I go about doing this? Thanks.
Posted 5 years ago2019-04-17 17:52:18 UTC Post #342480
I recall doing something similar (increasing it to 200) in 2015. Basically, you'll have to change a line in weapons.h, in the HL DLL project.

Around line 95:
#define MAX_NORMAL_BATTERY 100
Set the number to something else you'd like. It will affect battery pickups.

For the chargers, you'll have to go to h_battery.cpp and manually change some stuff: (starting at line 164)
// charge the player
if (m_hActivator->pev->armorvalue < 100)
{
    m_iJuice--;
    m_hActivator->pev->armorvalue += 1;

    if (m_hActivator->pev->armorvalue > 100)
        m_hActivator->pev->armorvalue = 100;
}
I think that's about it.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-04-18 13:18:40 UTC Post #342485
Thank you so much!
Posted 5 years ago2019-04-18 22:24:52 UTC Post #342489
You're welcome. :)
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-04-19 01:46:55 UTC Post #342492
Worked great, but is there also a way to make the suit icon display as full when it reaches 50, rather than halfway?
Posted 5 years ago2019-04-19 12:52:11 UTC Post #342495
I believe it's got something to do with this: (cl_dll/battery.cpp)
rc.top  += m_iHeight * ((float)(100-(V_min(100,m_iBat))) * 0.01);
So replace 0.01 with 0.02. I haven't tested this, but it should be that. It's around line 103, right after the #else line. Either way, the code for drawing that stuff on the HUD is there, so change it as you need.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 years ago2019-04-19 13:06:32 UTC Post #342496
Thanks!
Posted 5 years ago2019-04-19 23:01:45 UTC Post #342500
Adding on to Admer's last post, you'll also need to replace the 100's in the function with whatever you've changed your max power to. The specific line is 84.
You must be logged in to post a response.