Jump to content

Recommended Posts

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.

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.

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.

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 :D:D 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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...