Issue w/ Turn-Based RPG

0 favourites
  • 7 posts
From the Asset Store
Create your own wss server and ws server with ssl and without ssl.
  • I am new to programming in general and, by definition, to Construct as well. I am attempting to use Construct to build a prototype of a turn-based, 2D RPG. Made some progress but am running into a wall that I hope this forum can help with.

    The combat is essentially a row of static monsters faced off against a row of static player characters. Each character (player or enemy) takes a turn in 'rounds'. At the completion of each round, the process starts over (quite original, I know...).

    I am using an array to store data for each PC and enemy. For example: arrayPC1. I am now attempting to figure out how to construct an attack function that can be reused everywhere (seems pretty important for an RPG). The problem I am having is that I can't predict which 'slot' a character will choose to attack. So PC1 might decide to attack Enemy1, 2, or 3 and the correct array would need to referenced in the function in any of those cases. Here is a visual example to try and help explain:

    <img src="http://i44.tinypic.com/fy34mg.jpg" border="0" />

    So, how do I tell the function which of these slots to pull data from when it is calculating an attack?

    Thanks in advance for helping out a noob...

  • Sounds like you are making things more complicated than they need to be.

    You would be better using instance variables to achieve this...

    Someone may post an example capx using an array, but you would be better knowing what the events are doing rather than just bolting someone else's work into your project...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Wouldn't using instanced variables still have the same issue? How will the function know which character to pull the data from?

  • I'm trying to discover how to do this too. If someone knows the answer, please, share with us!

  • Just like an rpg, you can't go attack a level 10 boss if you're at level 1.

    As Pixel perfick said instance variables would be a start, but you need to understand picking first.

    Keyword instance.

    Also why do you need a function?

  • Thanks for the tip!

    I searched about picking and turn-based mechanics and realized I was understanding UID wrong. I thought each object had its own UID "series", like enemy0, enemy1, enemy2 and protagonist0, protagonist1, protagonist2...

    Now everything works properly!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)