Particle System

Please post any questions about developing your plugin here. Please use the search function before posting!
canibozz
Member
Posts: 32
Joined: Wed Apr 11, 2018 7:55 am

Particle System

Postby canibozz » Thu Apr 12, 2018 12:48 pm

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?
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Particle System

Postby Ayuto » Thu Apr 12, 2018 3:29 pm

canibozz wrote:TypeError: 'NoneType' object is not callable

What's the full traceback?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: Particle System

Postby satoon101 » Thu Apr 12, 2018 4:29 pm

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)
Image
canibozz
Member
Posts: 32
Joined: Wed Apr 11, 2018 7:55 am

Re: Particle System

Postby canibozz » Thu Apr 12, 2018 10:05 pm

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?
canibozz
Member
Posts: 32
Joined: Wed Apr 11, 2018 7:55 am

Re: Particle System

Postby canibozz » Sun Apr 15, 2018 5:16 pm

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?
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

Re: Particle System

Postby VinciT » Mon Apr 16, 2018 5:08 pm

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 40 guests