getactor[THISACTOR].z z2
getplayer[THISACTOR].i ID
getactor[ID].z posz
subvar z2 8192
subvarvar z2 posz
ldist xyvalue2 THISACTOR ID
mulvarvar z2 z2 mulvarvar xyvalue2 xyvalue2
addvarvar z2 xyvalue2
sqrt z2 z2
ezshoot z2 YELLOWROCKET
/* getactor[THISACTOR].x x
getactor[THISACTOR].y y
getactor[THISACTOR].ang TEMP
setvarvar y2 y
addvar y2 128
rotatepoint x y x y2 TEMP x3 y3
setactor[RETURN].y y3 */
I was trying to make an actor shoot another from some distance with accurate vertical aim. The enemy targets player, and has rocket launcher mounted on his back, so he fires from a bit higher than the actor's Z. I thought of the case, draw some simple sketches and found out that phythagoras would just work fine. Difference between Z's form the height, their distance forms the base, and finally, the result forms the zvel it must come from. So, where have I been mistaken with this idea ? D:
[EDIT] : Forgot to say what doesn't work. The actor shoots at his feet if player is too far, and even behind himself which can actually go really far. If player is really close, then the rocket goes where it is supposed to, but most of the time, missed the player.