Syntax: Select all
from entities.entity import Entity
from engines.precache import Generic as PrecacheGeneric
from events import Event
from mathlib import Vector
from stringtables.downloads import Downloadables
PARTICLE_FILE = "particles/my_particle_systems.pcf"
my_downloads = Downloadables()
my_downloads.add(PARTICLE_FILE)
PrecacheGeneric(PARTICLE_FILE)
@Event('bullet_impact')
def on_bullet_impact(game_event):
x, y, z = game_event.get_float('x'), game_event.get_float('y'), game_event.get_float('z')
entity = Entity.create('info_particle_system')
entity.set_key_value_bool('start_active', True)
entity.set_key_value_string('effect_name', "my_particle_system")
entity.spawn()
entity.teleport(Vector(x, y, z), None, None)
entity.activate()
Built-in particle systems work fine.