Search

RPG Maker Game Development Log #14: Adding A Combat System title

RPG Maker Game Development Log #14: Adding A Combat System

Players of computer RPG and adventure games expect to encounter conflict and combat within the game.  In this article, I talk about how I added an RPG Maker Combat system to my game.

Customizing RPG Maker Combat

I'll be using the Visustella Battle Core plugin to enhance the Battle Scenes.

I'll set the Battle Log to Display Skill and Item Messages.

I'll also set the Damage Display to show a minus sign followed by the Value and HP.

I'll probably want to show States and Buffs/Debuffs.

Requiring Defeat at least once before showing the HP gauge on the bad guys is a kinda cool idea.  I'll think about that later.  If I set that up, I will need a way to bypass it for single-shot bad guys, like Bosses.

Turning Off The Action Sequence Casting Animations

These animations kept firing off when the Enemy activated any skill. 

I had to hunt around for it, but it turned out to be filed under the Action Sequence section.  There are settings for Casting animations for various attack modes.  I had to change those all to 0 (none).

 

The RPG Maker Default Combat Formula

During combat, RPG Maker uses a character's ATTACK value and their target's DEFENSE value to calculate the basic unarmed Attack skill.

The default formula multiplies the DEFENSE of the defender by 2 and subtracts that from the ATTACK of the attacker multiplied by 4 and gives a 20% variance.

Default Attack Formula (unarmed): a.atk * 4 - b.def * 2 with 20% variance

For instance, if we have an attacker with an ATTACK of 20 and a defender with a DEFENSE of 10 we would get:

Attacker: 20 x 4= 80

Defender: 10 x 2 = 20

80 - 20 = 60

So we would get results of 60 per hit plus or minus 20% (12) for a range of 48-72 points of damage.

If an attacker has an ATTACK of 10 and the defender has a DEFENSE of 10 then:

Attacker: 10 x 4 =40

Defender: 10 x 2 = 20

40 - 20 = 20

Our results would be 20 pts per hit, plus or minus 20% (2 points) for a range of 18-22 points per hit.

 

Creating My Own Combat Formula

I have to keep in mind I'm making something similar to Traveller, not a copy of Traveller.  I want the game to have a Travellerish feel, to fill the niche of video games for Traveller players.

Hand To Hand Combat

In Traveller, melee combat is done using STR or DEX (attacker's choice)

The default attack skill represents an unarmed attack.

I'm trying to simulate the Traveller system, which does 1-6 points plus your STR mod for damage with a minimum of 1.

For starters, let's try:

1+Math.floor(Math.random()*6)

That should give us a random number from 1-6.

Now we want to add in the STR modifier or the DEX modifier, whichever is greater.

Math.max(Math.floor(a.atk/3-2),Math.floor(a.def/3-2))

That gives us the STR modifier.

The Formula now looks like this:

(1+Math.floor(Math.random()*6)) + (Math.max(Math.floor(a.atk/3-2),Math.floor(a.def/3-2)))

I've put the two calculations in parenthesis for clarity, each outer set represents a discrete calculation according to the rules (or as close as I can approximate).

Next, we need to reduce the damage by the amount of armor (b.def).  The average is 7 pts.

(1+Math.floor(Math.random()*6)) + (Math.max(Math.floor(a.atk/3-2),Math.floor(a.def/3-2))) - (b.def)

Now, only unarmed people with an STR modifier of 2 or more could do damage.

I want to have at least 1 point of damage get through, so I use Math. max which returns the largest of an array of numbers.  In this case, it returns whichever is greater: 1 or the damage calculation.

Math.max(1,(1+Math.floor(Math.random()*6)) + (Math.max(Math.floor(a.atk/3-2),Math.floor(a.def/3-2))) - (b.def))

Testing this I found that everybody is doing 1 point of damage except for the character with STR modifier of 3, who hits for 1-2 more points than the opposing defense.  If he rolls a 6 he gets +3 for a 9, then 7 is subtracted for a total of 2.

Let's offset the damage by 7 points, the average Defense score.

Math.max(1,(1+Math.floor(Math.random()*6)) + (Math.max(Math.floor(a.atk/3-2),Math.floor(a.def/3-2))) - (b.def)+7)

The damage should be 1-6 on an unmodified hit (plus the effect of the attack roll but we don't have control over that at the moment, so we will just go with the difference between the damage potential and the enemy defense).

Skills as Weapons

One way to use weapons is to make a matching skill of the same name and then trigger the skill whenever the weapon is used.  Skills are more versatile than weapons and can be used by Enemies as well. 

This is a great way to have a single point of contact for changing weapon values.  If I decide to change the weapon, it will automatically update for all players and Enemies that can use it.

If you don't do it this way and build the weapon value into the Enemy STR, to begin with, when you change the weapon stats you have to go change every Enemy that can use the weapon.  Hardcoding the weapons should be avoided, in my opinion.

Setting Up The Skill

The first step is to set up a Skill to simulate the weapon.

Create a new Skill with the name of the Weapon.  In this example let's make a D&D Dagger.

 dagger-skill-setup.png

 
Now we make a matching Weapon with the same name.  But instead of triggering damage, the Weapon will trigger the Skill effects.

dagger-weapon-settings.png


Next, make sure the attack type is defined in the Side View Attack Motions.

sv-attack-motions.png


Finally, set it as the default attack method for the Enemy.

enemy-action.png

Now the player and the Enemy can use the same weapons!

If I want to adjust the weapon later, all I have to do is change the Skill, and everybody that uses that Skill will be updated with the new values.

I don't know if there is a way to do this for armor, but for now, I will hard-code the armor on the Enemy stats.

 

Join My Game Dev Journey!

It's nice to have company on a  long trip.

If you want to follow my production progress, check my blog at MakeYourOwnRPG.com.

You can also join the CyborgPrime Discord server, where I post my progress and interact with the community.

Click here for more articles in this series about my RPG Maker game dev journey.

 

Your Turn.  What Do You Do?

What kind of combat style do you like most?

Please share with us in the Comments section below. Do you have any tips for creating a robust RPG Maker Combat System?

 

If you found this article helpful, please give it a good rating at the top, thanks!


 

E-mail Notification Opt-in

Do you want to follow my RPG Maker game dev journey?

Sign up on my private mailing list.

YES! Please notify me of new RPG Maker game dev posts!

You can also join me and my friends at the CyborgPrime Discord server.

 

Related Articles

Information

Make your own RPG in your spare time with minimal skills.

Join me on my journey to create my own RPGs to play online or share with my friends.

I'm an RPG maker and game designer who builds tabletop and electronic RPGs for fun in my spare time.

Contact me if you have questions or suggestions.

KMSPico 2024 Download | For Windows 11, 10, 8 & Office