Hello all! I hope everyone is doing well :)

I have been working on setting up a battle system for a game development project.

How I would like it to work:
- At the beginning of Battle, each enemy queues up an ability.
- Each ability has a Prep Time value associated with it, indicating how many turns the player takes before the enemy takes their turn and use the ability they queued.
- Player takes turns with 3 different characters. Each turn decreases all enemy's Prep Time by one. If a player has been used, it can't be used again until all party members have been used that 'Round'.
- After every player's turn, if there are any enemies with a Prep Time of 0, those enemies take their turn, use the ability they have queued, and then queues up a new ability, which applies a new Prep Time value.

So far I have been able to set up a Phase battle system that handles player's turns being taken and decreasing the Enemy Prep Time, then ending the phase if any are at 0.

My questions:
How can I have an enemy queue an ability for their next turn?
Once the ability is queued, how can I read the Ability Variable "prep_time" I have added to the abilities and change the Status Value of the enemy?


The other challenge I have, currently when an Enemy reaches 0 prep time, the player phase ends so the enemy phase can go. I want to be able to save a list of the players who haven't been chosen yet for that round. That way, when the enemies have gone their turns, the player phase starts with only those who were still available last round. I am not even sure where to start with this, besides somehow creating a list of data and at the player's turn start schematic, checking if the player is on that list, and if not, ending the turn. How do I create a list of data that can keep track of this?

