Take damage to player death smoke

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

Please request only one plugin per thread.
User avatar
Lunacy_1984
Junior Member
Posts: 3
Joined: Tue May 27, 2025 2:37 am
Location: Vancouver, BC, Canada
Contact:

Take damage to player death smoke

Postby Lunacy_1984 » Tue May 27, 2025 2:44 am

Trying to change my script that Came from someone else from activating on "Take Damage" to "player death". I am very much new to this scripting.
For Half life 2 Deathmatch
The intended effect makes a smoke cloud when killed by an RPG. I want it for an example to rewrite some other things.

Syntax: Select all

# ../explosive/explosive_rpg.py

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 entities.entity import Entity
from weapons.manager import weapon_manager


DAMAGE_TRIGGERS = [
'rpg_missile',
]


@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', 'smoke/smokeandfire-11-7a.vmt')
entity.call_input('Explode')
entity.delay(8, entity.remove)
cssbestrpg
Senior Member
Posts: 317
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: Take damage to player death smoke

Postby cssbestrpg » Wed May 28, 2025 4:22 pm

You want this code to be changed to player_death event?

In that case here you go:

Syntax: Select all

from events import Event
from entities.entity import Entity
from memory import make_object
from players.entity import Player


KILL_TRIGGERS = [
'rpg_missile',
]


@Event('player_death')
def player_death(args):
if args.get_string('weapon') in KILL_TRIGGERS:
victim = Player.from_userid(args['userid'])
entity = make_object(Entity, victim.give_named_item('env_ar2explosion'))
entity.set_key_value_string('material', 'smoke/smokeandfire-11-7a.vmt')
entity.call_input('Explode')
entity.delay(8, entity.remove)
User avatar
Lunacy_1984
Junior Member
Posts: 3
Joined: Tue May 27, 2025 2:37 am
Location: Vancouver, BC, Canada
Contact:

Re: Take damage to player death smoke

Postby Lunacy_1984 » Mon Jun 02, 2025 10:53 pm

Thankyou for the help. I am going to get this to work for the combine ball smoke on Brand New for 1979 also
cssbestrpg
Senior Member
Posts: 317
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: Take damage to player death smoke

Postby cssbestrpg » Tue Jun 03, 2025 9:01 am

The code i send, it have option for adding weapons to triggered it for example(untested):

Syntax: Select all

KILL_TRIGGERS = [
'rpg_missile', '357',
]


It now should register effect for rpg_missile and 357 weapon kills
User avatar
Lunacy_1984
Junior Member
Posts: 3
Joined: Tue May 27, 2025 2:37 am
Location: Vancouver, BC, Canada
Contact:

Re: Take damage to player death smoke

Postby Lunacy_1984 » Sat Jun 07, 2025 4:37 am

I have three different test scripts that I use the original take damage for Grenade, SMG grenade, and slam makes black smoke. Player death version for RPG only makes a smoke that has fire mixed into the texture. Finally the last one again needing player death to work is the Combine ball that makes a blue and white smoke. The main goal is to build it all into one script.

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 38 guests