Yes, as i said its a bad (in almost all cases) useless idea. But maybe he wants more then the simple chain - reaction - explosion, we dont know for sure yet. ^^
The code is for a disk sized projectile that the player can fire and that deals full damage to the main target and half in explosion damage in a circular zone. Next to damaging the enemy/entity + chance to stun, it needs to be able to create particles as gore (fountains of blood
). For the impact event I got everything working, but I still needed to get the explosion/event_scan part working correctly.
I had trouble getting the draw_point3d code correctly to debug my c_scan. I now used this in the entity's event (its probably bad coding I know, I removed it now, it was only for testing):
if (event_type == EVENT_SCAN)
{
if (you.DAMAGE > 0 && is(you,FLAG2))
{
...damage etc...
wait(1);
while (1)
{
draw_point3d (my.x, vector (50, 50, 255), 100, 3);
wait(1);
}
}
}
... and that shows that the horizontal scan sector and vertical scan sector part part of the c_scan function is incredible buggy/inconsistent or something else is wrong with my map that makes it buggy. Cause often the dots don't get created when I hit an enemy in the explosion range.
So I think I will just entirely ignore c_scan for this one and go with your before first mentioned trick Rayp; for + ent_next + vec_dist within a function that I call from the missile action. I will comment again as soon as I got it working.
For some reason I always tend to mess things up with c_scans in projects no matter how many tutorials + examples I have read about it. Same goes a bit for c_trace, but to a lesser extent.