Stop Reloading Gun and Switch!


(Scennative) #1

hey guys I got a problem,but don’t now how to solve it:
i want to reload,but someone shots on me,so i want to switch gun, during the reload to cancel it,but my gun disappears,I must wait reload time,I hear the sound of reload,on 3rd person view I’m reloading.And after, it finally switches weapon.But when i come back to the previous weapon it was not reloaded!!! Some i’ve got a double question: how can I force the switch anim to play no matter what i am doing? Or if this is not possible then how to make the reload correctly work if i switched gun during it?

Here the Video:

http://de.xfire.com/video/27737e/

Here the code:
cg_weapons:
Search to:

// Don’t try to switch when in the middle of reloading.
if ( cg.snap->ps.weaponstate == WEAPON_RELOADING )
return;

and change it too:

// Don’t try to switch when in the middle of reloading.
// if ( cg.snap->ps.weaponstate == WEAPON_RELOADING )
// return;

Greetz sCenna
:stroggtapir:


(nukits) #2

I think its pretty cool but the time when he is switching weapon then its still the same reloading time or am i wrong?


(system) #3

why you wanna switch gun when someone shoots at you ? Or break the reloading. The time you reload or switch weapon your dead anyways…or do i misunderstand you ?


(BackSnip3) #4

Well now the difference is that if you wanted to reload and switched,your gun is not loaded but you switched weapon instantly,instead of waiting 3 secs and still having empty gun!


(IndyJones) #5

you are coding something i was missing for a long time. i was killed way too often, simply because i reloaded shortly before i saw enemy… it was enought time to kill me.


(Scennative) #6

Maybe so:

http://de.xfire.com/video/2784ff/

but the Sound of Reloading is playing when you switch…

Here the Codes:

cg_weapons:

// Don't try to switch when in the middle of reloading.
	if ( cg.snap->ps.weaponstate == WEAPON_RELOADING )
	 return;

to:

// Don't try to switch when in the middle of reloading.
//	if ( cg.snap->ps.weaponstate == WEAPON_RELOADING )
//	 return;

bg_pmove:


	if( reload ) {
		pm->ps->weaponstate = WEAPON_DROPPING_TORELOAD;
	} else {
		pm->ps->weaponstate = WEAPON_DROPPING;
	}

	pm->ps->weaponTime += switchtime;
}


/*
===============
PM_FinishWeaponChange
===============

too:


	if( reload ) {
		pm->ps->weaponstate = WEAPON_DROPPING_TORELOAD;
	} else {
		pm->ps->weaponstate = WEAPON_DROPPING;
	}

	pm->ps->weaponTime = switchtime;
}


/*
===============
PM_FinishWeaponChange
===============

xD (PS: Thx for the help, yada :slight_smile: )


(Scennative) #7

no idea? …


(UJERebel) #8

If you post whole code, we can maybe see ;o

Try to look where te sound is coming from, where it’s triggerd,…