Thanks for the kind words CC; I'm not quite sure I merit them.
DoTarget and DoFire aren't going to work the full way out. The workaround is to calculate the trajectory, and put an invisible or very small object somnewhere along that path, and have the gun target that. Now that's getting tricky.
As for calculating trajectory, well first you need to figure out what the OFP trajectory formula is. I haven't determined this myself. Second, you need to find out what way the barrel is pointing. That information is only available to us once the barrel fires something. You can catch the fired projectile now using an eventhandler. (this addeventhandler ["fired", {myshell = nearestobject [_this select 0, _this select 4])
and you can track it.
You will still hit the problem of the shotshell simulation. The shotshell simulation (whcih governs artillery shells) terminates after 20 seconds. Assuming no drag, that means that the vertical component of a shell has to be 98 m/s or less. So if you want to be able to fire a shell at a 45-degree angle and have it hit the ground, you're limited to approximately 2000 meters range.
I've heard talk of this 3800 m limit. I suspect it's the 20-second timeout, since I've tracked shells across the map. But I've been wrong before.
Ultimately, I think player-controlled artillery tubes in OFP is a waste of resources. We don't have the aiming mechanism for the precise settings that the modern artillery pieces have.
On the other hand, artillery is important, and it is really cool to receive fire support from a platoon on the other side of the map. The accuracy of the gun when it's firing isn't as important as where the shells land. So the solution I hope to implement is to have the artillery guns fire in the general elevation and direction of the target, use an EH to swap it the shell, and put in a fresh shell at the appropriate time and at a trajectory approximate with respect to what it should be, but precise with respect to where I want the shell to hit.
In other words, we know where we want the shells to fall, so let's start from there and fake the rest.