05 Nov 10, 01:04PM
Well... you can if you absolutely want to, but I didn't take too much time studying the code and it's a really dirty, butchered job... something that no dev in his right mind would use, this is just a demo piece. Also, it's buggy as hell - if you use the launcher while firing normally as well, you lose multiple nades at once, it doesn't work in multiplayer, you can't suicide in certain situations. I'm pretty sure that I changed more stuff that I should have, too...
Basically, what I did is create a "secondaryattacking" variable in the playerent struct, and created the "secondaryattack" command which is basically identical to the normal attack one (except that it manipulates a different variable, of course). This secondaryattack variable is checked every time assaultrifle's attack method is called (I did override it, i.e. copy-paste the code from gun's attack and add in a little if that checks if the secondaryattacking variable is set, and if it is, it calls grenade's attack). I also modified grenade's attack code so that if the selected weapon is AR, it will... well basically I ran around looking at the different nade-related functions and copy-pasting relevant looking bits of code in hopes of producing a working result.
Do you want me to actually upload the files I changed?
Basically, what I did is create a "secondaryattacking" variable in the playerent struct, and created the "secondaryattack" command which is basically identical to the normal attack one (except that it manipulates a different variable, of course). This secondaryattack variable is checked every time assaultrifle's attack method is called (I did override it, i.e. copy-paste the code from gun's attack and add in a little if that checks if the secondaryattacking variable is set, and if it is, it calls grenade's attack). I also modified grenade's attack code so that if the selected weapon is AR, it will... well basically I ran around looking at the different nade-related functions and copy-pasting relevant looking bits of code in hopes of producing a working result.
Do you want me to actually upload the files I changed?