Ladies, gentlemen.
I’m currently attempting to set up a system for equipped weapon stats, and I’ve run into an issue I’m not sure how to solve:
I’ve got a Float that represents the attack speed of the equipped weapon, the default of which is 1. This is used as the attack animation’s speed:
animation["Attack1"].speed = attackSpeed;
Further on in the code is a bit that uses WaitForSeconds to make it so you can’t attack again until X seconds have passed, the value of which should get lower the higher the weapon’s attack speed is, or vice-versa. The default of this one is .5.
So, for example, if the attack speed were 2, I’d say that X should be around .25. .5, and it’d be 1. How would one accomplish this?
In your Q title, you ask for the inverse. Why doesn't the actual inverse --
– Owen-Reynolds1/attackSpeed-- work, or, in your case:Waitfor( 0.5f / attackSpeed)? I'd probably change attackSpeed to the actual delay in seconds, then use 2/attackSpeed for the animation speed.