Re: Additions to skill definiton

Moderator: GZDoom Developers

User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: Additions to skill definiton

Post by HotWax »

Alright, here is a patch to add NoPain, MonsterHealth and FriendlyHealth to the skill definition.

I made some educated guesses as to how this should work. If I need to tweak it, I can.

First off, there's no range checking on Monster/FriendlyHealth, but I've made it so you can't make an actor's starting health go below 1 (which would make them invincible) -- they'll always have a default of 1 health to start. I've made the change directly in AActor:StaticSpawn so enemies placed in the map, spawned by scripts, or summoned from the console should all be affected. I've also done some hackery so that enemies spawned using summonfoe or summonfriend will adapt to their new role -- If you summon a friendly monster, he'll use FriendlyHealth to determine his start health, not MonsterHealth, and vice versa. Same if you override a friendly monster to an enemy using summonfoe.

I also made it so for all intents and purposes an enemy's max health is based on the adjusted value. So GetActorProperty(APROP_MaxHealth) will return the adjusted value, not the original. I figured the only negative side-effect are scripts not behaving properly because their values are hard-coded, and the fact is there's nothing I can do about that in any case -- mods going forward will have to be aware that the skill levels could adjust max enemy health, and using these settings on old mods is not guaranteed to work.

Also, certain Raven boss enemies base their actions off their percentage of health, and they will be... funky... when the max health is adjusted really low. Mostly they will just refuse to use some of their abilities or might use them at the wrong times. This shouldn't be a problem if you're using reasonble values. (But what fun is that?! ;))

Without further ado, the patch:

[edit] Look down. [/edit]

Here are a couple (ridiculous) sample skill definitions to test with:

Code: Select all

// Enemies are one-shot kill, friendlies are godly
skill "Paper thin"
{
	name="Paper Thin"
	monsterhealth=0.001
	friendlyhealth=10
	spawnfilter=4	
}

// Enemies are godly, friendlies are one-shot kill, nobody feels pain
skill "Strong Enemies"
{
	name="Strong Enemies"
	monsterhealth=10
	friendlyhealth=0.001
	spawnfilter=4
	nopain
}
[edit] Corrected code snippet's description of the nopain flag.
Last edited by HotWax on Thu Jul 02, 2009 3:02 pm, edited 4 times in total.
User avatar
.+:icytux:+.
Posts: 2661
Joined: Thu May 17, 2007 1:53 am
Location: Finland

Additions to skill definiton

Post by .+:icytux:+. »

this is exactly how i thought it when i suggested it, if this gets added = :happyface:
User avatar
Enjay
 
 
Posts: 26573
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Additions to skill definiton

Post by Enjay »

And, funnily enough, until I found out how the Doom skill definitions worked, I always assumed that the easy difficulties had slightly lower HP enemies and the harder settings had higher HP enemies.
User avatar
Ghastly
... in rememberance ...
Posts: 6109
Joined: Fri Jul 06, 2007 2:34 pm

Re: Additions to skill definiton

Post by Ghastly »

Enjay wrote:And, funnily enough, until I found out how the Doom skill definitions worked, I always assumed that the easy difficulties had slightly lower HP enemies and the harder settings had higher HP enemies.
Ironic how that wasn't even possible for another 15 years (assuming this gets in soon). :P
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: Additions to skill definiton

Post by HotWax »

Another note I forgot to mention. The NoPain flag is currently implemented to prevent everything that can go into a pain state when taking damage from doing so, which includes friendly and unfriendly monsters and for all I know the player himself. (That might be handled elsewhere though, not sure) It'd be fairly trivial to create a separate version for friendly monsters, but that seems kind of overkill to me... Anyway if it's an issue it's nothing that can't be tweaked a bit.
User avatar
Rachael
Posts: 13793
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Additions to skill definiton

Post by Rachael »

HotWax, that was the most pain in the ass code I've ever merged. Nevertheless, it's in the community build now.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: Additions to skill definiton

Post by HotWax »

SoulPriestess wrote:HotWax, that was the most pain in the ass code I've ever merged. Nevertheless, it's in the community build now.
LOL. How so? Anything I could have done to make it easier?

I'm just using TortoiseSVN's built in patch maker to generate these patches. If I need to use a different utility, I can.

(That said, there were quite a few changes in this one, just because of the number of places that were grabbing the actor's default health directly :P)
User avatar
Rachael
Posts: 13793
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Additions to skill definiton

Post by Rachael »

Your tabs were turned into spaces. I had to merge it in manually to maintain any sort of consistency with the actual source files. It is probably a fault of the editor you used, though.

Also, posting the patch as an attachment, instead of a

Code: Select all

 block helps.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: Additions to skill definiton

Post by HotWax »

Ah, OK. It looks like the tabs are lost when I post the code here. I'll use the patch files directly from now on. Thanks for pointing that out. :)
User avatar
Rachael
Posts: 13793
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Additions to skill definiton

Post by Rachael »

Not a problem, thanks for helping with that. :)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49183
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Additions to skill definiton

Post by Graf Zahl »

HotWax wrote:Ah, OK. It looks like the tabs are lost when I post the code here.

They are indeed - which is why I won't deal with

Code: Select all

'd patches.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: Additions to skill definiton

Post by HotWax »

Graf Zahl wrote:They are indeed - which is why I won't deal with

Code: Select all

'd patches.[/quote]
So noted.  For some reason I was thinking you actually preferred them that way.  My bad.

Also, please let me know if there's anything I need to fix with these submissions.  I'm quite new to editing the ZDoom source so I'm sure there're cases and exceptions I'm forgetting about.

Return to “Closed Feature Suggestions [GZDoom]”