Do after x secs crashes on projectile

NeoCHI

  • Posts: 523
So I have a projectile that I kill after it collides with certain objects. I want it to only travel a limited distance so in the projectile I also tell it kill itself after 0.3 seconds.

For some reason, this will occasionally crash the game though. Even when I remove everything within the "Do after x sec" block it still occasionally crashes. Basically just because I have this "Do after 0.3 seconds" block on a projectile that I kill when it hits certain actors, it crashes randomly.

Anyone know why and how I can fix this?

CmdrWhitey13

  • Posts: 505
Could try:
Do after 0.3 sec
   Trigger event kill in this behaviour
When kill happens
    Kill self.

Id say it maybe due to a timing issue, trying to kill it to quick and continues the code when the object doesnt exist anymore.

NeoCHI

  • Posts: 523
Problem now though is that even when theres nothing in the do after x sec block it still crashes...

CmdrWhitey13

  • Posts: 505
Its not in the updating event by chance is it?

"Warning: Do not use this block in a when updating event, unless constrained by an if block or other conditional."

http://www.stencyl.com/blocks/view/flow-time

NeoCHI

  • Posts: 523
Nope, in "When created". This simulates the projectile only being able to reach a certain distance after firing.

LIBERADO

  • *
  • Posts: 2720
The crash cannot be caused by the empty timer block. You should look for the error in other part of your code.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.