Page 1 of 1

Particle System

Posted: Thu Apr 12, 2018 12:48 pm
by canibozz
Hello,

game: CSGO.

since all topics are a bit outdated about the particle system and after checking the source i couldn't find a solution here i am.

This is my current code:

Syntax: Select all

@Event('server_spawn')
def load_particles(game_event):
engine_server.precache_generic('particles/blood_impact.pcf', True)

def spawnBloodParticle(particleName, origin, duration):
particle = Entity.create('info_particle_system')
particle.origin = origin
particle.effect_name = particleName
particle.effect_index = string_tables.ParticleEffectNames.add_string(particleName)
particle.start_active = 1
particle.start()
particle.delay(duration, particle.remove())

@Event('player_death')
def _player_death(game_event):
player = Player.from_userid(game_event.get_int('userid'))
playerOrigin = player.get_datamap_property_vector('m_vecOrigin')
bloodParticle('blood_impact_basic', playerOrigin, 3)

particle name taken from https://developer.valvesoftware.com/wik ... _Particles

I checked https://github.com/Source-Python-Dev-Team/Source.Python/blob/master/addons/source-python/data/source-python/entities/CParticleSystem.ini but i couldn't really get it to work. Particles are not spawning and when it gets to the point of removal it says:
TypeError: 'NoneType' object is not callable

Any help would be appreciated.

Cheers,
CANi


Edit: Found this
https://github.com/Source-Python-Dev-Te ... Sprite.ini
Can you explain what
drop_model_index = m_nDropModel
spray_model_index = m_nSprayModel
does and is?

Re: Particle System

Posted: Thu Apr 12, 2018 3:29 pm
by Ayuto
canibozz wrote:TypeError: 'NoneType' object is not callable

What's the full traceback?

Re: Particle System

Posted: Thu Apr 12, 2018 4:29 pm
by satoon101

Syntax: Select all

particle.delay(duration, particle.remove())

The delay will error because you are calling remove immediately and it returns None. So basically you are passing None as the second argument to the delay and not the callable remove method. You should use this instead:

Syntax: Select all

particle.delay(duration, particle.remove)

Re: Particle System

Posted: Thu Apr 12, 2018 10:05 pm
by canibozz
That fixed my error but didnt help that my particle actually spawns.


Found this
https://github.com/Source-Python-Dev-Te ... Sprite.ini
Can you explain what
drop_model_index = m_nDropModel
spray_model_index = m_nSprayModel
does and is?

Re: Particle System

Posted: Sun Apr 15, 2018 5:16 pm
by canibozz
Bump, iam struggling to spawn anything in CS:GO, tried out different particles but nothings spawning.

https://github.com/Source-Python-Dev-Te ... Sprite.ini

Can you explain what
drop_model_index = m_nDropModel
spray_model_index = m_nSprayModel
does and is?

Re: Particle System

Posted: Mon Apr 16, 2018 5:08 pm
by VinciT
Here's an old particle script I made for a friend:

The blood particle you tried to spawn earlier should work.

Edit: I just noticed that your particle function is called spawnBloodParticle, but you call bloodParticle in the player_death event.
That's probably why you couldn't spawn anything.