–Preramble–
I’m making a game. Here’s the link to my planning document: I need help with planning the lore for my story game - #3 by cooldi13
However, it is a bit long so if you need a tldr for the combat: it uses magic and sword combat. The magic is meant to be the main focus. There are 6 elements, the player can only have one.
I was thinking of ways to create the combat system (attack, block, parry, dodge). But I haven’t really scripted combat like this before so I wanted to see if my idea for the system was going to work or not.
–Background info–
Before I start, here’s some info. M1ing is just a sword swing. There is a basic 3 swing, one knockback combo. I may create some sword “magic,” or skills. They also have criticals. Next, blocking is performed by holding f. It creates a magical barrier around you, for reference:
Something like that. I was thinking of incorporating parrying by when the barrier is rising up, it deflects attacks as it rises. Then, when it rises (grows bigger) to its full size around the player, it acts as a barrier (blocking).
–My idea for how to accomplish this–
I was thinking of creating 3 values inside a player: IsDodging, IsParrying, IsBlocking, and Stunned. As you can probably guess when a player does each action, a script sets those values to true for the correct amount of time and then turns them false again. I was thinking, when an attack hits the player or parts of them, it checks to see if IsParrying is true for example. If it is, then it would cancel the attack and play the parry animations and turn the parried opponent’s “Stunned” value to true. Stunned basically just doesn’t let them attack for a short period and slows them down. That way, they can’t just repeatedly swing while being parried. This also applies for magic. When dodging, if it is a multi-stage attack, then it would still play the effects but not deal any damage, as well as adding an indicator to tell the player the dodge was successful. However, the next attack(s) would still play out. If the dodge frames are still active and if the move is a rapid move, it would keep automatically not do any damage until the dodge frames runs out. If the attack is still going after the dodge frames run out, they would have to parry or block but the attack keeps going. As for blocking, it needs to wait the parry frame time until it reaches full block. When the block is up, I was thinking of a system where the “shield” has durability, since it is a magic one. The barrier absorbs the damage of the attack but if the barrier breaks, it would act like a what other games call a “block break” this would damage the player by the damage left after the barrier but would stun the player for a second or two. This is to counteract people who abuse block. There will also be unblockable attacks that instantly breaks a block, regardless of damage. Therefore, I will also be adding a “posture” system to the block. So the block checks:
if damageRecieved > Durability or PostureRecieved > Posture then: ApplyDamage() and BlockBreak()
Of course the durability and posture heals back over time so the block remains usable. Also, hitting someone when in they are charging up their move will cancel their attack and damage them. Let me know what you think of my system, if I am managing how blocking/parrying/dodging is detected (the variables) or if my entire structure is wrong. I’m still planning this out so any advice is appreciated.