I recently built a medieval Ballista. For those unfamiliar with that, it's basically a giant stationary crossbow that fires a similarly large "arrow."
With some very cool advice, I was told a good script to work off of to make this thing work would be the fireworks script.
I took that, and the script from inside the launcher (for the rocket) and modified them to get my ballista/ammo to work. It works fairly well now. And took me forever to even get this far. I'm not a scripter, and it was pretty much experimentation in most cases.
I'm at a point now where it fires just fine. And the munitions will auto delete safely, etc etc.
The problem I'm having is this.
I rez the object, fire it...everything is okay.
But when I go to rotate it for a different firing position, the "arrow" I'm firing looses its positioning on the ballista itself. It'll appear shifted off the ballista to the right or left. Too far back, forward, or even pointing in the opposite firing direction of the ballista itself.
It will only fire from its proper position on the machine if it's freshly rezzed from inventory - or I manually put it back to it's original rezzed rotation settings via the edit tools.
Side note: I also notice that occasionally, instead of 'sticking' into an object, when I fire it, it will "go off the world" and end up in my lost and found. Even if I'm firing it inside a fully solid room with walls on all side. Occasionally it hits a wall or object, sticks, then disappears normally. But a lot of the time it does the went off the world thing.
Been working on this for like 5 hours straight... I'm very tired. Would love any advice or help you guys can shoot my way.
I'm really not sure what code to post here. So I'll just paste the part that I'd been messing around with forever, just to get the 'arrow' to line up with the ballista properly in the first place.
-----
CODE
touch_start(integer total_number)
{
if (ready)
{
llSetStatus(STATUS_PHANTOM, TRUE);
vector pos = llGetPos();
pos.z -= 0.001;
pos.x += 1.052;
pos.y += 1.05;
rotation rot = llGetRot();
rot.z += 0.0;
rot.x += 0.0;
rot.y += 0.0;
llRezObject("Ballista Ammunition", pos, <0,0,0>, rot, ready);
llSetTimerEvent(2);
}
Besides the annoying arrow going off world now and again, I'd just really like to be able to rez the ballista, and be able to edit-tool rotate it into firing positions, with the arrow still shooting from it's original 'loaded on the ballista' position no matter which way I'm facing it.
Thanks in advance,
Omen