I feel like there has to be a more efficient way to do this, since each of these are running essentially the same line of code, but they specifically all do different things. The “NextWeapon” input obviously just finds which is currently active and swaps to the other one. The “PrimaryWeapon” input only changes to the primary slot and nothing else, and the “SecondaryWeapon” input does the inverse. I thought about trying to use Enums, but I dunno if that’d actually be worth it for such a small task.
Firstly, you don’t need the Do Once nodes here as the Started execution pins of Input Action nodes already gets triggered once per click.
Other than that, you can simply use the Flip Flop node to switch between your two weapons. Just get a Flip Flop node, place it after the Started pin of your input action for weapon switching, set the current weapon to one of your two weapons after it’s A pin and the other after it’s B pin.
Hope these help
I added the do once to prevent spamming, honestly. I don’t want my player to be able to rapidly swap weapons. I’ll add a “ready” animation later in place of the delay most likely. The flip flop could definitely help the “NextWeapon” action, though.
If you’re gonna keep the other two input actions for dedicated weapon selections, then the flip flop node’s not gonna work. In that case, you should plug the True pin of one Branch node and the False pin of the other into the same Flip Flop node that gets executed after the input action for weapon switching as well, feeding the Flip Flop node 3 execution chains in total instead of setting the current weapon’s value separately after each input action.
Yeah but you’d need to place the Do Once node before the Flip Flop node otherwise you won’t be able to achieve that anti-spam measure you want.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.