How am I supposed to create a new Damage Type?

Discussions about Coding and Scripting

How am I supposed to create a new Damage Type?

Postby PrinceOfFunky » Thu Oct 18, 2018 2:58 am

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.
Image
User avatar
PrinceOfFunky
Godlike
 
Posts: 1024
Joined: Mon Aug 31, 2015 10:31 pm

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

Postby Barbie » Thu Oct 18, 2018 4:31 am

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);
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Barbie
Godlike
 
Posts: 1656
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

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

Postby PrinceOfFunky » Thu Oct 18, 2018 1:43 pm

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: show
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 .
Image
User avatar
PrinceOfFunky
Godlike
 
Posts: 1024
Joined: Mon Aug 31, 2015 10:31 pm


Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 4 guests