Changing rate of fire without altering animations?

WilsonWilson Join Date: 2010-07-26 Member: 72867Members
Does anyone know if it is possible to change the rate of fire independently from the animations?

It seems a bit limiting to force guns into certain rates of fire that cannot be adjusted easily. I was trying to slow down the rate of fire of the rifle but I can't seem to do it. Even setting the speed in the animation graph of the primary fire animation seems to have no effect - I think the animation is only 1 frame long. Since I don't have access to the original 3dsmax files I can't even alter the animation speed either.

I also have another weapon model in which the fire animation is 30 frames long but I want to be able to fire again before that (but not instantly!), so that on the last shot of the gun it has a nice winding down effect (by playing the entire animation) rather than an abrupt stop; but I'm unsure how to do this.


Also, while I'm posting I have another quick question. I have created a new weapon and everything works fine apart from the world model. I set the model to rifle.model but when I drop the weapon it is invisible, the hud icon is there and I can pick it up again but I can't see it. I guess I might have missed adding the weapon in a certain file...any ideas?

Comments

  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    Most weapons/abilities in NS2 have their firerate determined by the animation tags, so you would need to change the lua to work slightly differently if you wanted to establish numerically limited firerates.

    You can also set the attack_speed which effects many alien abilities, and could configure that ability on marine weapons as well (its currently used for enzyme on the alien class).

    For your rifle model are you setting both the view model and the rifle model? And also you need to make sure the world model has collisions or it will fall out of the world when dropped.
  • WilsonWilson Join Date: 2010-07-26 Member: 72867Members
    Thanks for the reply dragon.

    I guess I will need to use OnTag "fire" and then add a delay in there somewhere after each shot. I'll have a look at that attack_speed as well.


    For the weapon: yes, the viewmodel is working correctly and they are both set in the weapon lua file. I also had to add lines of code to Shared.lua, Player_Client.lua, GUIPickups.lua and GUIActionIcon.lua in order for the file to be loaded and for the hud and crosshairs to work correctly. The only thing I can think of is that there is some other file that I need to edit in order for the world model to display. It's not falling through the world since the hud pick up icon is displayed and I can pick up the weapon again.
  • WilsonWilson Join Date: 2010-07-26 Member: 72867Members
    edited November 2012
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    It might be easier to have it all done in the function OnPrimaryAttack(player) for the weapon, which is how I hardcoded the weapons I did. I believe that function is triggered by the pressing of the primary fire button (or each frame if holding and the PrimaryAttackRequiresPress (not sure on this exact function name) returns false
  • WilsonWilson Join Date: 2010-07-26 Member: 72867Members
    I might try that dragon. My current method is working now but it's a bit of a hack. The weaponmodel is really puzzling me though. I can edit the rifle and change it's weapon model to a pistol but if I copy the exact code over to a new weapon it is still invisible.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    Can you see the weapon in thirdperson?
  • WilsonWilson Join Date: 2010-07-26 Member: 72867Members
    No, the marine just stands with his arms by his side.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    Can you see it in the viewer? We had this same problem but i cant remember how we (well really eh) fixed it.
  • WilsonWilson Join Date: 2010-07-26 Member: 72867Members
    Yeah, I can see it in the viewer. It's just the rifle.model from ns2, but it doesn't work in my other weapon.lua files.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    Ohhhh I didnt catch that it was just the rifle model... hmmm. Do you precache it multiple times (just a guess). Or did you copy it to another folder/rename it at all?
  • WilsonWilson Join Date: 2010-07-26 Member: 72867Members
    Nope, as I said the same line of code works if I copy it exactly to Pistol.lua, but not if I copy it to NewGun.lua. Maybe I need to tell the player model what animations it needs to use to hold the weapon?
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    You need to supply the animation graph when setting the model IIRC, but if your copying an existing weapon i figured you would have that too.
Sign In or Register to comment.