Hope you can help on this as this is the main thing preventing me from having a range of weapons;
I'm thinking of expanding my range of weapons I have in my game & most importantly to maintain & make sure the player can never fire unequipped. Because of my basic code skills I have kept my game simple implementing my own methods to disable fire if unequipped.
I have my own bullet method. To disable is simply done when the sword becomes active, the Swords collider disables the fire method. The sword must be the last item for this to be effective. Works well and I understand as its simple.
The issue is, unlike sword and rifle, pistol for some reason has to cycle through the unequip animation before moving to next item
This means player can fire unequipped at this point. Can I disable the pistol unequip animation? This doesn't happen with just 2 weapons as sword will directly equip straight to rifle no unequip phase here at all.
Just trying to either arrange or code a simple quick method that has full control as to when my weapons should fire and when they should not. I have attempted a weapon script with booleans and on trigger enter/exit for each weapon held but couldn't get it to work. I have tried block/state pre-sets. Also tried a counter integar method after 2 button presses but this seemed a one way process where it would not re-set.
I also experimented duplicating rifle and anim (changing to anim ID 2) and just changing the visual mesh replacing with pistol hoping I could some how just switch effortlessly switch between the 2 and skip the equip animations but couldn't get it to work well. Is there a speedy simple solution to prevent fire on an unequipped player?
I'm thinking of expanding my range of weapons I have in my game & most importantly to maintain & make sure the player can never fire unequipped. Because of my basic code skills I have kept my game simple implementing my own methods to disable fire if unequipped.
I have my own bullet method. To disable is simply done when the sword becomes active, the Swords collider disables the fire method. The sword must be the last item for this to be effective. Works well and I understand as its simple.
The issue is, unlike sword and rifle, pistol for some reason has to cycle through the unequip animation before moving to next item
This means player can fire unequipped at this point. Can I disable the pistol unequip animation? This doesn't happen with just 2 weapons as sword will directly equip straight to rifle no unequip phase here at all.
Just trying to either arrange or code a simple quick method that has full control as to when my weapons should fire and when they should not. I have attempted a weapon script with booleans and on trigger enter/exit for each weapon held but couldn't get it to work. I have tried block/state pre-sets. Also tried a counter integar method after 2 button presses but this seemed a one way process where it would not re-set.
I also experimented duplicating rifle and anim (changing to anim ID 2) and just changing the visual mesh replacing with pistol hoping I could some how just switch effortlessly switch between the 2 and skip the equip animations but couldn't get it to work well. Is there a speedy simple solution to prevent fire on an unequipped player?
Last edited: