Looking for deathtype for a mutator

Discussions about Coding and Scripting
Letylove49
Adept
Posts: 303
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: admin Alicia Server
Location: suisse

Looking for deathtype for a mutator

Post by Letylove49 »

hi, i'm looking for deathtype to exclud it for follow weapons :

Supershockrifle
Warheadlauncher
custum redeemer
Nucléare weapons.
Naliweapons nucléare like NWUltimaProtosVIII.

Code: Select all

if ( ! bPlayerRedeemerSelfDamage && (string (DamageType)=="RedeemerDeath")  ) if ( Victim.IsA('PlayerPawn') ) if ( InstigatedBy == Victim ) ActualDamage = 0 ;
if ( ! bRedeemerTeamDamage  && (string (DamageType)=="RedeemerDeath")     )
Image

Letylove49 aka Alicia
User avatar
EvilGrins
Godlike
Posts: 10360
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Re: Looking for deathtype for a mutator

Post by EvilGrins »

User avatar
Barbie
Godlike
Posts: 3040
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Looking for deathtype for a mutator

Post by Barbie »

Letylove49 wrote: Sat Mar 08, 2025 9:42 pm hi, i'm looking for deathtype to exclud it for follow weapons :
You cannot determinate the damaging weapon in a TakeDamage() event, only the weapon the instigator currently holds. (If instigator's weapon has changed between shot and projectile impact, instigator's weapon is not the one which has caused damage and for example so the kill message mentions the "wrong" weapon.)
But each weapon has a property MyDamageType, for example

Code: Select all

class'ChainSaw'.MyDamageType=slashed
class'Enforcer'.MyDamageType=shot
class'ShockRifle'.MyDamageType=jolted (inherited to class'SuperShockRifle')
and if weapon's ProjectileClass is set, weapon's MyDamageType is changed to ProjectileClass.Default.MyDamageType in weapon's event PostBeginPlay. So for example MyDamageType is set to class'WarShell's MyDamageType ("RedeemerDeath") for the WarheadLauncher.

Mutator code:
Collect all wanted DamageTypes in a (configurable) array and check its entries against current DamageType in a Mutator's MutatorTakeDamage() event .

Stumbling blocks:
  • you cannot distinguish ShockRifle and SuperShockRifle
  • custom weapons may have the same DamageType as stock UT weapons
  • maybe check instigator's weapon also but keep in mind weapon may have changed or instigator is dead or has left game
"If Origin not in center it be not in center." --Buggie
Letylove49
Adept
Posts: 303
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: admin Alicia Server
Location: suisse

Re: Looking for deathtype for a mutator

Post by Letylove49 »

thanks you with my damage type that work   
Auto merged new post submitted 20 hours later
with this weapon that doesnt work : NWNuclearLauncherV3

Code: Select all

if ( ! bPlayerNWNuclearLauncherSelfDamage && (string (DamageType)=="Nuclear")  ) if ( Victim.IsA('PlayerPawn') ) if ( InstigatedBy == Victim ) ActualDamage = 0 ;
		if ( ! bPlayerNWNuclearLauncher2SelfDamage && (string (DamageType)=="Nuclear00")  ) if ( Victim.IsA('PlayerPawn') ) if ( InstigatedBy == Victim ) ActualDamage = 0 ;
Pehaps Ferildragon can help me for that.
Image

Letylove49 aka Alicia