I am working on a Dual Mag script which appears to be working but I've run into an issue.
When it came to playing a different anim when they had 0 bullets I decided to use forceviewmodelanimation and set it to reload, which would be the dual_mag_empty anim.
It works, but for some reason after it switches back to my original weapon I can't shoot for 1 or so seconds.
Shooting and reloading when there is ammo in weapon works no issues, but if it's reloading empty with the dual mag anim, it freezes the gun for a few seconds.
Any info would be appreciated, if I can't get it to work I can just use same dual mag anim.
I am working on a Dual Mag script which appears to be working but I've run into an issue.
When it came to playing a different anim when they had 0 bullets I decided to use forceviewmodelanimation and set it to reload, which would be the dual_mag_empty anim.
It works, but for some reason after it switches back to my original weapon I can't shoot for 1 or so seconds.
Shooting and reloading when there is ammo in weapon works no issues, but if it's reloading empty with the dual mag anim, it freezes the gun for a few seconds.
Any info would be appreciated, if I can't get it to work I can just use same dual mag anim.
This is the code I use for my dual clips, I just worked it out with MC on zombiemodding:
Code Snippet
Plaintext
ALLPLAYERTHREAD(){ players = get_players(); for(i=0;i<players.size;i++){ //Copy and paste these two lines for every dual clip gun you add //The Two numbers at the end represent the time in your weapon file it takes for the mag to enter the gun (when the counter refills) for normal, and then for quick players[i] thread AltReload("commando_fastmag", "commando_fastmag_quick", 1.55, 1.13); players[i] thread hud_check_alt_reload("commando_fastmag", "commando_fastmag_quick"); players[i] thread AltReload("commando_fastmag_upgraded", "commando_fastmag_quick_upgraded", 1.55, 1.13); players[i] thread hud_check_alt_reload("commando_fastmag_upgraded", "commando_fastmag_quick_upgraded"); } } hud_check_alt_reload(specialgun, specialgun_other){ while(1){ if(self GetCurrentWeapon() == specialgun || self GetCurrentWeapon() == specialgun_other){ self SetClientDvar( "hideAlt", true ); wait 0.1; continue; } else{ self SetClientDvar( "hideAlt", false ); wait 0.1; continue; } } } AltReload(specialgun, specialgun_other, norm_reload_time, quick_reload_time){ counter = 0;
If you switch weapon to fast after playing a forced animation with ForceViewModelAnimation, it freezes the gun up and waits the reload time all over again. For those wait times you added, add 0.05 to them so it has a nice extra frame of time to finish the animation. Also for your reload wait times, don't forget to account for speed cola.
Your script also looks like you can switch from 'k7' but still have this work. You have to constantly check that your current weapon is the k7, you cannot just wait until reload start because the player might have switched from it during that time.
Here I made a little script you could try that fixes what I just mentioned:
If you switch weapon to fast after playing a forced animation with ForceViewModelAnimation, it freezes the gun up and waits the reload time all over again. For those wait times you added, add 0.05 to them so it has a nice extra frame of time to finish the animation. Also for your reload wait times, don't forget to account for speed cola.
Your script also looks like you can switch from 'k7' but still have this work. You have to constantly check that your current weapon is the k7, you cannot just wait until reload start because the player might have switched from it during that time.
Here I made a little script you could try that fixes what I just mentioned:
BTW this script is actually pretty smart. Mind if I use it?
Thanks, nice to know that when I use forceviewmodelanimation again, lol. and thanks for making the edits for me.
I forgot to add it to the bottom of this, but with anything I post in this section when asking for help, anyone is more than welcome to use this stuff and apply it to what they want.
Thanks, nice to know that when I use forceviewmodelanimation again, lol. and thanks for making the edits for me.
I forgot to add it to the bottom of this, but with anything I post in this section when asking for help, anyone is more than welcome to use this stuff and apply it to what they want.
K thanks. I made some changes after the first time I posted this script, can I see the script that you are using right now to make sure it is right?
K thanks. I made some changes after the first time I posted this script, can I see the script that you are using right now to make sure it is right?
Sure, I made some edits but nothing major, just made it so I can call it with add_dual_mag_weapon(); and check their weapon so they can't switch to the alt weapon:
I did notice however, that if they have speed cola, it can freeze again, and if they are reloading they can switch back to their original. According to DUKIP it is not possible to override this at all. I just need to rely on them not pressing 5.
Last Edit: March 20, 2016, 11:27:05 pm by Scobalula
Sure, I made some edits but nothing major, just made it so I can call it with add_dual_mag_weapon(); and check their weapon so they can't switch to the alt weapon:
I did notice however, that if they have speed cola, it can freeze again, and if they are reloading they can switch back to their original. According to DUKIP it is not possible to override this at all. I just need to rely on them not pressing 5.
Or you can do
Code Snippet
Plaintext
self SetActionSlot( 3, "" );
while reloading and then
Code Snippet
Plaintext
self SetActionSlot( 3, "altmode" );
to re-enable alt weapon switching when done. Also if you are making multiple weapons, I would suggest making an array for self.dual_mag_reloads, so each weapon would have self.dual_mag_reloads[ weapon ].
Here I made some changes for you again, this time I also made it set the ammo to the weapon's clip size rather than just '30' as not all guns have a clip size of 30. I also added the alt weapon switch disable instead of your 'is_alt' function. I used a little something I got from origins staffs scripts that was used to manage the "fake" alt weapon that was the revive staff, but heavily edited to fit for this. Basically it just handles some logic about when to allow or disallow alt weapon switching, so that it doesn't break other gun's alt weapons. You also said that if the player has speed cola, it still freezes? I put the weapon reload times back to their default and manually added +0.05 in the reload time multiplier for speed cola.
Also I realized that if you have speed cola, and you use the alt raise animation like you have been doing to play the animation, speed cola will not speed that up. I'm tired right now so maybe make sure this works first and I will think of a way to speed up the normal reload time w/ speed cola and script it for you, only because I want to use this too and I don't mind who else uses it because I don't like seeing fake dual mags like I have before. Infact, if you confirm it works, could I make a tutorial in the scripts section?
Last Edit: March 21, 2016, 04:55:33 am by alaurenc9
to re-enable alt weapon switching when done. Also if you are making multiple weapons, I would suggest making an array for self.dual_mag_reloads, so each weapon would have self.dual_mag_reloads[ weapon ].
Here I made some changes for you again, this time I also made it set the ammo to the weapon's clip size rather than just '30' as not all guns have a clip size of 30. I also added the alt weapon switch disable instead of your 'is_alt' function. I used a little something I got from origins staffs scripts that was used to manage the "fake" alt weapon that was the revive staff, but heavily edited to fit for this. Basically it just handles some logic about when to allow or disallow alt weapon switching, so that it doesn't break other gun's alt weapons. You also said that if the player has speed cola, it still freezes? I put the weapon reload times back to their default and manually added +0.05 in the reload time multiplier for speed cola.
Also I realized that if you have speed cola, and you use the alt raise animation like you have been doing to play the animation, speed cola will not speed that up. I'm tired right now so maybe make sure this works first and I will think of a way to speed up the normal reload time w/ speed cola and script it for you, only because I want to use this too and I don't mind who else uses it because I don't like seeing fake dual mags like I have before. Infact, if you confirm it works, could I make a tutorial in the scripts section?
Tested and worked, however there is still that pesky issue with speedcola and freezing, lol, but other than that works.