Syntax: Select all
print("Non-player took damage")
victim = make_object(Entity, stack_data)
info = make_object(TakeDamageInfo, stack_data)
attacker = Entity(info.attacker)
weapon = Entity(info.attacker)
owner = Player(index_from_inthandle(weapon.owner_handle))
info.attacker = owner.index
info.inflictor = owner.index
#if victim.classname in ('infected', 'witch', 'player'):
print("%s %s was attacked"%(victim.index, victim.classname,))
This works just fine for physics or player entities (when modified) but for whatever reason, infected don't appear to be entities? What baffles me even more is that in 'infected_hurt', I am able to created an entity from the userid -> index and it will return a classname. What would I need to do to hook damage to them?
I think I need to find the appropriate function to hook for when they take damage. However I am not sure where to find a list of appropriate functions. I've been perusing https://developer.valvesoftware.com/ for any information I can obtain but I haven't found much luck. There's gotta be a better way than reverse engineering via disassemblers/memory editing etc...?