Amaster
Artificial Mechanical Android Skilled in Troubleshooting and Efficient Repair

Posts: 3563
Registered: 04-02 |
madmax said:
how low should i make the shotgun firerate so that it fires really fast and all the other weapons to
Whoops, there's was something i overlooked. Along with changing SHOTGUN_FIRERATE you must also adjust how the game handles the post-firing animation. Easiest way:
Look for a function called weapon_shotgun::fire (again this is in the script file). It's going to look something like this:
code:
void weapon_shotgun::Fire() {
float ammoClip;
if ( WEAPON_NETRELOAD ) {
WEAPON_NETRELOAD = false;
weaponState( "Reload", SHOTGUN_IDLE_TO_RELOAD );
}
next_attack = sys.getTime() + SHOTGUN_FIRERATE;
ammoClip = ammoInClip();
if ( ammoClip == SHOTGUN_LOWAMMO ) {
startSound( "snd_lowammo", SND_CHANNEL_ITEM, true );
}
launchProjectiles( SHOTGUN_NUMPROJECTILES, spread, 0, 1.0, 1.0 );
playAnim( ANIMCHANNEL_ALL, "fire" );
waitUntil( animDone( ANIMCHANNEL_ALL, SHOTGUN_FIRE_TO_IDLE ) );
weaponState( "Idle", SHOTGUN_FIRE_TO_IDLE );
}
See that bold line? That tells the game to wait for the firing animation to complete, Which adds an extra delay on top of the firerate. Try commenting out the line using a double slash so it looks like this:
//waitUntil( animDone( ANIMCHANNEL_ALL, SHOTGUN_FIRE_TO_IDLE ) );
This will elimate the delay produced by the post-fire animation. Unfortunately it also eliminates the post-fire animation itself. I'll see if I can get something worked out for that.
Edit: Ok, copied and modified some of the machinegun code to re-institute the post-firing animation while being able to interrupt it.
Insert the following code below that line we just finished commenting out:
code:
while( !animDone( ANIMCHANNEL_ALL, SHOTGUN_FIRE_TO_IDLE ) ) {
currentTime = sys.getTime();
ammoClip = ammoInClip();
if ( ( currentTime >= next_attack ) && WEAPON_ATTACK && ( ammoClip >
0 ) ) {
weaponState( "Fire", 0 );
}
waitFrame();
}
This wil give us back the "fire_to_idle" animation, but now we will be able ton interrupt said animation in order to accomodate our custom firerate. If you need further adjustments you can also alter the value of SHOTGUN_FIRE_TO_IDLE which is defined near the top of the file.
Last edited by Amaster on 12-16-05 at 07:02
|