alphaprops
Posted: Sun Aug 09, 2020 5:31 pm
by daren adler
Hello SourcePython Team and Community,
Would it be possible to make a SP for me in my hl2dm server for alphaprops (
https://forums.alliedmods.net/showthread.php?p=2362847)(its for the things when you pick them up,like barrels,crate and you can see through them)
Thank you.
Re: alphaprops
Posted: Sun Aug 09, 2020 6:44 pm
by VinciT
Hi daren, I think this should do the trick:
Syntax: Select all
# ../alpha_props/alpha_props.py
# Source.Python
from entities.constants import RenderMode
from listeners import OnEntityOutput
# Transparency of the picked up object. (0 - 255)
PICKED_UP_ALPHA = 120
# Outputs that are fired when a player picks up and drops an object.
hooked_outputs = ('OnPlayerPickup', 'OnPhysGunDrop')
@OnEntityOutput
def on_entity_output(output, activator, caller, value, delay):
if output not in hooked_outputs:
return
if 'prop_physics' not in caller.classname:
return
caller.render_mode = RenderMode.TRANS_ALPHA
caller.call_input(
'Alpha', PICKED_UP_ALPHA if output == 'OnPlayerPickup' else 255)
Re: alphaprops
Posted: Sun Aug 09, 2020 7:25 pm
by daren adler
VinciT wrote:Hi daren, I think this should do the trick:
Syntax: Select all
# ../alpha_props/alpha_props.py
# Source.Python
from entities.constants import RenderMode
from listeners import OnEntityOutput
# Transparency of the picked up object. (0 - 255)
PICKED_UP_ALPHA = 120
# Outputs that are fired when a player picks up and drops an object.
hooked_outputs = ('OnPlayerPickup', 'OnPhysGunDrop')
@OnEntityOutput
def on_entity_output(output, activator, caller, value, delay):
if output not in hooked_outputs:
return
if 'prop_physics' not in caller.classname:
return
caller.render_mode = RenderMode.TRANS_ALPHA
caller.call_input(
'Alpha', PICKED_UP_ALPHA if output == 'OnPlayerPickup' else 255)
Yes Thank you so much, It works great
