Okay, I have a If/then statement which works great, except when I try to create a particle to work with it. In the debug, it says that there is no entitynamed that, which, if I create the emitter somewhere else and just let it run, it works fine.
Here's the If/Then statement without the create particle:
And now my attempt to create a particle inside this if/then statement! (Notice, this exact createParticleEmitter code inserted here works great when I put it anywhere else, just does not work here. The sounds also work, so I don't think that is a problem.
Does anyone know what I'm doing wrong?
Should I create it before where it works, and then hide it until I need it? Or am I doing something else wrong? I want it to be universal that no matter where the bullets hit, the explosion particle is created.
Thanks,
Chad
Here's the If/Then statement without the create particle:
For thisbullet = Each bullettype ;iterate through all of the bullets If CountCollisions(thisbullet\entityhandle) > 0 ;check if bullet collided with something enemyhit = EntityCollided(thisbullet\entityhandle, 3) ;note which enemy (entity type 3) bullet collided with (if any) If enemyhit > 0 Then KillBadGuy(enemyhit) : PlaySound(explosion) : PlaySound(torpedoimpact) FreeEntity thisbullet\entityhandle ;delete the bullet mesh Delete thisbullet ;delete the bullet EndIf Next
And now my attempt to create a particle inside this if/then statement! (Notice, this exact createParticleEmitter code inserted here works great when I put it anywhere else, just does not work here. The sounds also work, so I don't think that is a problem.
For thisbullet = Each bullettype ;iterate through all of the bullets If CountCollisions(thisbullet\entityhandle) > 0 ;check if bullet collided with something enemyhit = EntityCollided(thisbullet\entityhandle, 3) ;note which enemy (entity type 3) bullet collided with (if any) If enemyhit > 0 Then KillBadGuy(enemyhit) : PlaySound(explosion) : PlaySound(torpedoimpact) : particleemitter5=CreateEmitter_explosion() : ShowEntity particleemitter5 : PositionEntity particleemitter5,0,0,0 FreeEntity thisbullet\entityhandle ;delete the bullet mesh Delete thisbullet ;delete the bullet EndIf Next
Does anyone know what I'm doing wrong?
Should I create it before where it works, and then hide it until I need it? Or am I doing something else wrong? I want it to be universal that no matter where the bullets hit, the explosion particle is created.
Thanks,
Chad