Your help is appreciated, don't get me wrong, it's just the guy and anyone else reading this (noobs like me) would like to fix the stuttering.
O.k now you're just down right annoying. Didn't I give a detailed description on several methods that you (and anyone else) could employ to do this? We have a saying in Holland, 'stench for thanks'. Time
to help you and others.
decayed wrote:
The Happy Friar wrote:
if they're designed that way, yes. The RL fires @ a constant rate. So does the plasmagun. And the mini gun.
is it the sounds or the animations?
the plasmagun doesn't fire at a constant rate, or at least the sounds make it sound that way.
You need to realise some things about the fire animations and how things work in the D3 engine. Firing works via the 'launchProjectiles' statement. At certain keypoints a projectile is launched, these 'events' can be fired from within script or the .def files of the weapon.
The first option is to make a simple loop (pseudocode):
In this instance it will launch a projectile, every time after an anim is done playing.
Code:
WHILE (firingbuttonheld) {
playAnim(fire);
launchProjectiles();
while NotAnimDone(fireAnim) {
wait;
}
}
The other way to do this is from the def file itself.
Code:
anim firing "models/weapons/mygun/fire1.md5anim" {
frame 8 launchprojectiles();
}
The sounds are defined also in the def file:
Code:
anim firing "models/weapons/mygun/fire1.md5anim" {
frame 9 sound fire1;
}
In both methods, the animation itself is leading. For instance, let's say there are different fire anims, and some of them have more/less frames then this will mean that the wait period is sometimes shorter and sometimes longer, causing small delays. This was done by design. With real weaponry you will see that there are minor differences in timing as well (unless you go to the more high tech arms).
If you want the sounds to always play at the same time, make sure they are played at the same frame time.
A simple AK47 will not have a steady firing spree. In any case, if you look at firing weaponry in real life one should always maintain short, controlled bursts 'tatata.......tatata....tatata...' instead of 'tatatatatatatatatatatatata'. Simply pulling down the trigger and spreading your fire only happens in the movies and will do nothing but hurt yourself or worse, your squad mates or innocent bystanders.
If you want to bypass this kind of behavior without having to touch the anims themselves you can do something like this, instead of waiting for the anim to finish, simply define a fixed amount of waiting time:
Code:
WHILE (firingbuttonheld) {
playAnim(fire);
launchProjectiles();
wait ( 0.5 ); ///wait 0.5 milliseconds.
}
Watch out: If you define the wait time as too short very strange things will happen, as the engine cannot render more than 30 frames per second. This means that if you try to fire more than 30 bullets per second the anims will fail and the results will be... interesting.
