Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

JRPG-like combat system in Twine 2

I've been making a JRPG-like combat system. I previously tried doing it in Twine 1.4, but I had trouble figuring out Macros. I strung together some of the currently implemented features into a narrative:

https://grippli.neocities.org/rpg combat.html

I'm at a point where in order to add new features, I need to decide what stats combatants will have and what those stats do. Currently they just have Attack Power and Hit Points. One monster also has a non-zero Magic stat for testing purposes.

I also need to clean up the existing code and make things more visually appealing. My priorities right now are putting variables into namespaces and giving messageboxes some kind of visible box. I also plan to bring target selection into the main combat Passage, probably merging it with the status screen. I figure I'll need to read up on CSS and JavaScript modules.

All in all an interesting learning exercise.

Comments

  • This is great! I've seen a similar example, but it didn't allow for multiple enemies. Just wondering, how were you able to do that? Using an array?
  • @Rooster
    In case you don't know, if you want you can look at the code used in this linked story to determine how it was implements.

    1. Use your web-browser's Save As feature to save a copy of the linked HTML file on your local hard-drive.

    2. Open the Twine 2 application and use it's Import From File option to add the contents of the local HTML file to your Stories list.

    3. Open the story and look at the passages and Story Javascript.
  • @greyelf oh, wow! I did not know that. Thanks for the tip, I will try that.
  • hm..whenever I try to import the file into Twine I get the error message:
    "An error occurred while trying to import this file. (Cannot read property 'value' of undefined)"
  • Are you using the latest version of Twine 2?

    I tested that it worked before posting my previous message.
  • @greyelf
    Ah, it seems like I am not. I'm on Twine 2.0.8, and it looks like 2.0.11 is the latest. I'll update before tying again, thanks for the help :) I think I have an idea for how to do it, so I will try it on my own anyway for the moment. Worried that if I update it may break some of my existing code :).
  • Rooster wrote: »
    Worried that if I update it may break some of my existing code :).
    You don't need to upgrade, just use the on-line version of Twine 2 accessible via the link on the main page to view the source of this story.

    I personally run both Twine 1 and 2, both the download-able releases (installable and web-browser based) as well as the on-line release of Twine 2. It is the only way I can test/debug every answer I give in a similur enviroment to the one the person asking the question is using. LOL
  • good point! I'm actually about to do that now, ha ha. I couldn't exactly get it how I wanted (dyanmic attack list I could adjust during the course of the game without having to hard code everything) so I am going to take a look and see if @guy231 solved that problem.
  • Ok, this is a way different approach and beyond my current knowledge, lol. It looks like it is all javascript that is injected into the twine passages, and I am not sure how exactly he is doing it...guess I'll just try and hack it or hardcode it :neutral:
Sign In or Register to comment.