Melee Combo Attack

Use the Melee Combo Attack package to create a weapon capable of chaining combo attacks.

You define a number of different attacks you’d like your melee weapon to cycle through in a row

I worked hard to make the code very readable and the tooltips extensive, so theoretically you shouldn’t need this guide, but in case here’s how it works and a place to ask questions/request features if you have any.

So, with Melee Combo Attack

Basic Usage

I highly recommend checking out the included sword example to get a sense of how it works. In the script, you define a number of attacks equal to the number of entries in your damage array. In each array, the 1st result will apply for the first attack, the 2nd for the second, etc… I have not included any foolproofing safeguards here, so please make sure you have the number of entries in every array

By tinkering with the parameters you can customize each attack a decent amount, though we’re limited with how few little control over animations we have in Crayta (which maybe we can get changed)

You’ll likely want to adjust the hitbox triggers to make each attack feel yours.


Each attack needs to have a trigger attached to it to act as its hitbox. This trigger must be set up to trigger OnTriggerEnter() from the melee combo attack script when things enter it. It’ll check if it’s damaged them before during this current attack, and if not, it will damage them. So the hitbox is the area your weapon actually deals damage in.

For testing/debugging, I find it extremely helpful to have a voxel mesh of the same size to visualize where the trigger is and when it’s activated. This is already set up for you in the sample sword, just click the debug toggle to have them show up when you attack.

Anatomy of an Attack
  1. When you press the primary/attack button, it’ll start an Attack if you aren’t currently on cooldown from your last attack.

  2. When started, the attack will change the player to its grip and will play its Attack Sound and its animation (at the speed you set in attackspeedmultiplier) right away. If you have lock movement set to true, it will also take control away here.

  3. Two timers start simultaneously.

  • After the launch wait, it will launch your character based on the values set in the attack’s launcher.

  • After the Active Delay the trigger and weapon trail will activate (using the weapon trail holder, an empty effect entity). If you have debug enabled, the hitbox will display here.
    These stay active during the Active Time.
    After that time, the trigger and weapon trail (and hitbox) turn off.

  1. Then we wait for the Recovery Time, before control is returned to the player (if you don’t have input lock set to true, recovery time should likely be set to zero).

  2. The attack is now over, so we change to the grip for the next attack and the cooldown timer begins. After this point the player can attack again, bringing us back to 1).

But if they don’t…

  1. Once the cooldown is reached, after a time equal to the link time, if the player still hasn’t attacked again, the combo will reset back to the 1st attack.

  2. After the relax time, if the player doesn’t attack, the character’s animation will change to the relaxed grip.

Please let me know if you have any questions, bug reports, or feature requests!

1 Like