Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by TruthsEdge · Feb 13, 2017 at 12:13 PM · scripting problemrpgturn-basedactionstrategy

Making in turn-based rpg in which characters can take turn ahead of time

I am current working on a strategy turn-based rpg (Ala Final Fantasy Tactics) and I would like to implement a system in which players (and enemies) can spend "Action Points" to take more than one turn at once. (Similar to Bravely Default) However, I am having trouble wrapping my head around the logic. Characters start with a set amount of AP and gain 1 AP every turn. Movement does not take AP only actions like attacking and using items. Strong abilities require more AP to use. If the character has negative AP then their turn is skipped. AP can be used all at once to allow the player to take the future turns in the present turn. For now lets call this Berserk mode. Berserk mode is a menu option in the battle menu. Activating it costs 1 AP and will cause another battle menu to be queued behind the active battle menu. Berserk mode can be activated a maximum of 3 times.


For example:

 Player`s Turn***
 Hero 1 (Arthur) has 4 out of 4 AP.  
 
 Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
 
 Arthur MOVES 3 spaces.
 
 Arthur ATTACKS Enemy A with a sword (-1 AP)
 
 Arthur has 3 out of 4 AP.


    Enemy`s Turn***
     
     Enemy A has 4 out of 4 AP.
     
     Enemy A's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
     
     Enemy A activates BERSERK MODE (-1 AP)
     
     Enemy A's Turn (MOVE/ATTACK/ITEM/BERSERK MODE*/END TURN)?
     
     Enemy A MOVES 3 spaces.
     
     Enemy A ATTACKS Arthur with a bow (-1 AP)
     
     BERESERK MODE TURN*
     
     Enemy A's Turn (MOVE/ATTACK/ITEM/BERSERK MODE*/END TURN) 
   "Can't move again unless a special ability is activated"
     
     Enemy A ATTACKS Arthur with a bow (-1 AP)
     
     Enemy A has 1 out of 4 AP


 Player`s Turn *** (Heroes +1 AP)
 
 Arthur has 4 out of 4 AP
 
 Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
 
 Arthur activates BERSERK MODE* (-1 AP)
 
 Arthur activates BERSERK MODE** (-1 AP)
 
 Arthur activates BERSERK MODE*** (-1 AP)
 
 Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)? "Used Berserk Mode 3 times already"
 
 Arthur moves 3 Spaces
 
 Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
 
 Arthur uses STRENGTH POTION (-1 AP)
 
 BERESERK MODE TURN*
 
 Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
 
 Arthur ATTACKS Enemy A with a Sword (-1 AP)
 
 BERESERK MODE TURN**
 
 Arthur ATTACKS Enemy A with a FIREBALL (-1 AP)
 
 BERESERK MODE TURN***
 
 Arthur ATTACKS Enemy A with a SPECIAL ATTACK (-2 AP)
 
 Arthur has -4 AP out of 4


 Enemy`s Turn *** (Enemies +1 AP)
 Enemy A`s Turn
 ***REPEAT OF LAST TIME***



 Player`s Turn *** (Heroes +1 AP)
 Arthur has -3 of 4 AP
 Arthur has < 0 AP ** SKIPS TURN



 Enemy`s Turn***
 .............And so on.

What I am having trouble with is deciding how and where to implement this AP/Bereserk Mode. Right now I have turn order based on a characters speed stat. Characters can move, attack, and end turn. At the end of a characters turn they can select what direction they want to face.

What I believe I can do is: ** All in Csharp

Create an AP variable in the Character class

 public int AP = 4;

In the Turn class check current characters AP

 (if AP > 0){ CanTakeTurn = true;}

Then in the Action class check what actions are being taken, add and subtract character`s AP accordingly and override end turn method if necessary.

public int BerserkModeCounter = 0;

public void Attack(){

if(BerserkModeActive = true){ DealDamage(); CanTakeTurn = true; //Run the Turn method again? } else DealDamage(); EndTurn(); // CanTakeTurn = false; }

public void BerserkMode(){

AP - 1; BerserkModeCounter + 1;

if(BerserkModeCounter > 0){ BerserkModeActive = true; }

if(BerserkModeCounter >= 3){ BerserkModeMenuOption = disabled;} }

Am I on the right track? Because if feel like I am missing something. I haven`t begun to test this yet because I do not really know how to approach this properly. Maybe my Turn class is to rigid for this.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Kossuranta · Feb 13, 2017 at 12:43 PM 0
Share

I would just let player queue actions when CanTakeTurn is true until players "accepts" (somewhat similar idea as VATS in Fallout 3). After accepting all queued attacks will happen and your turn ends. I think it should work just fine with both traditional turn-based and active time battle systems.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

When moving a character on a grid, how do I animate it? 1 Answer

Multiplayer battles on iOS 0 Answers

Turn-based strategy game 2 Answers

How can I pause one object's Update() until another class has performed its task? 2 Answers

Creating an Interactable Grid for Tactics Game (C#) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges