Series Links
- Part 1 – Make a Simple Game
- Part 2 – Adding Randomness
- Part 3 – Tweaks And Fixes
- Part 4 – Levelling
- Part 5 – Spells
- Part 6 – Faux AI
- Part 7 – Explorable Map
- Part 8 – Encounter Rates
- Part 9 – Items and Inventory
In this tutorial following on from the randomness, we are going to make a round of small tweaks and fixes to the game without adding too much in the way of new features. It is important to fix bugs through testing as you go along as it becomes harder to fix deeper you dive.
Tweaks
In this section, we are going to add a few small features which make the game a little bit more. In the next tutorial, we will add larger changes that require a solid foundation.
Restore or Gain Health
For now, we will put in a simple addition of 1 health. We are going to put this in the IncreaseBattleCount assignment on the victory path. In the assignment add another line where Get_Player.Health__c Add 1 this will hopefully increase the longevity of each play-through. The row you have added should look the same as below.
Display Combat Outcome
At the moment when the screen reloads it just shows current stats with the deductions. As much as it serves its purpose and works being told how much has been deducted. So as we have something that works out the three tiers of miss, hit, and critical we are going to use those formulas as the base for these.
PlayerDamageOutput
We are going to create a text formula called PlayerDamageOutput as I said I used the existing formula for damage to base this off. I have also included the formula below.
IF({!PlayerRoll} < 2, "You Miss",
IF({!PlayerRoll} > 1 && {!PlayerRoll} < 8, "You strike " + {!Get_Enemy.Name} + " for " + TEXT({!Get_Player.Attack__c}),
"You land a Critical Hit for " + TEXT({!Get_Player.Attack__c} + 2)))
EnemyDamageOutput
This is almost identical to the PlayerDamageOutput with names changed, and text changed slightly.
IF({!EnemyRoll} < 2, {!Get_Enemy.Name} + " swings at you but misses",
IF({!EnemyRoll} > 1 && {!EnemyRoll} < 8, {!Get_Enemy.Name} + " strikes you for " + TEXT({!Get_Enemy.Attack__c}),
{!Get_Enemy.Name} + " CRITICAL HIT ferociously for " + TEXT({!Get_Enemy.Attack__c} + 2)))
Updating the Assignments
Now we have created these formulas we need to create two variables PlayerOutput and EnemyOutput. Then let’s go to the AssignDamage assignment. Add two rows for each of the above variables. In the value, fields use the formulas we have just created as the values. So PlayerOutput Equals PlayerDamageOutput and EnemyOutput Equals EnemyDamageOutput.
Now, that this has been done we need to add an assignment element directly before the Battle Screen you need to add rows for PlayerOutput and EnemyOutput and set these both to blank. The reason for this is to clear the output when you have slain a monster or when you restart.
Making the Changes Visible
We have three two places we need to add the Outputs to, the first is the Battle Screen and the second is Victory Screen. Go to the battle screen and go to the display text which holds the enemy image put two spaces above and below it. Include {!EnemyOutput} at the top and {!PlayerOutput} at the bottom. Change the color of the EnemyOutput to red using the font color selector and change the PlayerOutput to Green.
Now onto the victory screen. In the display text copy and paste the whole variable and delete out the line with {!Get_Enemy.Image__c}. Save this now when you play through it will display text for the damage output on the battle screen when there is another round and on the victory screen when you slay the enemy.
Fixes
Fixing Player Vs Player
You may not have come across this but if the encounter roll you will get an unexpected event. This event is you will be put against the player data which is undesirable to get around this right after the encounter calculator include a decision which checks if the encounterRoll is 0. If this is 0 on the path for this route connect back to the encounter calculator. This will act as an auto re-roll. This will take care of this bug.
What’s Coming Next
We are going to add some more flavor to this game. There will be two follow-ons for this one where I talk about the design side which will see and one where we will add in none combat events and the end game.