AcceptEntityInput
AcceptEntityInput
Does Source.Python has some function similar to AcceptEntityInput from SourceMod or I need to call CBaseEntity::AcceptInput directly?
I'm trying to deal damage over point_hurt
it falls on hurt.Hurt() with this error:
I knew about damage function, but I want to know how can I call AcceptInput.
Also, is it normal that damage function gives damage to player in 2.857 times less, then I set?
Code: Select all
hurt = BaseEntity(ServerTools.create_entity('point_hurt'))
hurt.name = 'killer' + str(hurt.index)
hurt.edict.set_key_value_string('DamageTarget', player.edict.get_key_value_string('targetname'))
hurt.edict.set_key_value_string('damage', '150')
hurt.edict.set_key_value_string('damagetype', '0')
ServerTools.spawn_entity(hurt.index)
hurt.Hurt()
hurt.Kill()
it falls on hurt.Hurt() with this error:
Code: Select all
[SP] Caught an Exception:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\events\listener.py', line
84, in fire_game_event
callback(game_event)
File '..\addons\source-python\plugins\ns_test\ns_test.py', line 142, in player
_say
hurt.Hurt()
File '..\addons\source-python\packages\source-python\entities\entity.py', line
117, in __getattr__
AttributeError: Attribute 'Hurt' not found
I knew about damage function, but I want to know how can I call AcceptInput.
Also, is it normal that damage function gives damage to player in 2.857 times less, then I set?
- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Whenever I use DamageTypes.FALL, it seems to do the correct damage.
I am planning on creating a "hurt" method for BaseEntity. I have done a little bit of work on it, but have not tested it at all.
I am also currently working on an update to the BaseEntity attributes. It won't (shouldn't) affect usage. There may be an issue with the current implementation that does not register Hurt, but I do know that my current version of the update shows Hurt to properly be a method.
*Edit: also worth noting, if you use <BaseEntity>.Kill() , it takes a tick to kill off the entity. Using ServerTools.remove_entity(<index>) does the same. To remove the entity immediately, use ServerTools.remove_entity_immediate(<index>) .
I am planning on creating a "hurt" method for BaseEntity. I have done a little bit of work on it, but have not tested it at all.
I am also currently working on an update to the BaseEntity attributes. It won't (shouldn't) affect usage. There may be an issue with the current implementation that does not register Hurt, but I do know that my current version of the update shows Hurt to properly be a method.
*Edit: also worth noting, if you use <BaseEntity>.Kill() , it takes a tick to kill off the entity. Using ServerTools.remove_entity(<index>) does the same. To remove the entity immediately, use ServerTools.remove_entity_immediate(<index>) .
satoon101 wrote:Whenever I use DamageTypes.FALL, it seems to do the correct damage.
Am I doing something wrong?
Syntax: Select all
from entities.constants import DamageTypes
from events import Event
from players.entity import PlayerEntity
from players.helpers import index_from_userid
@Event
def player_say(event):
userid = event.get_int('userid')
text = event.get_string('text')
player = PlayerEntity(index_from_userid(userid))
if text == 'run':
player.damage(player.index, 100, DamageTypes.FALL, hitgroup=0, iObjectsPenetrated=2)
When someone type "run" in chat he gets only 35 HP damage (100 / 2.857).
CS:S, Windows, May 14 build.
- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
L'In20Cible wrote:Well its normal you tell the game the bullet has passed 2 objects before hurting the player so less damage is.expected
Nothing changes if I remove it...
satoon101 wrote:The OrangeBox engine doesn't have an iObjectsPenetrated, only CS:GO does.
After several attempts to fix it I took your code from this forum, but

- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 78 guests