Making A Turn Based Combat System

So this is a topic on how to make a turn based RPG game. If you don’t know what a turn based RPG is, think Pokémon.


How To Make The Turn Based Parts:
Variables are helpful in turn based because you can set variables to all the different characteristics of your battle(for example a specific move you can use). If you want to make the core turn based part though it is pretty simple. Use a check Once Block and the check if Turn(a variable)=1 (Turn 1 is your turn and Turn 2 is your opponent’s) you can put this inside a when tapped block. For complete reference to Pokémon, When Ember(a move) is tapped Check once if turn=1. Then put whatever you want inside the check Once block. If it was an attack that took away the enemies HP it could be something like this:
When Ember Is Tapped
Check Once If Turn=1
[Increase Boss HP by -2]
You can do this both ways with the enemy and with yourself.

How To Make A Move That Acts Like Defense System:
This is where it takes a little bit of thought to figure out how to do this because think normally you can’t do this with variables. Or at least 100% accurate. You can make it 99.99% accurate, but using variables it won’t always work. I will show you why. Let’s say whenever you use the move “Defend” a shield pops up. And you want the shield to stay through to the enemies Turn and back to yours. With variables you have to keep repeating to check when your opponent’s turn ends. You have to use repeat and wait Blocks, which means that if under a certain period of time “X”(x would be how much time you put I the wait Block" and it would just keep repeating. Of course, you can’t use repeat forever because hen that conditional can’t do anything else which is bad. Using one conditional makes this easier because setting a variable and then checking for it won’t work properly because it is in the same conditional. So, you have to use a combination of check Once If that check when the variable switches:

Check Once If Turn=1
[Check Once If Turn=2
[Check Once If Turn=1
[Set Invisibility 100%]]]
Since it can’t repeat forever, it has to keep switching between turns. And it has to get through Turn 2 again before it can get back to turn 1, when it disappears.


I know this was me kind of talking about how to make this but a I hope somebody read all of it and now understands how to make one of these games.
https://c.gethopscotch.com/p/z3uep4c30
@/POMTL

39 Likes

I have gotten ten likes on this yet no replies. Does anyone have any questions?

2 Likes

Well that wouldn’t be in an RPG

1 Like

Hi @HopscotchRemixer

Thank you for sharing :grinning:

The project link doesn’t work for me. Could you give the username & title to search for?

1 Like

There’s one part you might think a bit more about though. Regarding the defense shield & using variables, you said:

it won’t always work. I will show you why. Let’s say whenever you use the move “Defend” a shield pops up. And you want the shield to stay through to the enemies Turn and back to yours. With variables you have to keep repeating to check when your opponent’s turn ends.

This can be done elegantly and 100% accurately using variables (without continually checking & without waits). Give it some thought how you might do this by using conditional When rules…

1 Like

Oh sorry…you must have misunderstood me…I only wanted to use 1 conditional. I don’t know why the link doesn’t work for you…it worked for me…

I might be over thinking it. Either way I still think it is easier my way…I don’t know you are way better than me.

I see both of your points. Final fantasy is what came to mind for me as well when you mentioned “distance” before. However, strictly speaking, the damage isn’t based on distance but rather it’s likely a simple multiplier dependent on the row of the attacker.

Either way, a turned based combat game would be cool on Hoscotch.


@HopscotchRemixer What username & title is your project (linked above) published under? I’d like to check it out. After one of the recent Hopscotch updates, forum links to projects quit working.

2 Likes

Oh sorry I have never played Final Fantasy…

1 Like

OfficialHopscotchRemixer
Beta Testers Only!
I will repost it…


@ThinBuffalo I reposted it.

Looks great so far! I’m looking forward to seeing how it develops :+1:

3 Likes

@BlastFusion he here is some of my more advanced experience with variables! Even ThinBuffalo complimented me about it!

1 Like

The code I have done is super complex. I can’t even explain it. I can send you a copy of the project when I complete the battling.

Thanks for sharing.

Ok I can check it over then.

1 Like

Why was I tagged here? Did someone edit the top post?

1 Like

Yeah same, I just got tagged for a 2 year old topic.

1 Like

That’s weird, it says I editted the topic, although the edit wasn’t shown. I remember viewing this topic yesterday, but I don’t remember editing it…

This is a very good tutorial!

1 Like

I will update this with new Markup/HTML