How do I make 2 weapons fire (alternating fire)
The FireBlade has two sidemounted cannons:
I need to be able to make them alternate fire (left, right, left, right, etc.) . I've tried the VTM method of using tick, and it didn't work - the guns fired basically simultaneously. One of the issues is that the Raptor code already has a Tick function in it to run the streamers/thrusters.
How can I make the guns fire with even intervals without using tick?
You could cheat and throw a counter in tick. Or 2, leftCounter and rightCounter.
Then when you fire, you could zero the counters, and not allow them to fire until they reach some given amount. Start one of the counters at 0, and one at the arbitrary amount. Then only increment the counters when the vehicles are firing.
Actually, does weapon firing for weapons have firecount like player weapons? You could fire the left one if the firecount % 1 = 0 and right right one if firecount % 1 = 1.
Think that would work?
Could you give me a code sample? My coding is very, VERY weak. I'm a modeller/designer/texturer, not a coder, but I really want to get this working soon since BigCheese (my usual coder) is currently swamped with MSU stuff.
An easy way to get them to fire like that is to copy how the manta fires. If you look at the manta code(hoverbike) you'll see that it fires from one bone(look in the default properties at the bottom of the class), and has a dual fire offset. It looks like what you have isn't too complex(i.e. doesn't have 30 animations to export), so it' prolly would be to much to add a bone center (from the front view) of the places you want it to fire. Then export/import. There is a lot of things that use the cheap dual fire which looks like what you could use there.
Thanks, CIpen, but the cannons on this vehicle are both individual weapon spawns (like the FlakRat or the Buggy in the VTM's). They each rotate and pivot. Each gun also has a firing animation (only one, and it's only 10 frames).
I'm well aware of the DualOffset (it's what I used on the NodeRunner), but I really wanted both guns to move and rotate (I didn't want to take the cheaper way out ).
To implement a dual fire you're going to have to keep track of which gun you're going to fire with. with this decided, you should be able to just do an if check and call a different spawnprojectile function based on the outcome. You could even just modify your spawn projectile to do the dual firing instead.
var bool bFireGun1;
if( bFireGun1 )
In the case of instant fire, you're going to want to implement this directly into you're fire() function.
I suppose if you need to implement some custom interval thing as well you'd want to put a check in your fire function, right before you actually spawn the projectile that says.
if( Level.TimeSeconds > lastFireTime + TimeToWait )
In this block, bFireGun1=!bFireGun1 will make the above spawnprojectile function alternate which location to fire from
obviously this could be expanded to take into account any other factors you may have as well.
BTW, the model looks neato keen. If this helps maybe you could consider my post in this thread: New Turret Models Needed
Last edited by legacy-SirBeefsalot; 07-22-2004 at 10:08 AM.
if you put this somewhere effectively
var int i;
that will do fireLeft for all the even values of i and fireRight for all the odd values of i.
maybe you could something like that in a timer.
Although that is true. As long as you are using just "i%2" i would stick to using a boolean value;
var int i;
var bool someBool;
i %2 will always result in a 1 or a 0.
"I+1" will always cause the result of "i%2" to be the opposite to that of "i"
someBool = !someBool; gives the same result, and it just looks so much prettier. IMO.
Yeah, the reason I suggested using % is because firecount is a variable that already exists. Although Im not sure if it does in vehicle weapons. In "normal" weapons, firecount is incremented during the PlayFire() function (I think).
So by using firecount % 1, the firecount variable is already in place, and is already incremented by other functions.