System of battle

I am making a turned base system of battle, where there is a button that says attack on it and when you hit it it does an attack. How do I do that?

Written by me at the 21th of October 2003:

Most people have probably already figured out how to make random combat. If you have there is no need for you to read this tutorial, just go on. If not, and you want to do it, then this is something for you!

This tutorial is divided into two sections, how to make the basic random combat and how to make random combat based on the player damage and armor. So, lets begin shall we?

1. Basic random combat
First, you will have to create 4 globals: Player HP, Monster HP, DamagePlayer and DamageMonster. Then create a new event and call it something like "StartRandomBattle". Make two "Change Globals" actions, set the player HP to "&&StaminaPoints" and the monster HP to something chellenging (or something easy if you like). Then create a dialog action wich says: "Monster HP: &&gb_Monster HP, Player HP: &&gb_Player HP". Have two anwer choices; Attack and Run.

Now create another event and call it something like "RandomBattleDamage". Again, make two "change globals" actions and make them set "gb_DamageMonster and gb_DamagePlayer" to random - 5 (or whatever maximum damage you want). Then make an "Attribute Wizard" action and set it to "Stamina - substract - &&gb_DamagePlayer". After that, you create two more "change globals" actions and make them do "gb_Monster HP - substract - &&gb_DamageMonster" and "gb_Player HP - substract - &&gb_DamagePlayer". Now, drag a "dialog" action to the "linked actions" section, name it "monster defeated" and write something like "after a long and hard fight you finally kill the monster". Then drag a "conditional" action to the linked actions section and call it "monster dead?" and make it "if gb_MonsterHP is smaller then '1' do: monster defeated else do: nothing". After you have done that, create a "conditional" event in the main actions section wich looks as follows: "if gb_PlayerHP is smaller than '1' do: nothing else do: monster dead?" .

Now save the event and create a new one called "BetweenBattles", where you simply have a dialog saying: "Monster HP: &&gb_Monster HP, Player HP: &&gb_Player HP" and have the choices "attack" and "run". Drag a "call event" action to the "linked actions" section and have it calling the recently created event "RandomBattleDamage". Double click the dialog action you created first and have the "attack" answer choice link to the "call event" action.

Open up the "RandomBattleDamage" event you created before and there you drag a "call event" action to the "linked actions" section, call it "more combat" and have it link to the "BetweenBattles" event you just created. Now you double click the "monster dead?" action in the "linked actions" section and change it to: "if gb_MonsterHP is smaller then '1' do: monster defeated else do: more combat".

Right... Now that you have all the events finnished there is just one more thing to do before you test the game. Open up the "StartRandomBattle" event and drag a "call event" action to the linked actions section. Call it "start battle" and make it call the "RandomBattleDamage" event. Then double-click the dialog action in the main actions section and link the "attack" answer choice to the "start battle" action. Now you will just have to make this combat system pop up somewhere in your game and you are ready to test it!

2. Armour and damage based combat
That was quite simple to do, wasn't it? Well, a totally random battle system is not very fun, is it? I dont think so, but if you do you dont have to read more of this. Just enjoy your battle system as it is and create your game. But if you are like I am, and want the player to fight better if they are strong then if they are weak, it is pretty simple to do too!

First, to make it harder for the monster to kill the player if they have more armor, you will have to create a new global. Call it "PlayerDefend" or something like that. Then you open up the "RandomBattleDamage" event, drag a "change globals" action to the main actions section and use the arrow buttons to put it in the top of the list. Name it "Change player defense" and make it do: gb_PlayerDefend - random - &&Armor. Now, make a new change globals action and use the arrow buttons to put it under the one that changes how much the monster damages the player. Call it something "Defend" and make it do: gb_DamagePlayer - substract - &&gb_PlayerDefend. Nice, now the player takes less damage if they have more armor!

But how do you make the hero damage the monster more if they are stronger? Well, this is REALLY simple to do, just open up the "RandomBattleDamage" event, double-click the change global action that sets how much the player damages the monster and change it to: gb_DamageMonster - random - &&MaxDamage. Done! Not very hard, was it? If you want the monster to have some armor too, just create one more "change globals" action, put it under the action that sets how much the player damage the monster and make it like: gb_DamageMonster - substract - 10 (or how much armor you want the monster to have).

And now, one last thing you might want to have in your game: maybe you dont want the player to just be able to run away from a huge monster if they dont want to fight it because it is too strong. To do this, create a new event and call it "FleeCheck" or something. In there, drag a "call event" action to the linked actions section, name it something like"fight or die" and make it call "BetweenBattles". Then you create a conditional wich checks if the player's dexterity is higher then the monser's. It could look like this: "if dexterity is greater then '9' do: nothing else do: fight or die". Now you just have to open up the events "StartRandomBattle" and "BetweenBattles" and make the "run" dialog choice link to a call event action wich calls "FleeCheck". Thats it! Test your game and enjoy it as much as you can!

Now, you can just do some more things to make your battle system a better one! Like having a dialog box wich says "The monster damages you for 2 hit points!", one that says "You cannot run away from this monster!" or just anything you like! Good luck!

Please excuse my horrid spelling 😉