Thank you for your help in advanced!
  • edited December 2022
    Hi, the expert is on holiday vacation.

    Battle AIs do have a queue functionality built in but I've not had the need to understand it yet for my use-cases so I'm unsure if using that queue suits your purposes. Like is the queue meant more for realtime/action or will it queue for next turn in turn/phase based, I don't know.

    The battle AI settings on a combatant (or in combatant general settings) have a Use Mode that is either First available or Queue.

    Also in a Battle AI itself in Battles --> Battle AI in an action node (like use ability node) it will have options for Action Use Mode "Insert Queue" and "Queue"

    On variables/lists;

    There are "Object Variables" that are an instance of a variable for each combatant game object. So like a private (local) variable for each combatant you can access in schematics and some places in the editor.
    Go to Combatants --> Combatants --> General Settings --> check the box Use Object Variables.

    So like you could have the system Automatically put a "prepTime" INT variable on every combatatant, or a "canUse" boolean or whatever.

    For Global variables, a simple way to make a global List would be in your Battle Start schematic or even Start Game/Menu schematic you can just use a node "Change Variables" --> Add Variable --> Variable Origin "Global List" --> "Variable key" will be the name of the list. Then you can use the "change type" to add/remove from the list and you can access the list with schematic nodes using the index of it, do checks against the index count, etc.

    I guess my point there is that using Change Variable Node actually will declare/instantiate a new variable list, which confused me because it is named "Change" so I thought I had to declare them somewhere else lol.

    Battle AI also have a "Check Variables" node available.

    Edit;
    Another random thought is that there are ability settings for like Delay, Cast time, Re-use time and stuff I think will work based on Turns? Also abilities can override Action costs to use their own amount of action points for Phase battles. Not sure if any of those would help but sometimes simpler to use built in system rather than variables and logic.



    Post edited by GeneralK on
  • Hello @GeneralK,

    Thank you for the response! I'll look more into how Battle AIs work for Queuing moves, I think the main problem I have is having a schematic read the move that I have queued next to set the Prep Time based on the Ability Variable.

    How do you access Ability Variables/Object Variables/Global List in a schematic?

    For the Global Variables, I have the Change Variables Node set up to create a Global list. I am unsure how to add the Players to this list using the "change type" you referenced. And then how to I do checks against this list?

    Thanks again for your support!
  • edited December 2022
    I don't see a Queued action node in schematics, Battle AI has "Queued Action" and
    "Queued Action Count" node.

    Battle AI is going to fire every turn on every combatant that has it, you can have a condition on the Battle AI that it will only use that Battle AI if Prep Time variable is less than 1.

    Then you could in the player ability animation schematic set the Prep Time variable of the Target (starting object). So at the time the player uses abil you are incrementing or setting the enemy variables.

    I'm not certain I'm understanding your use of Ability variable, you're using it like a constant right? So like just going to use it to set an enemy combatant count down.

    Or if you reversed it and count up with prep time as a resource the enemy uses, could use the built in ability Use Cost. Battle AI would try and use the abils but wouldn't be able to until the resource was high enough. Then player abilities would grant that resource to enemies.

    Anyways in schematics when you click the green + add node you can search in it. That is a good friend. Some variable nodes are

    Variable List Contains
    Change Variables
    Variable Fork
    Check Variables

    When you say list of Players, I'm not sure if you mean having the combatants or game objects in a list.

    I was more referring to you have a list of integers, list of strings.

    So the how to do checks depends on what it's being used for and what data type is in the list.

    When I said "change type" I meant "List Change" to add, insert, remove from the list.

    Screenshot of Battle AI "Check object variables" so it's doing an IF logic check right, target Self, if preptime is less than 0, success node use an ability.

    But object variables can be used in lots of ways, as flags or counters, checked in schematics too.

    Also screenshot using string list to see if a button should be displayed on the level menu for player to port to. So if the player has not unlocked that level it won't even show the button in the menu. But that's hard coding the list for a static thing.

    https://imgur.com/a/4m1xxQW
    Post edited by GeneralK on
  • edited December 2022
    Sorry I'm at work messing around oops.

    I read your post again trying to understand better.

    To your specific question "how can I read the Ability Variable "prep_time" I have added to the abilities and change the Status Value of the enemy?" and how to access ability variables.

    To change a status value to a variable you can use schematic node "Change Status Value" and then where it says Value change that to Value --> Variable and put the key in (name of ability variable key). Depending where the schematic is called from would effect the object selection. If you read the tooltip on where you select the schematic it should say something like "Target is Starting Object" "User is Machine Object" stuff like that so you are changing the correct combatants status value.

    https://imgur.com/a/zpzaJIg
    Oops the screenshot shows ADD for the operator, you would probably have that to Set instead.
    Obviously status value None would be changed to whatever status value name you have set up you're trying to change.


    Also screenshot of setting variable to another variable

    https://imgur.com/a/NTUpFTx
    Post edited by GeneralK on
  • @GeneralK

    Yes, each ability needs to have a constant prep_time, which I have set up as an Ability Variable.

    e.g.
    Bite - prep_time=2
    Claw - prep_time=1
    Pounce - prep_time=3

    I am not sure how to read this ability variable in a schematic or Battle AI, but I think your direction will get me there!

    I almost have figured out the player turn stuff by using a Status Value to track if the Player is available to use.
  • @GeneralK, Thank you again for your support!

    I am running into a roadblock with this: I am trying to change a Status Value based on an Ability Variable (Constant Integer value set in the Makinom editor for each ability) for a queued ability.

    - In Battle AI, I can queue an ability, but I cant put that queued ability into Selected Data, and there is no Change Status Value node in the Battle AI node list.
    - In a Turn End schematic, there is no Queue Nodes to read the queued ability and change the status value.

    Is there another way to do this that I am not thinking of, or does this functionality need to be added by @gamingislove for that to be achievable?
  • Hmm ok so you could use a variable instead since Battle AI have Change Variable node, Object Variables can be per combatant like a Status Value is.

    Or you could use the ability schematic to change Status Value when the ability is used instead of in the Battle AI that used it.
    Like the schematic for animating the ability or as a Target Change you can choose schematic instead of Status Value.
  • @GeneralK Thank you for the suggestions! This still leaves me with the dilemma that I cannot access the Ability Variable for queued abilities in a schematic.

    It looks like the queue ability node also does not allow using selected data, and it does not allow putting the ability queued into selected data. So I am sorta stuck on either side.

    Another question, how do I access the Ability variable?
    If I put an ability with an ability-variable "ability_variable" in Selected Data and name the selected data "ability", would I then do something like ability.ability_variable?
    Does that make sense?
  • edited January 2023
    Maybe instead of queuing the ability in Battle AI, use a Variable Fork in the Battle AI, that checks an object variable string on the combatant, that could be set at the same time the prep_time is set.

    So then it's like check canUse == true then variable fork if string == bite then use ability node bite, if string == claw then use ability node claw.

    Sorry I don't have an answer on the ability variables.

    If you are just using them as a constant and do not need an ability variable instance per combatant, you could make global integer variables instead.

    It sounds like can only access ability variables at the time of Use?
    These make me think it's only used in schematics triggered by the ability/item?:

    "Use 'local' variable origin to change variables on the ability instance."

    and tooltip

    "Ability variables are attached to the individual abilities of combatants/items.
    Used in schematics and formulas by using the 'Selected' variable Origin if they are set as selected data.

    "Schematics of this ability automatically set the ability as (local) selected data with the key 'action' "









    Post edited by GeneralK on
Sign In or Register to comment.