How do I do the Turn based rpg time style

0 favourites
  • 11 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • I am having trouble with figuring out a transition from four player attacking variable to have their own attacking time in order of A B C D.

    And i do not know how to get the four player to act separately instead of all at once and I am having trouble with reset the one variable after they have finished attacking. Im guessing my idea lies in The wait by signal but I do not know how to use them properly ?

    And the tutorials that i have found only does for One player not multiple player to be controlling. Any ideas on how to do this part oh and im trying to use families here so that I do not have to recode too much during the battle turn based scene if need to i can submit a capx I have to warn you my code looks like a pile of mess lol

  • Do you have a unique set of events for each player or?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess I don't have the specific answer to your individual problems, but I think the problem lies in your system anyways. You need to look up a little bit of what a state machine is. I'd actually recommend pulling out some paper and a pencil and draw a flow chart for how your battle system should work. Take things like speed (attack order), secondary attacks, multi-turn attacks, and specials into account.

    So it should start with if the battle is one or off, of course. Please don't use booleans for this, though. Use numbers to increase your flexibility (like if you want global changes later).

    Battle = 1.

    Then you need to decide whose turn is next. If you're using an ATB (active time battle) system then you would let players choose attacks once their bar is full (a state) then add them to a queue (probably an array) of attacks. If you're doing it true turn-based, then skip the ready bar and put everybody in an attack order/ready queue. If you're doing it speed-based, re-order the list by player speed every turn (in case you use abilities that increase or decrease speed). I don't know if you're doing all the good guys go and then all the enemies go or if it's more organic, but if you're doing it one side then then the other, use two lists and a state to switch between them.

    Then, you can use the coordinates in your list to decide clearly mark who is attacking and who is not. You should have something like 'is attacking" for all of your players and turn that off at the end of a character's turn. When their turn is started (probably called with a function), turn their attacking condition on so you can do necessary UI changes and then each attack is a function. The parameters should be the target, damage, modifiers, etc. You should also include which character is performing the function/attack so you can use the same code for multiple characters.

    It's really complex, but plan it all out on paper exactly how things will work, keeping functions, arrays, possibly the dictionary object all in mind. Then, it's much easier to wrap your head around how to set up your state machine so it can run itself based on your values in battles.

  • C-7 I guess ill do flow chart once i expand past the experimental to see if my code works before expanding into crazy amount of detail ATM my flow chart is like this

    Player select attack ---->target enemy----->Attacking variable=2---->is all player select attack variable=2--->Its right here where i get lost because I do want a attack order/ready queue and then proceed attack in order---->damage enemy--->is all player finish attacking enemy---->enemy turn. Just like that is what my experimental code order is.

    "put everybody in an attack order/ready queue" Hmmmm how would one would do that because ive already got a variable called attacking=2 for the selected action to attack oh and btw i did get the UID of enemy selected for player to attack how would i get the player to just attack that UID is there a special code for that?

  • Gearworkdragon I would store the X/Y position of the enemy in something like target variables. Then you can do attacks toward that position and not worry about picking. It's gonna take a lot of testing, debugging, and stepping through to make sure all of your logic flows correctly, but you should end up with a nice system at the end if you follow it through!

  • C-7 ok so i figure out what you were saying was to use a que a global number variable and had each character action to Add one to it and had the character themselves to have a que counter so that each character represent a number within the Que,

    Ok now for the confusing as heck. I cannot get the event to behave, So i figure that using a pick method comparsion between the Que counter and the Que global number and have the action do its thing and subtract one from it so that its goes onto the que. Now my problem is that i can either get the code to do it only one time and not move on to the next Que or I can get the code to move on the next que but no action will happen

    I know i sound confusing

    Heres the code

    (Pick Family "character" by evalutating playerQue=Character.playerqcounter) (pick Monster by evaluating character.target=monsterUID)

    (And then a sub condtion Action="attack)With action (subtract Ppower from hp) and (substract 1 from Playerque)

    Again this code will either run once and will not go onto the next que number which is three. Or i can get the code to finish the counter but no action attack will happen. Im at lost to why it doesnt like me

    I've tried to force the loop four time still refuse to do the next que im at lost did i miss something ?

  • never mind i found out that somewhere in my other code the action "attack" isnt being put onto the other three character which would explain why i am having so much trobule now i have a new problem that families isnt picking them out to put the action "attack" on past the first one. Ugh fix one code it break 20 others lol

  • C-7 Could you take a look at my capx apparently I cannot figure out why my "action" "Attack" will not work on the next character I even listed the group bookmarked and commented where the problem is If you will play it i suggest debug menu to see it in action. I am pulling my hair out at this point I tried everything i could think of. And the reason to why I am not using X or Y is because I wish the family to behave in a way where all i got to do is just add stats and animation and not have to worry about re coding for every stupid new monster I can imagine that would run into duplicate of events in the thousands lol I think its my picking instance event apparently even overlapping wont do it

    https://www.dropbox.com/s/1sx9etxq3fqqvec/Rpgbattlespritetest.capx?dl=1 (This will auto-download just click one time)

  • I took a quick look into your project.

    A few "critics".

    First, why using groups instead of function ? I guess the tutorials and first files you found out were quite old and still using this system.

    Replacing "one-time" actions like selecting the selection phase in which the player is (selecting the correct character, then selecting its action, etc...) could work with function.

    In your current capx, the group "PhaseTwo" is activated on start as well, which kind of does bug it up a bit.

    Yet this is not the complete solution.

    It is hard to dive deeply into a 61 events capx with only a few minutes to spare I'm afraid.

    To give you ideas, I had made a tutorial on how to make a multiplayer turn-based board game. The idea is to separate each player's actions as much as possible.

    Perhaps you could find some inspiration in there as well.

  • well the groups systems so that i could turn off the events from triggering. And while i love to use function Its just really confusing on how to do it right. In the past i would have it down but only to realized that because i would have different effects that i would need and even having different sprite I don't think I can make use of function as effective as a Group event. and I feel like group event allow me to see where my bug or problem is at.

    Another concept I am trying to explore here is that let say someone down the line maybe me or a friend or some troll on the internet wants to have a party consist only four character and you have 50 character to choose from as well as their class stat character stat personal stats. Id like to start to explore that possiblility.

    The idea behind my concept is that what if I can use family and overlapping effect to reduce the code for such system so that all I or the person would have to do is just to link the Stats page for each "Active" character and enemy

    And the problem is its very easy to do single character turn base rather then multiple character. Currently there is no tutorial for that at all. I did take a look at your example its kinda a weird concept but you are only running one character per turn. Unless if you mean to tell me to do Four single turn base which is what I am not wanting to create. Kyatric

    and the idea here is that If i can make it work in multiple character then Ill release it in the tutorial for a more advance rpg turn based.

    If you can see where I can use function to further reduce the amount of line of code or cleaning up bug possibilities event then please do so because I cannot seem to grasp. Although one thing I never tried was doing function with a function. Is that possible ? or is that too much ?

    Update 10/26/2015: ok so i recently tried to do an event for the four character individual yes that mean four event for each UID. Contruct 2 engine Refuse I mean REFUSE to do the next character now. And i even use set text to see which group was active......and it working perfectly as far as setting group up n shit and the Event runs once but when i switch to the next group with the similar event It refuse to go further. ? is it because the pick instance is stuck on the first picked and doesn't know to pick the next one? If so that might be my main problem and i do not know what events i should use to fix that

  • Kyatric you were right about the group Phase two being on active on start and i used some of yours and two others examples to make it work and I figure out that my main problem was that I had the group on toggling wrongly activating and two I had to use set text to figure out which group was working and what was being left on and It turn out that the parent Group affected one child group to not run which threw me off. And i was able to clean up my code using your example

    Oh and I used boolean for one for selected and one for attacking stage so that my X pressed and my state machine would correctly flow better

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