[HL2:DM] es_blood to sp blood

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Sat Dec 04, 2021 7:48 pm

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)
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby cssbestrpg » Sat Dec 04, 2021 7:57 pm

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)
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Sat Dec 04, 2021 8:06 pm

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.
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby cssbestrpg » Sat Dec 04, 2021 8:13 pm

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.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Sat Dec 04, 2021 8:15 pm

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',
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby cssbestrpg » Sat Dec 04, 2021 8:18 pm

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
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Sat Dec 04, 2021 8:26 pm

Probably there is another "env" at Black Mesa Source instead of env_ar2explosion
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby cssbestrpg » Sat Dec 04, 2021 8:29 pm

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.
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby cssbestrpg » Mon Dec 06, 2021 3:41 pm

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)
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Mon Dec 06, 2021 9:41 pm

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

Syntax: Select all

if GAME_NAME == 'hl2mp':
and changed it to bms.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Mon Dec 13, 2021 9:12 am

Anyone have a solution for this error?
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby cssbestrpg » Mon Dec 13, 2021 10:12 am

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

Syntax: Select all

if GAME_NAME == 'hl2mp':
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.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Mon Dec 13, 2021 1:10 pm

Well but why search hl2dm weapons when I play bms?
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby cssbestrpg » Mon Dec 13, 2021 2:55 pm

Because the code was orginally made for hl2dm, based on the eventscripts script.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Tue Dec 14, 2021 9:25 pm

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?
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Tue Jan 18, 2022 5:08 pm

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

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 32 guests