Page 1 of 1

How am I supposed to create a new Damage Type?

Posted: Thu Oct 18, 2018 2:58 am
by PrinceOfFunky
I see that DamageType subclasses have some variables but I can't find out where they are accessed from. From what I can see, GameInfo and Pawn doesn't even check for the name of a DamageType class but just for a name, then why DamageType's name has been converted to a localized variable? Unless there's something I don't know about the variable "name" in Actor.uc...
PlayDying() is the only function in Pawn.uc that changes the animation depending on a given "damage type" name, the behaviour is hardcoded, so how am I supposed to create a new Damage Type without creating a Pawn subclass?
I was thinking to check the "damage type" name from within Mutator.uc's PreventDeath(), but that wouldn't have sense with the function name.

Re: How am I supposed to create a new Damage Type?

Posted: Thu Oct 18, 2018 4:31 am
by Barbie
All occurrences I know use the data type Name for DamageType but not the sub classes of Actor>DamageType.

In my MonsterHunt version I have introduced two new DamageTypes and use them in MonsterHunt.GetDeathMsgSuicide():

Code: Select all

if (DamageType == 'TeamKill')
	DeathMsg = " was sentenced to death because of team kill";
else if (DamageType == 'FriendlyFire')
	DeathMsg = " died on too much friendly fire";
and I set this for example in Basemutator's function ScoreKill():

Code: Select all

Killer.Died(None, 'TeamKill', Killer.Location);

Re: How am I supposed to create a new Damage Type?

Posted: Thu Oct 18, 2018 1:43 pm
by PrinceOfFunky
Barbie wrote:All occurrences I know use the data type Name for DamageType but not the sub classes of Actor>DamageType.

In my MonsterHunt version I have introduced two new DamageTypes and use them in MonsterHunt.GetDeathMsgSuicide():

Code: Select all

if (DamageType == 'TeamKill')
	DeathMsg = " was sentenced to death because of team kill";
else if (DamageType == 'FriendlyFire')
	DeathMsg = " died on too much friendly fire";
and I set this for example in Basemutator's function ScoreKill():

Code: Select all

Killer.Died(None, 'TeamKill', Killer.Location);
Ok so, the DamageType class is not used anywhere, the localized "name" is actually a localized String in TournamentGameInfo:
Spoiler
class TournamentGameInfo extends GameInfo;

#exec AUDIO IMPORT FILE="Sounds\Generic\Resp2a.wav" NAME="Resp2A" GROUP="General"

var(DeathMessage) localized string DeathMessage[32]; // Player name, or blank if none.
var(DeathMessage) localized string DeathModifier[5];
var(DeathMessage) localized string MajorDeathMessage[8];
var(DeathMessage) localized string HeadLossMessage[2];
var(DeathMessage) localized string DeathVerb;
var(DeathMessage) localized string DeathPrep;
var(DeathMessage) localized string DeathTerm;
var(DeathMessage) localized string ExplodeMessage;
var(DeathMessage) localized string SuicideMessage;
var(DeathMessage) localized string FallMessage;
var(DeathMessage) localized string DrownedMessage;
var(DeathMessage) localized string BurnedMessage;
var(DeathMessage) localized string CorrodedMessage;
var(DeathMessage) localized string HackedMessage;
var(DeathMessage) localized string MortarMessage;
var(DeathMessage) localized string MaleSuicideMessage;
var(DeathMessage) localized string FemaleSuicideMessage;
while the DamageEffect is spawned and hardcoded in ScriptedPawn.PlayHit() and UnrealIPlayer.PlayHit(). I couldn't find the effect spawning in PlayerPawn.
Also an effect is spawned in ScriptedPawn.PlayDeathHit() and UnrealIPlayer.PlayDeathHit() that depends on the Region.Zone variables, which gives a sense to the "damage" related variables in ZoneInfo.uc .