• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Help needed with extending classes in a mutator

Bej-Bej

Grizzled Veteran
May 5, 2009
146
2
The Hinterlands.
I'm trying to make a mutator that disables decapitation of specimens. I have already found in the KFMonster class a function called RemoveHead() which deals with aspects of removing a specimen head. What I have done is created a class called KFMonsterHack (seen below) which should do nothing when a decap would normally occur.
Class KFMonsterHack extends KFMonster;

function RemoveHead()
{
}
Then the mutator needs to make the game use the KFMonsterHack class instead of the KFMonster class.

Is my logic at this point correct?

I think the way I need to implement this in the mutator code involves the CheckReplacement() and ReplaceWith() functions, but the examples and wiki's that I have found have not gotten me very far.

Could someone provide me with some insight?
 
Hey Bej.
Not sure if that's what you want to do.
KFMonster is an abstract class and it's not being instanciated in the game.
What the game actually spawns are it's subclasses. Maybe you should subclass each monster's class and then use that class instead of it's original via Mutator code.

Maybe there's a way to change / add superclass code but I don't think you'll be able to pull it off within a mutator.

Cheers.
 
Upvote 0