Team036-DamageHistoryCallback icon

DamageHistoryCallback

Modding resource. Provide some useful callbacks.

By Team036
Last updated 5 months ago
Total downloads 545
Total rating 0 
Categories Client-side
Dependency string Team036-DamageHistoryCallback-1.2.3
Dependants 1 other package depends on this package

This mod requires the following mods to function

Team036-ClPlayerCallback-1.0.1 icon
Team036-ClPlayerCallback

Modding resource. Provide some useful callbacks.

Preferred version: 1.0.1

README

This mod provides some useful functions in client.

You should not install this until you are told.

Functions

I don't know how to obtain the damageSourceId from damage did by local player. So the DamageHistoryStruct which local player is the attacker, has eDamageSourceId.damagedef_unknown as damageSourceId.

sh_damage_history.gnut


global struct DamageHistoryStruct
{
	string attackerName
	string attackerPetName
	vector origin
	float damage

	int damageType // describe the damage
	int damageSourceId // what did the damage
	entity attacker
	int attackerEHandle
	float attackerHealthPercent
	float time
	array<string> weaponMods
	bool victimIsTitan
	bool rodeoDamage

	/// modded
	string victimName
	string victimPetName
	float victimHealthPercent
	entity victim
	bool victimIsNPC = false

	bool isHeadShot
	bool isKillShot
	bool isCritical
	bool isRodeo
	bool isMelee
	bool isElectric


	bool isExplosion 
	bool isBullet
	bool isShotgun 
	bool isTitanStep 
	bool isRagdoll 
	bool isGib
	///
}

DamageHistoryStruct function GetLastDamageHistoryByAttackerAndDamageSourceId( entity victim, entity attacker, int damageSourceId)
DamageHistoryStruct function GetLastDamageHistoryByDamageSourceId( entity victim, int damageSourceId )
DamageHistoryStruct function GetLastDamageHistoryByAttacker( entity victim, entity attacker )

array<DamageHistoryStruct> function GetDamageHistoryByAttacker( entity player, entity attacker, float time = 0 )
//string function DamageSourceIDToString( damageHistory.damageSourceId )
array<DamageHistoryStruct> function GetDamageHistoryByDamageSourceId( entity player, int damageSourceId, float time = 0 )
array<DamageHistoryStruct> function GetDamageHistoryByAttackerAndDamageSourceId( entity player, entity attacker, int damageSourceId, float time = 0 )

// DamageHistoryIncludeLocalClientPlayer clear after killReplayHudDeactive or localplayer killed.
array<DamageHistoryStruct> function GetDamageHistoryIncludeLocalClientPlayer( bool onlyAlive = false , bool merge = false)

bool function WasRecentlyHitByEntityAndDamageSourceId( entity player, entity attacker, int damageSourceId, float hitTime )
array<DamageHistoryStruct> function DefaultMergeDamageHistoryIncludeLocalClientPlayer(array < DamageHistoryStruct > inputHistories,
	 float mergeInterval = MERGE_INTERVAL
void function ClearDamageHistoryIncludeLocalClientPlayer()
void function StoreDamageHistoryToLocal(DamageHistoryStruct damageHistory, bool shouldMerge = true)

Example

Changelog

1.2.0

  • New feature. The script will try to obtain the damageSourceID from the dmg did by localPlayer.

1.2.1

  • Bugfix. Obtain the weapon after localPlayer's death. Valid check added.

1.2.2

  • Bugfix.

1.2.3

  • Bugfix.