News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Degenerating Health

Started by Mr A, October 21, 2014, 12:05:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mr A

In Nightmare mode your health degenerates.  How can I implement this?

I noticed there was a "deplete_armor" but no function for health anywhere. 

The Happy Friar

In the code I'm betting it checks the difficulty setting and if it's 3 (0-3, right?) then it auto-depletes until it's at a specific value.  Like in other id games where when you go above the max health/armor it auto-reduces until a certain value.

Mr A

I found this in the SDK.
(D3SDK\src\game\gamesys\SysCvar.cpp)
idCVar g_healthTakeTime( "g_healthTakeTime", "5", CVAR_GAME | CVAR_INTEGER | CVAR_ARCHIVE, "how often to take health in nightmare mode" );
idCVar g_healthTakeAmt( "g_healthTakeAmt", "5", CVAR_GAME | CVAR_INTEGER | CVAR_ARCHIVE, "how much health to take in nightmare mode" );
idCVar g_healthTakeLimit( "g_healthTakeLimit", "25", CVAR_GAME | CVAR_INTEGER | CVAR_ARCHIVE, "how low can health get taken in nightmare mode" );


And also this in a player file.
#ifndef ID_DEMO_BUILD
if ( g_skill.GetInteger() == 3 ) {
healthTake = true;
nextHealthTake = gameLocal.time + g_healthTakeTime.GetInteger() * 1000;
}
#endif
}

I guess it only works in Nightmare mode...

The Happy Friar

That's what g_skill.getIntiger does. 

You could make it for all difficulty levels by duplicating that if for the other ones & making some new cvar's.  IE easy could be 125, etc.