Page 1 of 1

A_FireProjectile returns null sometimes.

Posted: Wed May 20, 2020 7:54 pm
by Accensus
This happens if it's used at point-blank range and the projectile explodes immediately. The projectile itself does not have a zero tic duration Death state. I have narrowed it down to this line. This most definitely seems intentional, but I can't figure out the reasoning for not returning a pointer to the projectile if it explodes immediately, provided it exists for a few tics after death. In my case I store some important data on the projectile when it is spawned, but cannot store it if the pointer to it is null on spawn.

Re: A_FireProjectile returns null sometimes.

Posted: Fri May 22, 2020 1:59 am
by Graf Zahl
That's what the second return value of SpawnPlayerMissile is there for. The behavior is by design. This happens if the projectile gets destroyed right away, you have to check this case in your code.

Re: A_FireProjectile returns null sometimes.

Posted: Fri May 22, 2020 2:33 am
by Accensus
I'll fix it on my end then. Thank you.