Page 3 of 3
Re: [HL2:DM] es_blood to sp blood
Posted: Sat Dec 04, 2021 7:48 pm
by Painkiller
Hello I use this for Black Mesa Source
but it does not work there is no error message.
Can anybody help?
Syntax: Select all
from entities import TakeDamageInfo
from entities.entity import Entity
from entities.hooks import EntityCondition, EntityPreHook
from memory import make_object
from players.entity import Player
from weapons.manager import weapon_manager
DAMAGE_TRIGGERS = [
'weapon_frag',
'weapon_handgrenade',
'grenade_mp5',
'grenade_rpg',
'weapon_satchel',
'weapon_tripmine',
]
@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def _pre_take_damage(stack_data):
victim = make_object(Entity, stack_data[0])
if not victim.is_player():
return
info = make_object(TakeDamageInfo, stack_data[1])
try:
weapon_index = info.weapon
weapon = Entity(weapon_index).classname
except:
return
try:
if weapon in DAMAGE_TRIGGERS:
fragcloud(Player(victim.index))
except AttributeError:
pass
def fragcloud(victim):
entity = make_object(Entity, victim.give_named_item('env_ar2explosion'))
entity.set_key_value_string('material', 'particle/smokeball3.vmt')
entity.call_input('Explode')
entity.delay(8, entity.remove)
Re: [HL2:DM] es_blood to sp blood
Posted: Sat Dec 04, 2021 7:57 pm
by cssbestrpg
Painkiller wrote:Hello I use this for Black Mesa Source
but it does not work there is no error message.
Can anybody help?
Try this one:
Syntax: Select all
from entities import TakeDamageInfo
from entities.entity import Entity
from entities.hooks import EntityCondition, EntityPreHook
from memory import make_object
from players.entity import Player
from core import GAME_NAME
DAMAGE_TRIGGERS = [
'weapon_frag',
'weapon_handgrenade',
'grenade_mp5',
'grenade_rpg',
'weapon_satchel',
'weapon_tripmine',
]
@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def _pre_take_damage(stack_data):
victim = make_object(Entity, stack_data[0])
if not victim.is_player():
return
info = make_object(TakeDamageInfo, stack_data[1])
try:
weapon_index = info.weapon
weapon = Entity(weapon_index).classname
except:
return
try:
if GAME_NAME == 'hl2mp':
if weapon in DAMAGE_TRIGGERS:
fragcloud(Player(victim.index))
else:
fragcloud(Player(victim.index))
except AttributeError:
pass
def fragcloud(victim):
entity = make_object(Entity, victim.give_named_item('env_ar2explosion'))
entity.set_key_value_string('material', 'particle/smokeball3.vmt')
entity.call_input('Explode')
entity.delay(8, entity.remove)
Re: [HL2:DM] es_blood to sp blood
Posted: Sat Dec 04, 2021 8:06 pm
by Painkiller
Now i become this error
Code: Select all
2021-12-04 21:05:27 - sp - EXCEPTION
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/explosive/explosive.py", line 36, in _pre_take_damage
fragcloud(Player(victim.index))
File "../addons/source-python/plugins/explosive/explosive.py", line 42, in fragcloud
entity = make_object(Entity, victim.give_named_item('env_ar2explosion'))
ValueError: Pointer is NULL.
Re: [HL2:DM] es_blood to sp blood
Posted: Sat Dec 04, 2021 8:13 pm
by cssbestrpg
Painkiller wrote:Now i become this error
Code: Select all
2021-12-04 21:05:27 - sp - EXCEPTION
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/explosive/explosive.py", line 36, in _pre_take_damage
fragcloud(Player(victim.index))
File "../addons/source-python/plugins/explosive/explosive.py", line 42, in fragcloud
entity = make_object(Entity, victim.give_named_item('env_ar2explosion'))
ValueError: Pointer is NULL.
I think that error is caused by a weapon it tries to give, but can't tell sure, since i don't have a game.
Re: [HL2:DM] es_blood to sp blood
Posted: Sat Dec 04, 2021 8:15 pm
by Painkiller
Are the names correct?
because in half life 2 deathmatch you don't say weapon_grenade but npc_grenade_frag
only I do not find anything to the correct designations
Syntax: Select all
'weapon_frag',
'weapon_handgrenade',
'grenade_mp5',
'grenade_rpg',
'weapon_satchel',
'weapon_tripmine',
Re: [HL2:DM] es_blood to sp blood
Posted: Sat Dec 04, 2021 8:18 pm
by cssbestrpg
Those weapons names doesn't matter, i made a game checker, that checks the game, before getting the weapon.
The code i gave simply checks a game. The error it gives, is caused by env_ar2explosion, it seem to be only in Half-Life_2 series
Re: [HL2:DM] es_blood to sp blood
Posted: Sat Dec 04, 2021 8:26 pm
by Painkiller
Probably there is another "env" at Black Mesa Source instead of env_ar2explosion
Re: [HL2:DM] es_blood to sp blood
Posted: Sat Dec 04, 2021 8:29 pm
by cssbestrpg
Painkiller wrote:Probably there is another "env" at Black Mesa Source instead of env_ar2explosion
There probably is, but i can't really check for them.
Re: [HL2:DM] es_blood to sp blood
Posted: Mon Dec 06, 2021 3:41 pm
by cssbestrpg
Hey Painkiller try this one:
I found possible "env", i think it should work.
Syntax: Select all
from entities import TakeDamageInfo
from entities.entity import Entity
from entities.hooks import EntityCondition, EntityPreHook
from memory import make_object
from players.entity import Player
from core import GAME_NAME
DAMAGE_TRIGGERS = [
'weapon_frag',
'weapon_handgrenade',
'grenade_mp5',
'grenade_rpg',
'weapon_satchel',
'weapon_tripmine',
]
@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def _pre_take_damage(stack_data):
victim = make_object(Entity, stack_data[0])
if not victim.is_player():
return
info = make_object(TakeDamageInfo, stack_data[1])
try:
weapon_index = info.weapon
weapon = Entity(weapon_index).classname
except:
return
try:
if GAME_NAME == 'hl2mp':
if weapon in DAMAGE_TRIGGERS:
fragcloud(Player(victim.index))
else:
fragcloud(Player(victim.index))
except AttributeError:
pass
def fragcloud(victim):
entity = make_object(Entity, victim.give_named_item('env_smokestack'))
entity.set_key_value_string('material', 'particle/smokeball3.vmt')
entity.call_input('Explode')
entity.delay(8, entity.remove)
Re: [HL2:DM] es_blood to sp blood
Posted: Mon Dec 06, 2021 9:41 pm
by Painkiller
i become this error
Code: Select all
2021-12-06 22:40:45 - sp - EXCEPTION
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/explosive/explosive.py", line 36, in _pre_take_damage
fragcloud(Player(victim.index))
File "../addons/source-python/plugins/explosive/explosive.py", line 44, in fragcloud
entity.call_input('Explode')
File "../addons/source-python/packages/source-python/entities/_base.py", line 597, in call_input
self.get_input(name)(*args, **kwargs)
File "../addons/source-python/packages/source-python/entities/_base.py", line 582, in get_input
return self.inputs[name]
KeyError: 'Explode'
Edit: I noticed that you had an error there
and changed it to bms.
Re: [HL2:DM] es_blood to sp blood
Posted: Mon Dec 13, 2021 9:12 am
by Painkiller
Anyone have a solution for this error?
Re: [HL2:DM] es_blood to sp blood
Posted: Mon Dec 13, 2021 10:12 am
by cssbestrpg
Painkiller wrote:i become this error
Code: Select all
2021-12-06 22:40:45 - sp - EXCEPTION
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/explosive/explosive.py", line 36, in _pre_take_damage
fragcloud(Player(victim.index))
File "../addons/source-python/plugins/explosive/explosive.py", line 44, in fragcloud
entity.call_input('Explode')
File "../addons/source-python/packages/source-python/entities/_base.py", line 597, in call_input
self.get_input(name)(*args, **kwargs)
File "../addons/source-python/packages/source-python/entities/_base.py", line 582, in get_input
return self.inputs[name]
KeyError: 'Explode'
Edit: I noticed that you had an error there
and changed it to bms.
That code game name checking wasn't incorrect, it checked the game for hl2dm and their weapons.
Just remove the entity.call_input('Explode') then it should work.
Now that you changed the game name checking to bms, it no longer activate the effect.
Re: [HL2:DM] es_blood to sp blood
Posted: Mon Dec 13, 2021 1:10 pm
by Painkiller
Well but why search hl2dm weapons when I play bms?
Re: [HL2:DM] es_blood to sp blood
Posted: Mon Dec 13, 2021 2:55 pm
by cssbestrpg
Because the code was orginally made for hl2dm, based on the eventscripts script.
Re: [HL2:DM] es_blood to sp blood
Posted: Tue Dec 14, 2021 9:25 pm
by Painkiller
Yes I am aware of that, because I created the post.
But my question all along was to do this for BMS.
Then why does hl2dm have to be in it?
Re: [HL2:DM] es_blood to sp blood
Posted: Tue Jan 18, 2022 5:08 pm
by Painkiller
Is there any new infowmation here to use this for Black Mesa: Source?
I may have found something here
hitgroup = player.get_property_int('m_LastHitGroup')
Greeting Painkiller