def square(recipients, start, end, **kwargs): """Create a square using the temporary effect ``BeamPoints``. :param RecipientFilter recipients: Players that should see the beam. :param Vector start: Upper left corner of the square. :param Vector end: Lower right corner of the square. :param kwargs: Additional attributes that will be send to the effect. """ x1, y1, z1 = start x2, y2, z2 = end a = start b = Vector(x2, y2, z1) c = Vector(x1, y1, z2) d = end lines = ( (a, b), (b, d), (d, c), (c, a), ) for p1, p2 in lines: entity = TempEntity('BeamPoints') entity.start_point = p1 entity.end_point = p2 for attr, value in kwargs.items(): setattr(entity, attr, value) entity.create(recipients)
class ExplosionSkill(Skill): _msg_a = '{{RED}}Exploded {{PALE_GREEN}}damaging {{RED}}{name}{{PALE_GREEN}}!' def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.explosion = TempEntity('Explosion', magnitude=100, scale=40, radius=self.range) @property def range(self): return 300 + 25 * self.level @property def magnitude(self): return 50 + 5 * self.level @events('player_death') def player_death(self, player, **eargs): if self.level == 0: return team = ['ct', 't'][player.team - 2] for target in PlayerIter(is_filters=team): if player.origin.get_distance(target.origin) <= self.range: target.take_damage(self.magnitude, attacker_index=player.index, skip_hooks=True) send_wcs_saytext_by_index(self._msg_a.format(name=target.name), player.index) self.explosion.create(origin=player.origin)
def listener_on_entity_spawned(self, base_entity): if base_entity.classname != 'flashbang_projectile': return index = base_entity.index entity = Entity(index) for player in self._players: if player.inthandle == entity.owner_handle: break else: return temp_entity = TempEntity('BeamFollow') temp_entity.entity_index = index temp_entity.model_index = BEAM_MODEL.index temp_entity.halo_index = BEAM_MODEL.index temp_entity.life_time = 1 temp_entity.start_width = 3 temp_entity.end_width = 3 temp_entity.fade_length = 1 temp_entity.red = 255 temp_entity.green = 255 temp_entity.blue = 255 temp_entity.alpha = 150 temp_entity.create(RecipientFilter())
def listener_on_entity_spawned(self, index, base_entity): if base_entity.classname != 'flashbang_projectile': return entity = Entity(index) if entity.owner_handle not in (self.prisoner.inthandle, self.guard.inthandle): return temp_entity = TempEntity('BeamFollow') temp_entity.entity_index = index temp_entity.model_index = BEAM_MODEL.index temp_entity.halo_index = BEAM_MODEL.index temp_entity.life_time = 1 temp_entity.start_width = 3 temp_entity.end_width = 3 temp_entity.fade_length = 1 temp_entity.red = 255 temp_entity.green = 255 temp_entity.blue = 255 temp_entity.alpha = 150 temp_entity.create(RecipientFilter())
def _on_player_pre_attack(self, attacker, victim, **kwargs): if randint( 1, 100) < 10 + self.level and not victim.stuck and self.level > 0: victim.base_velocity = Vector(0, 0, 400) victim.delay(0.8, victim.__setattr__, args=('stuck', True)) victim.delay(1.8, victim.__setattr__, args=('stuck', False)) bottom_vector = victim.origin top_vector = victim.origin top_vector.z += 100 _effect = TempEntity('BeamPoints', alpha=255, red=100, blue=255, green=100, amplitude=10, end_width=20, start_width=20, life_time=2, fade_length=2, halo_index=self._model.index, model_index=self._model.index, start_point=top_vector, end_point=bottom_vector) _effect.create() stun_sound.index = victim.index stun_sound.origin = victim.origin stun_sound.play()
def est_effect_02(command): if len(command) == 19: #est_Effect_02 <player Filter> <delay> <model> <start ent> <start position "X Y Z"> <end ent> <end position "X Y Z"> <framerate> <life> <start width> <end width> <fade distance> <amplitude> <R> <G> <B> <A> <speed> str_vec = command[5] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) str_vec = command[7] str_vec = str_vec.split(",") vec2 = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('BeamEntPoint', start_entity_index=int(command[4]), start_point=Vector(float(command[5])), end_entity_index=int(command[6]), end_point=vec2, model_index=Model(str(command[3])).index, halo_index=Model(str(command[3])).index, frame_rate=int(command[8]), life_time=float(command[9]), start_width=int(command[10]), end_width=int(command[11]), fade_length=int(command[12]), amplitude=int(command[13]), red=int(command[14]), green=int(command[15]), blue=int(command[16]), alpha=int(command[17]), speed=int(command[18])) te.create(delay=float(command[2]))
def _on_player_attack(self, attacker, victim, **kwargs): if randint(0, 101) < self.chance: for index in attacker.weapon_indexes(): break v1 = attacker.origin damaged = False for target in player_dict.values(): if target.index == victim.index or target.team == attacker.team or target.dead: continue v2 = target.origin if v1.get_distance(v2) < self.range: ricochet = TempEntity('Armor Ricochet', position=victim.origin) ricochet.create() target.take_damage(self.damage, attacker_index=attacker.index, weapon_index=index, skip_hooks=True) damaged = True if damaged: send_wcs_saytext_by_index(self._msg_a, attacker.index)
def ball(recipients, center, radius, steps=15, upper_half=True, lower_half=True, **kwargs): """Create a ball by using the remporary effect ``BeamRingPoint``. :param RecipientFilter recipients: Players that should see the beam. :param Vector center: The center location of the ball. :param float radius: The radius of the ball. :param int steps: Number of rings that should be used to create the ball. :param bool upper_half: If False, the upper half of the ball isn't created. :param bool lower_half: If False, the lower half of the ball isn't created. .. note:: The number of steps is used for the lower and upper half. So, if you define 15 steps, 29 rings are created (the center ring is shared by both halves). """ # Make sure that at least one argument is True assert not (upper_half == lower_half == False) step = float(radius) / steps for x in range(steps): dist = step * x org = Vector(*center) org.z += dist rad = 2 * radius * (1 - (float(x) / steps)**2)**0.5 if upper_half: entity = TempEntity('BeamRingPoint') entity.center = org entity.start_radius = rad entity.end_radius = rad - 0.1 for attr, value in kwargs.items(): setattr(entity, attr, value) entity.create(recipients) if x and lower_half: org.z -= 2 * dist entity = TempEntity('BeamRingPoint') entity.center = org entity.start_radius = rad entity.end_radius = rad - 0.1 for attr, value in kwargs.items(): setattr(entity, attr, value) entity.create(recipients)
class LifestealSkill(Skill): _msg_a = '{{PALE_GREEN}}Healed {{GREEN}}{heal} {{PALE_GREEN}}HP by {{DULL_RED}}stealing {{PALE_GREEN}}life from {{RED}}{name}.' laser = Model("sprites/lgtning.vmt", True) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.max_health = self.parent.parent.health + 100 self.beam = TempEntity('BeamPoints', alpha=255, red=255, green=0, blue=0, life_time=1.0, model_index=self.laser.index, start_width=7, end_width=7, frame_rate=255, halo_index=self.laser.index) @property def chance(self): return self.level * 8 @property def leech_multiplier(self): return 0.6 @events('player_spawn') def _on_player_spawn(self, player, **kwargs): self.max_health = player.health + 100 @events('player_pre_attack') def _on_player_pre_attack(self, attacker, victim, info, **kwargs): if self.level == 0: return heal = int(info.damage * self.leech_multiplier) can_heal = self.max_health > attacker.health + heal if self.chance > randint(0, 100) or not can_heal: return attacker.health += heal send_wcs_saytext_by_index( self._msg_a.format(heal=heal, name=victim.name), attacker.index) weapon = attacker.active_weapon if weapon and weapon.weapon_name.split( "_")[-1] not in weapon_manager.projectiles: start_location = weapon.origin.copy() start_location.z += 40 end_location = attacker.get_view_coordinates() self.beam.create(start_point=start_location, end_point=end_location)
class BlowUpBaby(Item): category = "Offensive" cost = 5000 description = "Explode when die." _msg_purchase = '{GREEN}Purchased {DULL_RED}Blow Up Baby.' def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.explosion = TempEntity('Explosion', magnitude=100, scale=40, radius=self.range) @classmethod def is_available(cls, player): item_count = sum(isinstance(item, cls) for item in player.items) return player.cash >= cls.cost and not player.dead and item_count < 1 @classproperty def requirement_string(cls): return "${}".format(cls.cost) @classproperty def requirement_sort_key(cls): return cls.cost def on_purchase(self, player): super().on_purchase(player) player.cash -= self.cost send_wcs_saytext_by_index(self._msg_purchase, player.index) @property def range(self): return 200 @property def magnitude(self): return 35 @events('player_death', 'player_suicide') def player_death(self, player, **kwargs): for target in player_dict.values(): if player.origin.get_distance( target.origin ) <= self.range and target.team != player.team: target.take_damage(self.magnitude, attacker_index=player.index, skip_hooks=True) send_wcs_saytext_by_index(self._msg_a.format(name=target.name), player.index) self.explosion.create(origin=player.origin) ## remove the item player.items.remove(self)
def _on_player_pre_victim(self, attacker, victim, info, **eargs): if self.level == 0: return if victim.ground_entity == -1: info.damage *= 1 - 0.06 * self.level send_wcs_saytext_by_index(self._msg_a.format(name=attacker.name), victim.index) ricochet = TempEntity('Armor Ricochet', position=victim.origin) ricochet.create()
def est_effect_09(command): #est_Effect_09 - Beam Spline Effect est_Effect_09 <player Filter> <delay> <model> <points> <rgPoints "X Y Z"> if len(command) == 6: str_vec = command[5] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('BeamSpline', points_length=int(command[4]), points=vec) te.create(delay=float(command[2]))
def est_effect_24(command): if len(command) == 6: str_vec = command[4] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) #est_Effect_24 - Large Funnel Effect est_Effect_24 <player Filter> <delay> <model> <Position "X Y Z"> <reversed> te = TempEntity('Large Funnel', model_index=Model(str(command[3])).index, origin=vec, reversed=int(command[5])) te.create(delay=float(command[2]))
def beam(recipients, start, end, parent=False, **kwargs): """A simple wrapper for the temporary effect ``BeamEntPoint``. :param RecipientFilter recipients: Players that should see the beam. :param int/BaseEntity/Vector start: The start location of the beam. :param int/BaseEntity/Vector end: The end location of the beam. :param bool parent: If True, the beam will be parented to the given entities. :param kwargs: Additional attributes that will be send to the effect. """ _entity = kwargs.pop('_entity', None) if _entity is None: entity = TempEntity('BeamEntPoint') for attr, value in kwargs.items(): setattr(entity, attr, value) else: entity = _entity def get_vec(value): if isinstance(value, int): return Entity(value).origin elif isinstance(value, BaseEntity): return Entity(value.index).origin else: return value if parent: if isinstance(start, int): entity.start_entity_index = start elif isinstance(start, BaseEntity): entity.start_entity_index = start.index else: entity.start_point = start else: entity.start_point = get_vec(start) if parent: if isinstance(end, int): entity.end_entity_index = end elif isinstance(end, BaseEntity): entity.end_entity_index = end.index else: entity.end_point = end else: entity.end_point = get_vec(end) for attr, value in kwargs.items(): setattr(entity, attr, value) entity.create(recipients)
class EarthgrabTotem(Skill): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.model = Model('sprites/blueflare1.vmt', True) self.model._precache() self.effect = TempEntity('BeamRingPoint', start_radius=120, end_radius=0, model_index=self.model.index, halo_index=self.model.index, life_time=1.5, amplitude=10, red=10, green=255, blue=10, alpha=245, flags=0, start_width=6, end_width=6) if not root_sound.is_precached: root_sound.precache() @classproperty def description(cls): return 'Root your enemies to the ground, 16-24% chance.' @classproperty def max_level(cls): return 8 _msg_a = '{{GREEN}}Rooted {{RED}}{name} {{PALE_GREEN}}to the ground.' _msg_b = '{{PALE_GREEN}}You have been {{GREEN}}rooted {{PALE_GREEN}}to the ground by {{RED}}{name}.' @events('player_pre_attack') def _on_player_pre_attack(self, attacker, victim, **kwargs): if self.level == 0: return if randint(1, 100) <= 16 + self.level and not victim.stuck: victim.stuck = True victim.delay(1.5, victim.__setattr__, args=('stuck', False)) send_wcs_saytext_by_index(self._msg_a.format(name=victim.name), attacker.index) send_wcs_saytext_by_index(self._msg_b.format(name=attacker.name), victim.index) root_sound.index = victim.index root_sound.origin = victim.origin root_sound.play() self.effect.create(center=victim.origin) self.effect.create(center=victim.origin, start_radius=80)
def box(recipients, start, end, **kwargs): """Create a box using the temporary effect ``BeamPoints``. :param RecipientFilter recipients: Players that should see the beam. :param Vector start: Upper left corner of the box. :param Vector end: Lower right corner of the box. :param kwargs: Additional attributes that will be send to the effect. """ x1, y1, z1 = start x2, y2, z2 = end a = start b = Vector(x2, y1, z1) c = Vector(x2, y1, z2) d = Vector(x1, y1, z2) e = Vector(x1, y2, z1) f = Vector(x2, y2, z1) h = Vector(x1, y2, z2) g = end lines = ( # First square (a, b), (b, c), (c, d), (d, a), # Second square (e, f), (f, g), (g, h), (h, e), # Connection between both squares (a, e), (b, f), (c, g), (d, h) ) entity = TempEntity('BeamPoints') for attr, value in kwargs.items(): setattr(entity, attr, value) for p1, p2 in lines: entity.start_point = p1 entity.end_point = p2 entity.create(recipients)
def est_effect_15(command): if len(command) == 9: #est_Effect_15 - Bubble Trail Effect est_Effect_15 <player Filter> <delay> <model> <Min "X Y Z"> <Max "X Y Z"> <heigth> <count> <speed> te = TempEntity('Bubble Trail', model_index=Model(str(command[3])).index, halo_index=Model(str(command[3])).index, mins=vec, maxs=vec2, height=int(command[6]), count=int(command[7]), speed=int(command[8])) te.create(delay=float(command[2]))
def bullet_impact(event): """Called whenever a bullet hits something.""" entity = TempEntity('World Decal') # Create the decal at the impact location entity.origin = Vector(*tuple(event.get_float(key) for key in 'xyz')) # Choose a random paintball material and precache it. It will return an # index. entity.decal_index = engine_server.precache_decal(random.choice(materials)) entity.create()
def box(recipients, start, end, **kwargs): """Create a box using the temporary effect ``BeamPoints``. :param RecipientFilter recipients: Players that should see the beam. :param Vector start: Upper left corner of the box. :param Vector end: Lower right corner of the box. :param kwargs: Additional attributes that will be send to the effect. """ x1, y1, z1 = start x2, y2, z2 = end a = start b = Vector(x2, y1, z1) c = Vector(x2, y1, z2) d = Vector(x1, y1, z2) e = Vector(x1, y2, z1) f = Vector(x2, y2, z1) h = Vector(x1, y2, z2) g = end lines = ( # First square (a, b), (b, c), (c, d), (d, a), # Second square (e, f), (f, g), (g, h), (h, e), # Connection between both squares (a, e), (b, f), (c, g), (d, h)) entity = TempEntity('BeamPoints') for attr, value in kwargs.items(): setattr(entity, attr, value) for p1, p2 in lines: entity.start_point = p1 entity.end_point = p2 entity.create(recipients)
def ball(recipients, center, radius, steps=15, upper_half=True, lower_half=True, **kwargs): """Create a ball by using the remporary effect ``BeamRingPoint``. :param RecipientFilter recipients: Players that should see the beam. :param Vector center: The center location of the ball. :param float radius: The radius of the ball. :param int steps: Number of rings that should be used to create the ball. :param bool upper_half: If False, the upper half of the ball isn't created. :param bool lower_half: If False, the lower half of the ball isn't created. .. note:: The number of steps is used for the lower and upper half. So, if you define 15 steps, 29 rings are created (the center ring is shared by both halves). """ # Make sure that at least one argument is True assert not (upper_half == lower_half == False) step = float(radius) / steps for x in range(steps): dist = step * x org = Vector(*center) org.z += dist rad = 2 * radius * (1 - (float(x) / steps) ** 2) ** 0.5 if upper_half: entity = TempEntity('BeamRingPoint') entity.center = org entity.start_radius = rad entity.end_radius = rad - 0.1 for attr, value in kwargs.items(): setattr(entity, attr, value) entity.create(recipients) if x and lower_half: org.z -= 2 * dist entity = TempEntity('BeamRingPoint') entity.center = org entity.start_radius = rad entity.end_radius = rad - 0.1 for attr, value in kwargs.items(): setattr(entity, attr, value) entity.create(recipients)
def _create_beam(start, end, color): """Create the beam from the player/weapon's origin to the victim's.""" width = int(beam_width) entity = TempEntity('BeamPoints') entity.start_point = start entity.start_width = width entity.end_point = end entity.end_width = width entity.color = color entity.life_time = int(beam_time) entity.model = _model entity.halo = _model entity.create()
class AthenaSpear(Skill): model = Model("sprites/lgtning.vmt") def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.model._precache() self.effect = TempEntity('BeamRingPoint', model=self.model, start_radius=20, end_radius=500, life_time=3, start_width=100, end_width=100, spread=10, amplitude=0, red=255, green=105, blue=155, alpha=255, speed=50) @classproperty def description(cls): return 'Spear your enemy for 5-13 extra damage. 2-10% chance.' @classproperty def max_level(cls): return 4 @property def chance(self): return 2 + (self.level * 2) @property def extra_damage(self): return 5 + (self.level * 2) _msg_a = '{{LIGHT_BLUE}}Athena\'s Spear {{PALE_GREEN}}dealt {{DULL_RED}}{damage} {{PALE_GREEN}}extra to {{RED}}{name}{{PALE_GREEN}}.' @events('player_pre_attack') def _on_player_pre_attack(self, attacker, victim, info, **kwargs): if victim.dead or randint(0, 101) > self.chance or self.level == 0: return damage = randint(5, self.extra_damage) info.damage += damage send_wcs_saytext_by_index( self._msg_a.format(damage=damage, name=victim.name), attacker.index) self.effect.create(center=victim.origin)
def give_trail(ent, team): if team == 2: color = Color(255, 0, 0) if team == 3: color = Color(0, 0, 255) entity = TempEntity('BeamFollow') entity.start_width = 3 entity.end_width = 3 entity.color = color entity.model = beam_model entity.halo = beam_model entity.entity_index = ent.index entity.life_time = 2 entity.create()
def est_effect_04(command): #est_Effect_04 <player Filter> <delay> <model> <Follow ent> <life> <start width> <end width> <fade distance> <R> <G> <B> <A> te = TempEntity('BeamFollow') te.alpha = int(command[12]) te.blue = int(command[11]) te.green = int(command[10]) te.end_width = int(command[7]) te.life_time = float(command[5]) te.start_width = int(command[6]) te.entity_index = Player.from_userid(int(command[4])).index te.fade_length = int(command[8]) te.halo_index = Model(str(command[3])).index te.model_index = Model(str(command[3])).index te.red = int(command[9]) te.create(delay=float(command[2]))
def est_effect_18(command): if len(command) == 11: str_vec = command[3] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) #est_Effect_18 - Dynamic Light Effect est_Effect_18 <player Filter> <delay> <Position "X Y Z"> <R> <G> <B> <exponent> <radius> <time> <decay> te = TempEntity('Dynamic Light', origin=vec, red=int(command[4]), green=int(command[5]), blue=int(command[6]), exponent=int(command[7]), radius=int(command[8]), life_time=float(command[9]), decay=float(command[10])) te.create(delay=float(command[2]))
def est_effect_01(command): #est_Effect_01 <player Filter> <delay> <model> <position "X Y Z"> <direction "X Y if len(command) == 10: te = TempEntity('Armor Ricochet', direction=Vector(float(command[7]), float(command[8]), float(command[9])), position=Vector(float(command[4]), float(command[5]), float(command[6]))) te.create(delay=float(command[2])) elif len(command) == 6: str_vec = command[4] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) str_vec = command[5] str_vec = str_vec.split(",") vec2 = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('Armor Ricochet', direction=vec2, position=vec) te.create(delay=float(command[2]))
def est_effect_11(command): #est_Effect_11 <player Filter> <delay> <model> <origin "X Y Z"> <direction "X Y Z"> <R> <G> <B> <A> <Amount> if len(command) == 11: str_vec = command[4] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) str_vec = command[5] str_vec = str_vec.split(",") vec2 = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('Blood Stream', origin=vec, direction=vec2, red=int(command[6]), green=int(command[7]), blue=int(command[8]), alpha=int(command[9]), amount=int(comman[10])) te.create(delay=float(command[2]))
def est_effect_14(command): #est_Effect_14 - Bubbles Effectest_Effect_14 <player Filter> <delay> <model> <Min "X Y Z"> <Max "X Y Z"> <heigth> <count> <speed> if len(command) == 9: str_vec = command[4] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) str_vec = command[5] str_vec = str_vec.split(",") vec2 = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('Bubbles', model_index=Model(str(command[3])).index, halo_index=Model(str(command[3])).index, mins=vec, maxs=vec2, height=int(command[6]), count=int(command[7]), speed=int(command[8])) te.create(delay=float(command[2]))
def est_effect_07(command): #est_Effect_07 <player Filter> <delay> <model> <start ent> <end ent> <framerate> <life> <width> <spread> <amplitude> <R> <G> <B> <A> <speed> if len(command) == 16: te = TempEntity('BeamRing', model_index=Model(str(command[3])).index, halo_index=Model(str(command[3])).index, start_entity_index=int(command[4]), end_entity_index=int(command[5]), frame_rate=int(command[6]), life_time=float(command[7]), start_width=int(command[8]), end_width=int(command[8]), amplitude=int(command[10]), red=int(command[11]), green=int(command[12]), blue=int(command[13]), alpha=int(command[14]), speed=int(command[15])) te.create(delay=float(command[2]))
def est_effect_03(command): #est_Effect_03 <player Filter> <delay> <model> <start ent> <end ent> <framerate><life> <start width> <end width> <fade distance> <amplitude> <R> <G> <B> <A> <speed> if len(command) == 16: te = TempEntity('BeamEnts', model_index=Model(str(command[3])), halo_index=Model(str(command[3])), start_entity_index=int(command[4]), end_entity_index=int(command[5]), frame_rate=int(command[6]), start_width=int(command[7]), end_with=int(command[8]), fade_length=int(command[9]), amplitude=int(command[10]), red=int(command[11]), green=int(command[12]), blue=int(command[13]), alpha=int(command[14]), speed=int(command[15])) te.create(delay=float(command[2]))
def est_effect_10(command): #est_Effect_10 <player Filter> <delay> <model> <origin "X Y Z"> <direction "X Y Z"> <R> <G> <B> <A> <Size> if len(command) == 11: str_vec = command[4] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) str_vec = command[5] str_vec = str_vec.split(",") vec2 = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('Blood Sprite', drop_model_index=Model(str(command[3])).index, spray_model_index=Model(str(command[3])).index, origin=vec, direction=vec2, red=int(command[6]), green=int(command[7]), blue=int(command[8]), alpha=int(command[9]), size=float(command[10])) te.create(delay=float(command[2]))
class ElectricShock(Skill): model = Model("sprites/physring1.vmt") def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.model._precache() self.effect = TempEntity('GlowSprite', model=self.model, life_time=0.5, scale=1.3, brightness=255) @classproperty def description(cls): return 'Electricute your enemy for 2-7 extra damage. 25% chance.' @classproperty def max_level(cls): return 5 @property def extra_damage(self): return 2 + self.level _msg_a = '{{LIGHT_BLUE}}Electric Shock {{PALE_GREEN}}dealt {{DULL_RED}}{damage} {{PALE_GREEN}}extra to {{RED}}{name}{{PALE_GREEN}}.' @events('player_pre_attack') def _on_player_pre_attack(self, attacker, victim, info, **kwargs): if victim.dead or randint(0, 101) > 25 or self.level == 0: return electric_sound.index = victim.index electric_sound.origin = victim.origin electric_sound.play() Delay(0.5, electric_sound.stop) damage = randint(2, self.extra_damage) info.damage += damage send_wcs_saytext_by_index(self._msg_a.format(damage=damage, name=victim.name), attacker.index) self.effect.create(origin=victim.origin)
def est_effect_08(command): #est_Effect_08 - Beam Ring Ent Effect est_Effect_08 <player Filter> <delay> <model> <center "X Y Z"> <Start Radius> <End Radius> <framerate> <life> <width> <spread> <amplitude> <R> <G> <B> <A> <speed> <flags> if len(command) == 17: str_vec = command[4] str_vec = str_vec.split(",") vec = Vector(float(str_vec[0]), float(str_vec[1]), float(str_vec[2])) te = TempEntity('BeamRingPoint', model_index=Model(str(command[3])).index, halo_index=Model(str(command[3])).index, center=vec, start_radius=float(command[5]), end_radius=float(command[6]), frame_rate=int(command[7]), life_time=float(command[8]), start_width=int(command[9]), end_width=int(command[9]), amplitude=int(command[11]), red=int(command[12]), green=int(command[13]), blue=int(command[14]), alpha=int(command[15]), speed=int(command[16])) te.create(delay=float(command[2]))