0 votes
by (220 points)
edited by
This would include encounter initiation, hp changes for the player, allies, and enemys(damage, mana usage, and recovery), boosts both permanent and temporary, from items(hp, mp, etc.) in combat, as well as skill stat influences(like $Str stat influencing attack score) with the battles flow, winning sequence(Rewards like exp, gold, items, etc.), and the player choosing what the allies do(Items, Special moves, Guard, Regular attacks, etc.) on ther turn(if they have any allies equiped in there party). Also returning to the "map" or place they were before the encounter(unless defeated of course).

Btw this will be a turn based game with the addition of having two or three allies to back up the player later on. also there is no particular death sceen when the player reaches 0 hp, rather the player falls uncontious and wakes up in a tavern bedroom, allies dont die for good either(similar to the player).

Us any name you want for the player, and us a Dark Elf or any other fantasy creature as the monster in your example to make it easier to understand please, and thank you. also i will specify anything if need be if you dont understand what exactly im asking for.

1 Answer

0 votes
by (44.7k points)

There are an infinite number of ways to implement such a system, and because it involves so many details, developing such a thing will likely be a large percentage of the time you spend creating the game.

I'd recommend Googling "JavaScript RPG battle system" or similar things, and look for articles and sample code on the topic.  For example, "I built a role playing game in JavaScript. You can, too. Here’s how," could help, and since you're developing in Twine with SugarCube, you won't need to worry about the "Saving your game’s state" section.  It also includes some simple sample code, so you can use that as a starting point.

I'd recommend doing some research to make sure you understand the basic concepts for how RPG systems work, then plan out how you want your particular combat system to work, then do more research to look for similar systems which you can use ideas or code from to help develop your own RPG engine.  Once you've done that, then you're ready to start coding.

So, this isn't something that could be explained in a reply here, you have to work a lot out yourself first.  Once you get down to the specifics, such as "how do I make X do Y?" then you can come back and ask those questions and they'll be something we can answer here.

Hope that helps!  :-)