Hey there
I've got attacker's Player entity, but I don't want his active weapon to go into TakeDamageInfo, I want to see skull and crossbones in the killfeed. However, if I pass None as a weapon_index, Entity.take_damage automatically fills in my attacker's active weapon.
I tried setting weapon_index to WORLD_ENTITY_INDEX, but then there's no damage inflicted at all.
What can I do besides building TakeDamageInfo manually and using Entity.on_take_damage instead?
Thanks
Entity.take_damage question
Entity.take_damage question

My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.

Re: Entity.take_damage question
This take_damage function became too intelligent, I feel like we need to do some kind of WeaponIndex.AUTO constant to differ None when we're too lazy to pass attacker's weapon from None when we don't want any attacker weapon.

My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.

Re: Entity.take_damage question
If anything, I went with
Shorter than I expected
Syntax: Select all
from entities import TakeDamageInfo
from entities.constants import DamageTypes
def take_damage(entity, damage, attacker):
take_damage_info = TakeDamageInfo()
take_damage_info.attacker = attacker.index
take_damage_info.damage = damage
take_damage_info.type = DamageTypes.GENERIC
entity.on_take_damage(take_damage_info)
Shorter than I expected

My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.

Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 93 guests