OK, fireballs now have Gravity set to 0.05 and the NOGRAVITY flag removed. Cool, that's them done (except I need to stop their gravity in their Death state; falling poofs of fire look pretty weird.) That's all great, but I want the imps to throw their fireballs with the right angle to hit the target (if not possible then not at all.)
So for the imps, I have this:
Code: Select all
ACTOR _DoomImp: DoomImp replaces DoomImp
{
States {
Melee:
TROO EF 8 A_FaceTarget
TROO G 6 A_CustomMeleeAttack(3 * random(1, 10), "imp/melee")
Goto See
Missile:
TROO E 0 A_JumpIf(FastMonstersIsTrue, "FastMissile")
TROO EF 8 A_FaceTarget
TROO G 6 A_SpawnProjectile("DoomImpBall", 32, 0, 0, CMF_AIMDIRECTION, GetAppropriateAngleOrJumpIfOutOfRange("See", AAPTR_TARGET, 0.05, 10)) // Presumably CMF_AIMDIRECTION is the right flag to use? I couldn't _really_ tell.
Goto See
FastMissile:
TROO EF 8 A_FaceTarget
TROO G 6 A_SpawnProjectile("DoomImpBall", 32, 0, 0, CMF_AIMDIRECTION, GetAppropriateAngleOrJumpIfOutOfRange("See", AAPTR_TARGET, 0.05, 20))
}
}
My previous attempts, though, involved using GetDistance(false) (for the XY plane) and using it as variable x (we've got a rotated 2D representation of the plane on which the imp and the target lie) and then doing
to get the y variable (so done because how do i get the relative Z offset of the target in a cleaner way?), doing this (g = Gravity, v = Speed or FastSpeed)
(aborting the whole missile attack if the expression being square-rooted is negative, because that means that the ball cannot hit the target)
from wikipedia. Also, the plus-or-minus sign can be whichever, both get the right angle apparently
...yeah, that... and using the theta on the left to get the angle required. but... i can't really describe how it all went wrong now. In future I won't destroy previous attempts.
I've tried A_ThrowGrenade("DoomImpBall"), but it's not always accurate, especially if I'm not level with the imp.
So yeah, I really need some help coming up with an approach to this
EDIT: the post was slightly unfinished
EDIT2: got fastmissile and missile swapped, derp