. . . Posted August 21, 2016 Share Posted August 21, 2016 (edited) What does "inst.components.combat.min_attack_period" do? Edited August 22, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/69688-solved-question/ Share on other sites More sharing options...
rezecib Posted August 21, 2016 Share Posted August 21, 2016 It makes Combat:CanAttack return false for that period, and Combat:InCooldown return true. I'm not sure player combat actually uses those functions, though. Link to comment https://forums.kleientertainment.com/forums/topic/69688-solved-question/#findComment-805615 Share on other sites More sharing options...
DarkXero Posted August 21, 2016 Share Posted August 21, 2016 For players, you have a min_attack_period of 0.1. If you set it to 0 or a negative number, it doesn't matter: it doesn't change how long an attack takes. But if you set it to a number like 10, you will see your character attacking once, then running like a moron to the target until he can attack again. The locomotor component uses CanAttack() of combat to push the attack action. For monsters, it's for the "Chase And Attack" behaviour. That behaviour calls TryAttack(). TryAttack() calls CanAttack(). CanAttack() checks that more seconds than min_attack_period happened before another attack can happen. Also, pig brains use InCooldown() to know when to retreat. Link to comment https://forums.kleientertainment.com/forums/topic/69688-solved-question/#findComment-805689 Share on other sites More sharing options...
Jpianist Posted August 21, 2016 Share Posted August 21, 2016 9 minutes ago, DarkXero said: For players, you have a min_attack_period of 0.1. If you set it to 0 or a negative number, it doesn't matter: it doesn't change how long an attack takes. But if you set it to a number like 10, you will see your character attacking once, then running like a moron to the target until he can attack again. The locomotor component uses CanAttack() of combat to push the attack action. For monsters, it's for the "Chase And Attack" behaviour. That behaviour calls TryAttack(). TryAttack() calls CanAttack(). CanAttack() checks that more seconds than min_attack_period happened before another attack can happen. Also, pig brains use InCooldown() to know when to retreat. This is not even my question but your answer is brilliant and shows how useful this could be in a mod. If i got it right this code could help to modify a weapon's cooldown time before being able to strike again, which is really important when coding a powerful weapon that without cooldown could overpower the player too much to be fun. Link to comment https://forums.kleientertainment.com/forums/topic/69688-solved-question/#findComment-805693 Share on other sites More sharing options...
DarkXero Posted August 21, 2016 Share Posted August 21, 2016 9 minutes ago, Jpianist said: If i got it right this code could help to modify a weapon's cooldown time before being able to strike again, which is really important when coding a powerful weapon that without cooldown could overpower the player too much to be fun. Well, there's a problem with touching the cooldown. You don't want people to press the attack button only for them to run into the monsters, and then keep running into the monsters, and then keep running into the monsters, and then keep running into the monsters, and then keep running and just running, because of the cooldown. A more sensible option would be to change the weapon's damage to 0 after a hit, and allow the weapon to regain the damage after a while passes. Link to comment https://forums.kleientertainment.com/forums/topic/69688-solved-question/#findComment-805698 Share on other sites More sharing options...
Jpianist Posted August 21, 2016 Share Posted August 21, 2016 11 minutes ago, DarkXero said: Well, there's a problem with touching the cooldown. You don't want people to press the attack button only for them to run into the monsters, and then keep running into the monsters, and then keep running into the monsters, and then keep running into the monsters, and then keep running and just running, because of the cooldown. A more sensible option would be to change the weapon's damage to 0 after a hit, and allow the weapon to regain the damage after a while passes. You're right Well i have a better idea which is using a bar parameter (MP-energy) and when you don't have enough energy, you can't use the magic attack. Link to comment https://forums.kleientertainment.com/forums/topic/69688-solved-question/#findComment-805703 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now