Page 2 of 3
Re: Half-Life 2 Deathmatch - God mode
Posted: Thu Mar 17, 2022 8:20 pm
by daren adler
cssbestrpg wrote:Try this one(untested):
Syntax: Select all
# ../killstreak_god/killstreak_god.py
# Python
import random
from time import time
# Source.Python
from engines.sound import engine_sound
from events import Event
from messages import SayText2
from players.entity import Player
from players.helpers import index_from_userid
from effects import TempEntity
from engines.precache import Model
from mathlib import Vector
from filters.recipients import RecipientFilter
effect_model = Model('sprites/greenglow1.vmt')
class StreakPlayer(Player):
caching = True # Uses caching
def __init__(self, index):
super().__init__(index)
self.consecutive_kills = 0
self.reset_delay = None
def grant_godmode(self, duration):
"""Gives godmode to the player for the specified duration."""
try:
# Let's see if there's a reset delay.
running = self.reset_delay.running
except AttributeError:
running = False
# Well, is there?
if running:
# Update the execution with the newer duration.
self.reset_delay.exec_time = time() + duration
# Nope.
else:
self.set_godmode(True)
self.reset_delay = self.delay(duration, self._reset_godmode)
def _reset_godmode(self):
self.set_godmode(False)
SayText2(f"{self.name} is no longer in godmode!").send()
@Event('player_death')
def player_death(ev):
victim = StreakPlayer.from_userid(ev['userid'])
victim.consecutive_kills = 0
# Try to get the attacker, or exit the call if not a valid player
try:
attacker = StreakPlayer.from_userid(ev['attacker'])
except ValueError:
return
attacker.consecutive_kills += 1
if attacker.consecutive_kills == 12:
attacker.consecutive_kills = 0
attacker.grant_godmode(duration=45)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
beamRing(attacker, 0, 350, 10, 45, 3, 2, r, g, b)
emitsound(attacker, 'buttons/blip2.wav', 1.0, 0.7)
SayText2(f"{attacker.name} has reached 12 kills and is in godmode now!").send()
def emitsound(userid, sound, volume, attenuation):
engine_sound.precache_sound(sound)
index = index_from_userid(userid)
engine_sound.emit_sound(RecipientFilter(), index, 0, sound, volume, attenuation)
def beamRing(userid, startRadius, endRadius, zplus, lifeTime, width, amplitude, r, g, b, a=255):
x,y,z = getPlayerLocation(userid)
tempEnt = TempEntity('BeamRingPoint')
tempEnt.red = r
tempEnt.green = g
tempEnt.blue = b
tempEnt.alpha = a
tempEnt.center = Vector(x, y, z + zplus)
tempEnt.start_radius = startRadius
tempEnt.end_radius = endRadius
tempEnt.life_time = lifeTime
tempEnt.start_width = width
tempEnt.end_width = width
tempEnt.amplitude = amplitude
tempEnt.halo_index = effect_model
tempEnt.model_index = effect_model
tempEnt.create()
def getPlayerLocation(userid):
x,y,z = Player.from_userid(userid).get_key_value_string('origin').split(' ')
return (float(x), float(y), float(z))
Nope, sorry no beacon when killed 12 in a row. and have 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 92, in fire_game_event
callback(game_event)
File "..\addons\source-python\plugins\killstreak_god\killstreak_god.py", line 68, in player_death
beamRing(attacker, 0, 350, 10, 45, 3, 2, r, g, b)
File "..\addons\source-python\plugins\killstreak_god\killstreak_god.py", line 78, in beamRing
x,y,z = getPlayerLocation(userid)
File "..\addons\source-python\plugins\killstreak_god\killstreak_god.py", line 101, in getPlayerLocation
x,y,z = Player.from_userid(userid).get_key_value_string('origin').split(' ')
File "..\addons\source-python\packages\source-python\players\_base.py", line 109, in from_userid
return cls(index_from_userid(userid), caching=caching)
Boost.Python.ArgumentError: Python argument types in
_players._helpers.index_from_userid(StreakPlayer)
did not match C++ signature:
index_from_userid(unsigned int Userid)
Re: Half-Life 2 Deathmatch - God mode
Posted: Thu Mar 17, 2022 8:25 pm
by cssbestrpg
Fixed in this:
Syntax: Select all
# ../killstreak_god/killstreak_god.py
# Python
import random
from time import time
# Source.Python
from engines.sound import engine_sound
from events import Event
from messages import SayText2
from players.entity import Player
from players.helpers import index_from_userid
from effects import TempEntity
from engines.precache import Model
from mathlib import Vector
from filters.recipients import RecipientFilter
effect_model = Model('sprites/greenglow1.vmt')
class StreakPlayer(Player):
caching = True # Uses caching
def __init__(self, index):
super().__init__(index)
self.consecutive_kills = 0
self.reset_delay = None
def grant_godmode(self, duration):
"""Gives godmode to the player for the specified duration."""
try:
# Let's see if there's a reset delay.
running = self.reset_delay.running
except AttributeError:
running = False
# Well, is there?
if running:
# Update the execution with the newer duration.
self.reset_delay.exec_time = time() + duration
# Nope.
else:
self.set_godmode(True)
self.reset_delay = self.delay(duration, self._reset_godmode)
def _reset_godmode(self):
self.set_godmode(False)
SayText2(f"{self.name} is no longer in godmode!").send()
@Event('player_death')
def player_death(ev):
victim = StreakPlayer.from_userid(ev['userid'])
victim.consecutive_kills = 0
# Try to get the attacker, or exit the call if not a valid player
try:
attacker = StreakPlayer.from_userid(ev['attacker'])
except ValueError:
return
attacker.consecutive_kills += 1
if attacker.consecutive_kills == 12:
attacker.consecutive_kills = 0
attacker.grant_godmode(duration=45)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
beamRing(attacker.userid, 0, 350, 10, 45, 3, 2, r, g, b)
emitsound(attacker, 'buttons/blip2.wav', 1.0, 0.7)
SayText2(f"{attacker.name} has reached 12 kills and is in godmode now!").send()
def emitsound(userid, sound, volume, attenuation):
engine_sound.precache_sound(sound)
index = index_from_userid(userid)
engine_sound.emit_sound(RecipientFilter(), index, 0, sound, volume, attenuation)
def beamRing(userid, startRadius, endRadius, zplus, lifeTime, width, amplitude, r, g, b, a=255):
x,y,z = getPlayerLocation(userid)
tempEnt = TempEntity('BeamRingPoint')
tempEnt.red = r
tempEnt.green = g
tempEnt.blue = b
tempEnt.alpha = a
tempEnt.center = Vector(x, y, z + zplus)
tempEnt.start_radius = startRadius
tempEnt.end_radius = endRadius
tempEnt.life_time = lifeTime
tempEnt.start_width = width
tempEnt.end_width = width
tempEnt.amplitude = amplitude
tempEnt.halo_index = effect_model
tempEnt.model_index = effect_model
tempEnt.create()
def getPlayerLocation(userid):
x,y,z = Player.from_userid(userid).get_key_value_string('origin').split(' ')
return (float(x), float(y), float(z))
Re: Half-Life 2 Deathmatch - God mode
Posted: Thu Mar 17, 2022 8:36 pm
by daren adler
cssbestrpg wrote:Fixed in this:
Syntax: Select all
# ../killstreak_god/killstreak_god.py
# Python
import random
from time import time
# Source.Python
from engines.sound import engine_sound
from events import Event
from messages import SayText2
from players.entity import Player
from players.helpers import index_from_userid
from effects import TempEntity
from engines.precache import Model
from mathlib import Vector
from filters.recipients import RecipientFilter
effect_model = Model('sprites/greenglow1.vmt')
class StreakPlayer(Player):
caching = True # Uses caching
def __init__(self, index):
super().__init__(index)
self.consecutive_kills = 0
self.reset_delay = None
def grant_godmode(self, duration):
"""Gives godmode to the player for the specified duration."""
try:
# Let's see if there's a reset delay.
running = self.reset_delay.running
except AttributeError:
running = False
# Well, is there?
if running:
# Update the execution with the newer duration.
self.reset_delay.exec_time = time() + duration
# Nope.
else:
self.set_godmode(True)
self.reset_delay = self.delay(duration, self._reset_godmode)
def _reset_godmode(self):
self.set_godmode(False)
SayText2(f"{self.name} is no longer in godmode!").send()
@Event('player_death')
def player_death(ev):
victim = StreakPlayer.from_userid(ev['userid'])
victim.consecutive_kills = 0
# Try to get the attacker, or exit the call if not a valid player
try:
attacker = StreakPlayer.from_userid(ev['attacker'])
except ValueError:
return
attacker.consecutive_kills += 1
if attacker.consecutive_kills == 12:
attacker.consecutive_kills = 0
attacker.grant_godmode(duration=45)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
beamRing(attacker.userid, 0, 350, 10, 45, 3, 2, r, g, b)
emitsound(attacker, 'buttons/blip2.wav', 1.0, 0.7)
SayText2(f"{attacker.name} has reached 12 kills and is in godmode now!").send()
def emitsound(userid, sound, volume, attenuation):
engine_sound.precache_sound(sound)
index = index_from_userid(userid)
engine_sound.emit_sound(RecipientFilter(), index, 0, sound, volume, attenuation)
def beamRing(userid, startRadius, endRadius, zplus, lifeTime, width, amplitude, r, g, b, a=255):
x,y,z = getPlayerLocation(userid)
tempEnt = TempEntity('BeamRingPoint')
tempEnt.red = r
tempEnt.green = g
tempEnt.blue = b
tempEnt.alpha = a
tempEnt.center = Vector(x, y, z + zplus)
tempEnt.start_radius = startRadius
tempEnt.end_radius = endRadius
tempEnt.life_time = lifeTime
tempEnt.start_width = width
tempEnt.end_width = width
tempEnt.amplitude = amplitude
tempEnt.halo_index = effect_model
tempEnt.model_index = effect_model
tempEnt.create()
def getPlayerLocation(userid):
x,y,z = Player.from_userid(userid).get_key_value_string('origin').split(' ')
return (float(x), float(y), float(z))
sorry, not work,,i even went in third person mode and did not see it in either. also got 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 92, in fire_game_event
callback(game_event)
File "..\addons\source-python\plugins\killstreak_god\killstreak_god.py", line 68, in player_death
beamRing(attacker.userid, 0, 350, 10, 45, 3, 2, r, g, b)
File "..\addons\source-python\plugins\killstreak_god\killstreak_god.py", line 95, in beamRing
tempEnt.halo_index = effect_model
File "..\addons\source-python\packages\source-python\effects\base.py", line 307, in __setattr__
self._set_property(prop_name, prop.type, value)
File "..\addons\source-python\packages\source-python\effects\base.py", line 493, in _set_property
value, offset)
Boost.Python.ArgumentError: Python argument types in
Pointer.set_int(Pointer, Model, int)
did not match C++ signature:
set_int(class CPointer {lvalue}, int, int offset=0)
Re: Half-Life 2 Deathmatch - God mode
Posted: Thu Mar 17, 2022 8:38 pm
by daren adler
i see that some of the error says its also the effects py i am using,,,hmm, i will have to look at that.
Re: Half-Life 2 Deathmatch - God mode
Posted: Thu Mar 17, 2022 8:40 pm
by cssbestrpg
The issue is in my code, i will fix it later.
Re: Half-Life 2 Deathmatch - God mode
Posted: Thu Mar 17, 2022 8:46 pm
by daren adler
cssbestrpg wrote:The issue is in my code, i will fix it later.
ok, ty
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 18, 2022 6:20 am
by cssbestrpg
Hey i fixed the issue in this one:
Syntax: Select all
# ../killstreak_god/killstreak_god.py
# Python
import random
from time import time
# Source.Python
from engines.sound import engine_sound
from events import Event
from messages import SayText2
from players.entity import Player
from players.helpers import index_from_userid
from effects import TempEntity
from engines.precache import Model
from mathlib import Vector
from filters.recipients import RecipientFilter
class StreakPlayer(Player):
caching = True # Uses caching
def __init__(self, index):
super().__init__(index)
self.consecutive_kills = 0
self.reset_delay = None
def grant_godmode(self, duration):
"""Gives godmode to the player for the specified duration."""
try:
# Let's see if there's a reset delay.
running = self.reset_delay.running
except AttributeError:
running = False
# Well, is there?
if running:
# Update the execution with the newer duration.
self.reset_delay.exec_time = time() + duration
# Nope.
else:
self.set_godmode(True)
self.reset_delay = self.delay(duration, self._reset_godmode)
def _reset_godmode(self):
self.set_godmode(False)
SayText2(f"{self.name} is no longer in godmode!").send()
@Event('player_death')
def player_death(ev):
victim = StreakPlayer.from_userid(ev['userid'])
victim.consecutive_kills = 0
# Try to get the attacker, or exit the call if not a valid player
try:
attacker = StreakPlayer.from_userid(ev['attacker'])
except ValueError:
return
attacker.consecutive_kills += 1
if attacker.consecutive_kills == 12:
attacker.consecutive_kills = 0
attacker.grant_godmode(duration=45)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
beamRing(attacker.userid, 0, 350, 10, 45, 3, 2, r, g, b)
emitsound(attacker, 'buttons/blip2.wav', 1.0, 0.7)
SayText2(f"{attacker.name} has reached 12 kills and is in godmode now!").send()
def emitsound(userid, sound, volume, attenuation):
engine_sound.precache_sound(sound)
index = index_from_userid(userid)
engine_sound.emit_sound(RecipientFilter(), index, 0, sound, volume, attenuation)
def beamRing(userid, startRadius, endRadius, zplus, lifeTime, width, amplitude, r, g, b, a=255):
x,y,z = getPlayerLocation(userid)
tempEnt = TempEntity('BeamRingPoint')
my_model = Model('sprites/greenglow1.vmt')
tempEnt.model = my_model
tempEnt.halo = my_model
tempEnt.red = r
tempEnt.green = g
tempEnt.blue = b
tempEnt.alpha = a
tempEnt.center = Vector(x, y, z + zplus)
tempEnt.start_radius = startRadius
tempEnt.end_radius = endRadius
tempEnt.life_time = lifeTime
tempEnt.start_width = width
tempEnt.end_width = width
tempEnt.amplitude = amplitude
tempEnt.create()
def getPlayerLocation(userid):
x,y,z = Player.from_userid(userid).get_key_value_string('origin').split(' ')
return (float(x), float(y), float(z))
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 18, 2022 2:28 pm
by daren adler
cssbestrpg wrote:Hey i fixed the issue in this one:
Syntax: Select all
# ../killstreak_god/killstreak_god.py
# Python
import random
from time import time
# Source.Python
from engines.sound import engine_sound
from events import Event
from messages import SayText2
from players.entity import Player
from players.helpers import index_from_userid
from effects import TempEntity
from engines.precache import Model
from mathlib import Vector
from filters.recipients import RecipientFilter
class StreakPlayer(Player):
caching = True # Uses caching
def __init__(self, index):
super().__init__(index)
self.consecutive_kills = 0
self.reset_delay = None
def grant_godmode(self, duration):
"""Gives godmode to the player for the specified duration."""
try:
# Let's see if there's a reset delay.
running = self.reset_delay.running
except AttributeError:
running = False
# Well, is there?
if running:
# Update the execution with the newer duration.
self.reset_delay.exec_time = time() + duration
# Nope.
else:
self.set_godmode(True)
self.reset_delay = self.delay(duration, self._reset_godmode)
def _reset_godmode(self):
self.set_godmode(False)
SayText2(f"{self.name} is no longer in godmode!").send()
@Event('player_death')
def player_death(ev):
victim = StreakPlayer.from_userid(ev['userid'])
victim.consecutive_kills = 0
# Try to get the attacker, or exit the call if not a valid player
try:
attacker = StreakPlayer.from_userid(ev['attacker'])
except ValueError:
return
attacker.consecutive_kills += 1
if attacker.consecutive_kills == 12:
attacker.consecutive_kills = 0
attacker.grant_godmode(duration=45)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
beamRing(attacker.userid, 0, 350, 10, 45, 3, 2, r, g, b)
emitsound(attacker, 'buttons/blip2.wav', 1.0, 0.7)
SayText2(f"{attacker.name} has reached 12 kills and is in godmode now!").send()
def emitsound(userid, sound, volume, attenuation):
engine_sound.precache_sound(sound)
index = index_from_userid(userid)
engine_sound.emit_sound(RecipientFilter(), index, 0, sound, volume, attenuation)
def beamRing(userid, startRadius, endRadius, zplus, lifeTime, width, amplitude, r, g, b, a=255):
x,y,z = getPlayerLocation(userid)
tempEnt = TempEntity('BeamRingPoint')
my_model = Model('sprites/greenglow1.vmt')
tempEnt.model = my_model
tempEnt.halo = my_model
tempEnt.red = r
tempEnt.green = g
tempEnt.blue = b
tempEnt.alpha = a
tempEnt.center = Vector(x, y, z + zplus)
tempEnt.start_radius = startRadius
tempEnt.end_radius = endRadius
tempEnt.life_time = lifeTime
tempEnt.start_width = width
tempEnt.end_width = width
tempEnt.amplitude = amplitude
tempEnt.create()
def getPlayerLocation(userid):
x,y,z = Player.from_userid(userid).get_key_value_string('origin').split(' ')
return (float(x), float(y), float(z))
So sorry, but still no go.
Code: Select all
[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\packages\source-python\events\listener.py", line 92, in fire_game_event
callback(game_event)
File "..\addons\source-python\plugins\killstreak_god\killstreak_god.py", line 67, in player_death
emitsound(attacker, 'buttons/blip2.wav', 1.0, 0.7)
File "..\addons\source-python\plugins\killstreak_god\killstreak_god.py", line 72, in emitsound
index = index_from_userid(userid)
Boost.Python.ArgumentError: Python argument types in
_players._helpers.index_from_userid(StreakPlayer)
did not match C++ signature:
index_from_userid(unsigned int Userid)
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 18, 2022 3:10 pm
by cssbestrpg
Fixed in this one:
Syntax: Select all
# ../killstreak_god/killstreak_god.py
# Python
import random
from time import time
# Source.Python
from engines.sound import engine_sound
from events import Event
from messages import SayText2
from players.entity import Player
from players.helpers import index_from_userid
from effects import TempEntity
from engines.precache import Model
from mathlib import Vector
from filters.recipients import RecipientFilter
class StreakPlayer(Player):
caching = True # Uses caching
def __init__(self, index):
super().__init__(index)
self.consecutive_kills = 0
self.reset_delay = None
def grant_godmode(self, duration):
"""Gives godmode to the player for the specified duration."""
try:
# Let's see if there's a reset delay.
running = self.reset_delay.running
except AttributeError:
running = False
# Well, is there?
if running:
# Update the execution with the newer duration.
self.reset_delay.exec_time = time() + duration
# Nope.
else:
self.set_godmode(True)
self.reset_delay = self.delay(duration, self._reset_godmode)
def _reset_godmode(self):
self.set_godmode(False)
SayText2(f"{self.name} is no longer in godmode!").send()
@Event('player_death')
def player_death(ev):
victim = StreakPlayer.from_userid(ev['userid'])
victim.consecutive_kills = 0
# Try to get the attacker, or exit the call if not a valid player
try:
attacker = StreakPlayer.from_userid(ev['attacker'])
except ValueError:
return
attacker.consecutive_kills += 1
if attacker.consecutive_kills == 12:
attacker.consecutive_kills = 0
attacker.grant_godmode(duration=45)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
beamRing(attacker.userid, 0, 350, 10, 45, 3, 2, r, g, b)
emitsound(attacker.userid, 'buttons/blip2.wav', 1.0, 0.7)
SayText2(f"{attacker.name} has reached 12 kills and is in godmode now!").send()
def emitsound(userid, sound, volume, attenuation):
engine_sound.precache_sound(sound)
index = index_from_userid(userid)
engine_sound.emit_sound(RecipientFilter(), index, 0, sound, volume, attenuation)
def beamRing(userid, startRadius, endRadius, zplus, lifeTime, width, amplitude, r, g, b, a=255):
x,y,z = getPlayerLocation(userid)
tempEnt = TempEntity('BeamRingPoint')
my_model = Model('sprites/greenglow1.vmt')
tempEnt.model = my_model
tempEnt.halo = my_model
tempEnt.red = r
tempEnt.green = g
tempEnt.blue = b
tempEnt.alpha = a
tempEnt.center = Vector(x, y, z + zplus)
tempEnt.start_radius = startRadius
tempEnt.end_radius = endRadius
tempEnt.life_time = lifeTime
tempEnt.start_width = width
tempEnt.end_width = width
tempEnt.amplitude = amplitude
tempEnt.create()
def getPlayerLocation(userid):
x,y,z = Player.from_userid(userid).get_key_value_string('origin').split(' ')
return (float(x), float(y), float(z))
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 18, 2022 3:46 pm
by daren adler
cssbestrpg wrote:Fixed in this one:
Syntax: Select all
# ../killstreak_god/killstreak_god.py
# Python
import random
from time import time
# Source.Python
from engines.sound import engine_sound
from events import Event
from messages import SayText2
from players.entity import Player
from players.helpers import index_from_userid
from effects import TempEntity
from engines.precache import Model
from mathlib import Vector
from filters.recipients import RecipientFilter
class StreakPlayer(Player):
caching = True # Uses caching
def __init__(self, index):
super().__init__(index)
self.consecutive_kills = 0
self.reset_delay = None
def grant_godmode(self, duration):
"""Gives godmode to the player for the specified duration."""
try:
# Let's see if there's a reset delay.
running = self.reset_delay.running
except AttributeError:
running = False
# Well, is there?
if running:
# Update the execution with the newer duration.
self.reset_delay.exec_time = time() + duration
# Nope.
else:
self.set_godmode(True)
self.reset_delay = self.delay(duration, self._reset_godmode)
def _reset_godmode(self):
self.set_godmode(False)
SayText2(f"{self.name} is no longer in godmode!").send()
@Event('player_death')
def player_death(ev):
victim = StreakPlayer.from_userid(ev['userid'])
victim.consecutive_kills = 0
# Try to get the attacker, or exit the call if not a valid player
try:
attacker = StreakPlayer.from_userid(ev['attacker'])
except ValueError:
return
attacker.consecutive_kills += 1
if attacker.consecutive_kills == 12:
attacker.consecutive_kills = 0
attacker.grant_godmode(duration=45)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
beamRing(attacker.userid, 0, 350, 10, 45, 3, 2, r, g, b)
emitsound(attacker.userid, 'buttons/blip2.wav', 1.0, 0.7)
SayText2(f"{attacker.name} has reached 12 kills and is in godmode now!").send()
def emitsound(userid, sound, volume, attenuation):
engine_sound.precache_sound(sound)
index = index_from_userid(userid)
engine_sound.emit_sound(RecipientFilter(), index, 0, sound, volume, attenuation)
def beamRing(userid, startRadius, endRadius, zplus, lifeTime, width, amplitude, r, g, b, a=255):
x,y,z = getPlayerLocation(userid)
tempEnt = TempEntity('BeamRingPoint')
my_model = Model('sprites/greenglow1.vmt')
tempEnt.model = my_model
tempEnt.halo = my_model
tempEnt.red = r
tempEnt.green = g
tempEnt.blue = b
tempEnt.alpha = a
tempEnt.center = Vector(x, y, z + zplus)
tempEnt.start_radius = startRadius
tempEnt.end_radius = endRadius
tempEnt.life_time = lifeTime
tempEnt.start_width = width
tempEnt.end_width = width
tempEnt.amplitude = amplitude
tempEnt.create()
def getPlayerLocation(userid):
x,y,z = Player.from_userid(userid).get_key_value_string('origin').split(' ')
return (float(x), float(y), float(z))
No errors, but it does this
https://steamcommunity.com/sharedfiles/filedetails/?id=2780849776 . i killed 12 and it did what the picture shows. and when i walked away from that spot, it stayed there.
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 18, 2022 3:53 pm
by cssbestrpg
Because the beam origin was at that spot when you killed 12. The beam origin only stays that area it spawned.
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 18, 2022 4:11 pm
by daren adler
cssbestrpg wrote:Because the beam origin was at that spot when you killed 12. The beam origin only stays that area it spawned.
O ok, i thought the beacon(beam) would stay around the player.
The old one i used years ago from eventscripts looked somthing like this
https://steamcommunity.com/sharedfiles/filedetails/?id=1095795444 . The world view would just see the beams going around the player with godmode.
Re: Half-Life 2 Deathmatch - God mode
Posted: Tue Mar 22, 2022 4:44 pm
by Painkiller
I think you need to play around with this.
Syntax: Select all
beamRing(attacker.userid, 0, 350, 10, 45, 3, 2, r, g, b)
Re: Half-Life 2 Deathmatch - God mode
Posted: Tue Mar 22, 2022 5:28 pm
by cssbestrpg
Painkiller wrote:I think you need to play around with this.
Syntax: Select all
beamRing(attacker.userid, 0, 350, 10, 45, 3, 2, r, g, b)
No, the beam would have to make global it and then change the origin to your current place with repeat
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 25, 2022 3:29 pm
by daren adler
What about using a trail like this
https://forums.alliedmods.net/showthread.php?p=2565403 but it only comes on when in godmode.
just a thought. hope we can get this working,,your does work, but like you said it only shows where you went godmode at.
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 25, 2022 5:31 pm
by Kami
Warcraft Source by Tha Pwned has a ring level up effect done with a smokestack, that is parented by the player so it follows you around.
You can find it here:
https://github.com/ThaPwned/WCS/blob/b3 ... 1275-L1304
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 25, 2022 6:49 pm
by daren adler
That would be great if i figer it out....thank you for info...maybe you could try please.
Re: Half-Life 2 Deathmatch - God mode
Posted: Fri Mar 25, 2022 8:11 pm
by cssbestrpg
Kami thanks for the effect link. I later try that way to make the effect(once have time for it)
Re: Half-Life 2 Deathmatch - God mode
Posted: Sat Mar 26, 2022 1:57 pm
by Kami
I played around with the smokestack a bit and it seems you have to make the speed really fast for the ring to stay perfectly around the player. Might be a bit distracting.
I made one that looks like a forcefield around the player:
Syntax: Select all
from events import Event
from filters.players import PlayerIter
from players.entity import Player
from entities.entity import Entity
from entities.constants import RenderMode
from mathlib import QAngle
from mathlib import Vector
from engines.precache import Model
from colors import Color
_effect_angle = QAngle(0, 0, 0)
_rank_effect_color = Color(252, 200, 90)
_level_effect_color = Color(252, 200, 90)
_yellowflare_model = Model('effects/yellowflare.vmt', True)
@Event('player_say')
def on_player_say(event):
player = Player.from_userid(event['userid'])
origin = Vector(*player.origin)
#origin.z += 10
entity = Entity.create('env_smokestack')
entity.origin = origin
entity.base_spread = 24
entity.spread_speed = 5
entity.initial_state = 0
entity.speed = 2500
entity.start_size = 3
entity.end_size = 4
entity.rate = 5000
entity.jet_length = 90
entity.render_color = _rank_effect_color
entity.render_mode = RenderMode.NONE
entity.render_amt = 200
entity.smoke_material = _yellowflare_model.path
entity.angles = _effect_angle
entity.twist = 0
entity.spawn()
entity.set_parent(player,7)
entity.add_output('OnUser1 !self,TurnOff,,45,1')
entity.add_output('OnUser1 !self,Kill,,45.5,1')
entity.call_input('TurnOn')
entity.call_input('FireUser1', '1')
And one that looks more like flames coming from the ground but does not follow you perfectly:
Syntax: Select all
from events import Event
from filters.players import PlayerIter
from players.entity import Player
from entities.entity import Entity
from entities.constants import RenderMode
from mathlib import QAngle
from mathlib import Vector
from engines.precache import Model
from colors import Color
_effect_angle = QAngle(0, 0, 0)
_rank_effect_color = Color(252, 20, 20)
_level_effect_color = Color(252, 20, 20)
_yellowflare_model = Model('effects/yellowflare.vmt', True)
@Event('player_say')
def on_player_say(event):
player = Player.from_userid(event['userid'])
origin = Vector(*player.origin)
#origin.z += 10
entity = Entity.create('env_smokestack')
entity.origin = origin
entity.base_spread = 24
entity.spread_speed = 5
entity.initial_state = 0
entity.speed = 68
entity.start_size = 3
entity.end_size = 4
entity.rate = 1000
entity.jet_length = 75
entity.render_color = _rank_effect_color
entity.render_mode = RenderMode.NONE
entity.render_amt = 200
entity.smoke_material = _yellowflare_model.path
entity.angles = _effect_angle
entity.twist = 0
entity.spawn()
entity.set_parent(player,7)
entity.add_output('OnUser1 !self,TurnOff,,45,1')
entity.add_output('OnUser1 !self,Kill,,45.5,1')
entity.call_input('TurnOn')
entity.call_input('FireUser1', '1')
You can just load the code and it will be triggered by writing something in the chat, so you can have a look yourself :)
I'm not 100% sure that yellowflare is a model hl2dm has so maybe you might have to change that.
Re: Half-Life 2 Deathmatch - God mode
Posted: Wed Apr 06, 2022 4:13 pm
by daren adler
cssbestrpg wrote:Try this one(untested):
Syntax: Select all
# ../killstreak_god/killstreak_god.py
# Python
import random
from time import time
# Source.Python
from engines.sound import engine_sound
from events import Event
from messages import SayText2
from players.entity import Player
from players.helpers import index_from_userid
from effects import TempEntity
from engines.precache import Model
from mathlib import Vector
from filters.recipients import RecipientFilter
effect_model = Model('sprites/greenglow1.vmt')
class StreakPlayer(Player):
caching = True # Uses caching
def __init__(self, index):
super().__init__(index)
self.consecutive_kills = 0
self.reset_delay = None
def grant_godmode(self, duration):
"""Gives godmode to the player for the specified duration."""
try:
# Let's see if there's a reset delay.
running = self.reset_delay.running
except AttributeError:
running = False
# Well, is there?
if running:
# Update the execution with the newer duration.
self.reset_delay.exec_time = time() + duration
# Nope.
else:
self.set_godmode(True)
self.reset_delay = self.delay(duration, self._reset_godmode)
def _reset_godmode(self):
self.set_godmode(False)
SayText2(f"{self.name} is no longer in godmode!").send()
@Event('player_death')
def player_death(ev):
victim = StreakPlayer.from_userid(ev['userid'])
victim.consecutive_kills = 0
# Try to get the attacker, or exit the call if not a valid player
try:
attacker = StreakPlayer.from_userid(ev['attacker'])
except ValueError:
return
attacker.consecutive_kills += 1
if attacker.consecutive_kills == 12:
attacker.consecutive_kills = 0
attacker.grant_godmode(duration=45)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
beamRing(attacker, 0, 350, 10, 45, 3, 2, r, g, b)
emitsound(attacker, 'buttons/blip2.wav', 1.0, 0.7)
SayText2(f"{attacker.name} has reached 12 kills and is in godmode now!").send()
def emitsound(userid, sound, volume, attenuation):
engine_sound.precache_sound(sound)
index = index_from_userid(userid)
engine_sound.emit_sound(RecipientFilter(), index, 0, sound, volume, attenuation)
def beamRing(userid, startRadius, endRadius, zplus, lifeTime, width, amplitude, r, g, b, a=255):
x,y,z = getPlayerLocation(userid)
tempEnt = TempEntity('BeamRingPoint')
tempEnt.red = r
tempEnt.green = g
tempEnt.blue = b
tempEnt.alpha = a
tempEnt.center = Vector(x, y, z + zplus)
tempEnt.start_radius = startRadius
tempEnt.end_radius = endRadius
tempEnt.life_time = lifeTime
tempEnt.start_width = width
tempEnt.end_width = width
tempEnt.amplitude = amplitude
tempEnt.halo_index = effect_model
tempEnt.model_index = effect_model
tempEnt.create()
def getPlayerLocation(userid):
x,y,z = Player.from_userid(userid).get_key_value_string('origin').split(' ')
return (float(x), float(y), float(z))
If noone can do this, could we just make it easer and just have it so when in godmode you are green then back to normal after godmode stops?