SpikedHelmet wrote:I have a hunch that your tank isn't firing solely because you do not have "turn object to x-axis <0> - pitch". Try doing that first. No, it shouldn't go backwards. Telling it to go to 0 is basically making sure that it resets to normal alignment before pointing at the target. If you've ever made a unit with a turret ontop of another turret you'd know what I mean. Basically, if you have two turrets, one ontop of the other, and have both fire at something 90 degrees to the right... the bottom turret will turn 90 degrees but the top one will as well. Because the top one is ON the bottom turret, it will in effect be turning 90 degrees twice, ending up pointing in a completely wrong direction. Same thing goes for pitch; say your tank is rumbling along and another tank appears directly behind it (180 degrees). Your turn along y-axis script tells the turret to turn 180 degrees along the y-axis; your turn along x-axis script tells the turret to turn 180 degrees along the x-axis as well - basically meaning your turret will make two 180 degree rotations, which equals a complete 360 degree rotation, effectively making it NOT MOVE.
Hence, telling it to go to 0 first in the aiming script makes it "realize" where to begin calculating rotation from.
B.S.:
turn 0 - pitch is just because of the axis convention used, you have turn negatively around the x-axis for the front part of a piece to go up. It doesn't
at all mean anything like reseting to normal before moving or setting where to begin calculation from. The engine just passes a pitch between -90° and +90°, and a heading between -180° and +180° (Note that TA will pass positive values, so negative angle will have a +360° shift, but the Spring engine doesn't mind just passing the negative angle to the script). Either way it won't ever pass a pitch angle beyond vertical. If you don't believe me, just remove that "0 -" from "turn frontturret to x-axis <0> - pitch speed <50>; " and watch the tank aims down instead of up, yet still behave the same even when the target is backward.
Having 'return 0' at the end of each function won't hurt anything, it could even solve some potential (but very rare, don't worry) bugs where scriptor forget to add them at the last } of a function. I think return; return(0); and return 0; all are the same once compiled.
Something that bugs me into that script is that every turret use the same "RestoreAfterDelay". I'm not very sure about what happens when the same function is called many time, and has no signal thing. Does it create many independant instance of the function? Does each new starting of the function kill previous one even when there is no signal? Does it break everything? I just know that calling/starting several time the same function in old TA could bring total havoc and inconceivable bugs. But I don't know about Spring. But just to be safe, I'd comment all those start-script RestoreDelay(); And then later once the bug is squashed, give each aiming script its own RestoreAfterDelay, otherwise if, let's say, leftturret has not target for a while, then by restoring its position it will make also right turret turn to 0 even if right turret is busy firing!
What about simplifying the unit to have only one weapon, Primary, and then trying to put all your six aiming script one by one into AimPrimary to test each turret individually, before trying to script all six turrets at once?
Only when it works fine with one weapon then gradually augment the number of weapon and used turrets.