• The battle AI runs until it finds an action it can use, at that point it exits. The next run will start from the beginning again. Nodes you add after an action node are for the case that this action can't be used.

    The battle AI is used whenever an AI controlled combatant is prompted by the battle system to select an action. It'll go through all battle AI added to the combatant (in order they're added) - if the battle AI didn't find any action, it'll try to use the base attack, and if that also fails (e.g. due to use costs), it'll end the turn (via a None action).
    If you're using AI behaviours/rulesets, they'll also interject, e.g. if they have battle AI going on as well, they'll be checked before the combatants battle AI.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited May 2020
    Thank you!

    Post edited by hellwalker on
  • I want a custom AI node that will select ability from the script in my ID and execute it on chosen target.

    At first I made two scripts:
    This to load custom targets
    image
    This to select ability
    image

    My thinking was that because I selected targets in previous steps, and ability in next. It should take targets from the previous node. Then i tried selecting ability and setting targets in same script. But for some reason ability always attacks random targets.

    This is AI chain:
    image

    if I just load custom targets and then select an ability from ORK's native SelectAbility Node than the target works correctly.

    What am I doing wrong? Or is there a better way to do this? Queue targets and abilities from custom AI?
  • Instead of setting the found targets, I'd recommend using the AddRange function:
    call.foundTargets.AddRange(_MasterModule.AIModule.GetAITargets(_MasterModule.AIModule.ChosenAI));

    You're changing the selected data twice in your custom select ability, although that shouldn't really affect it. My guess would be that the node doesn't find the ability based on the variable, make sure the variable has a value for an ability ID known to the combatant.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks, still testing that but new question came up.

    Let's say I want to cast an ability on several targets. (Via Code).
    So, for example in Use() command I fed a list of targets and I want calculate, add status effects etc. To Affect all these targets.

    Do any options in TargetSettings/Target Range allow me that?
    For example I used none but that seems to return empty target list in battle event?
    Should I use Group? Does the group here means the Combatant Group like all the enemies, or group as in the group of targets I sent in use command?

    My use case is bomb explosion type of thing. I want to substract health and add status effect to everyone in range of explosion.
  • edited May 2020
    The AbiltiyShortcut's Use function will filter the target list by the Target Type and use range of the ability.
    If you just want to do the calculations (i.e. no battle action), you can bypass it and call the calculation directly via the active level's use function:
    abilityShortcut.GetActiveLevel().Use(....);
    There's quite a few parameters that handle different stuff, the last 3 can pass on null if not needed :)
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you!
    I want to do actions and everything, just on my own targets. Is there a combination that works with custom selection of targets? Like the example with an explosion?
    For example Player Companions 2,3, Enemy 5,4, and Ally 2 got caught up in explosion and useability on those targets specifically?

    I had another question about character AP.
    A) What is the best way to use AP from code?
    B) How exactly does ActionBar and UsedAction bar work for Active Turn-Based mode?
    ActionBar is current points left, and UsedAction bar is total actions used in this turn?


  • You can also just create an action and set the targets:
    AbilityAction action = new AbilityAction(user, ability);
    action.SetTargets(targets);
    user.Actions.AddAccess(action, false);

    user is the user combatant, ability is the AbilityShortcut, targets is a list of combatants used as targets.

    A) Depends on what you want to do - generally, the AP depend on the used battle system. In active time battles, the AP is the timebar, in turn based and phase battles it's the actions per turn. You can freely change the value via the ActionBar property, but the battle system will also change it (e.g. in ATB, each frame when increasing the timebar, in turn/phase at the start of the turn).

    B) As said, in active time battles, the action bar is the timebar. The used action bar is the used timebar, as each action can either use the full timebar or only a defined amount. When not using the full timebar, you can chain multiple actions until all of the timebar is used.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you!
    #1) For ability, if I add action will that mess up with battle order?

    I have Active Turn based combat. And my setup is, because of the gridless combat during my custom movement, I want to reduce AP, when combatant has run X distance.
    #2) So, if I reduce ActionBar property, do I also need to increase UsedActionBar property?

    #3) I'm having a rare bug where when it's players turn, the turn is just skipped and NPC turn starts. This usually happens several turns into the game. I'm guessing I'm messing with battle order somehow. Any clues what I could check? This is the way I'm handling it.
    1) AI runs ability
    2) Ability battle event runs my custom code
    3) Custom code sets ORK global variables and finishes ability battle event
    4) When AI restarts for new action, based on global variables, it performs actions using ORK nodes.

    In the test play session, I have not used any player abilities, so as far as I can tell. The only thing I changed outside ORK was ActionBar. Could timing of that offset something?
  • 1) Yeah, that could mess with the battle order. What's the use case here - is this something that's actively used by a combatant, or e.g. a trap in the scene?
    If it's part of a combatant's action, you could use a Use Battle Action node and use it as a Sub Action. Or e.g. spawn an environmental damage dealer.

    2) No, the used action bar is used for marking the amount of the action bar that's already used. E.g. selecting an action will increase the used action bar, but the action bar isn't changed (yet). Once the action was used, it'll decrease the action bar and used action bar by the action's value.
    For your use case, you can either just decrease the action bar directly, or increase the used action bar and decrease both by the total value when the movement finished. Both should work, it's just a visual difference if the actual action bar is reduced or if you only change the used action bar while moving.

    3) It's still ORK's battle AI you're using, right? In that case it shouldn't really be the issue, as it'll only run when the battle system asks the combatant to select an action. Unless your custom code also adds actions to the systems, I don't think it'll interfere with it.
    If a combatant's turn is skipped, it might be due to the combatant not being able to select an action at that point. E.g. when using dynamic combat, a combatant is often still in action, so it'll be skipped until the action finished.

    Also, in case you want your battle AI to run on combatant-based variables, use object variables instead of global variables :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited May 2020
    Thank you!
    Hmm, the way it works is I have three use cases.

    1) The custom movement. Here for every x distance covered I remove AP, and also provide the player with custom movement control/visualization. (The path line)
    Here everything except for removing AP is handled by custom code.

    2) Player Actions. I made a custom quick slot bar, with additional functionality like the Ability to shoot arrows in arcs and show arc path, damage everyone in a cone in front of you etc. Basically I'm collecting targets with custom code and calling ability on them from code with.
    AbilityShortcut.Use(UserCombatant, TargetCombatants, true);

    Here again, the only thing changed in ORK is that I use AbilityShortcut.Use() command. Otherwise target selection/action selection is done with custom code.
    Is AbilityShortcut the best way to go? Or should I go with something else?
    Will I run into conflict with ORK's battle menu or something?

    3) AI Actions. Here I have a sort of hybrid system. Because for some calculations it's easier for me to use custom solution, when I need to I'm calling a custom solution.
    The way it works is I have three AI's in ORK. Main AI, DoNothing AI and ExecuteAction AI
    image
    So AI runs, and has three possible outcomes based on global variables. (I have strict turn-based combat, but If I need a more dynamic solution I'll switch to object vars).
    A) DoNothing? this just calls a sub battle action that with None action.
    B) Action Queued? Call Execute battle AI. This will load custom targets, and saved ability ID from my custom code and using ORK AI steps to perform the action on targets.
    At the moment it's done by these two nodes:
    image
    First one sets custom targets

    call.foundTargets.Clear(); call.foundTargets.AddRange(_MasterModule.AIModule.GetAITargets(_MasterModule.AIModule.ChosenAI));

    For second one I copied ORK's native AbilityStep, and I just changed the part about where ability ID comes from. Instead of defining Ability in node, it takes it from my code:
    ability = call.user.Abilities.Get((int)ORK.Game.Variables.GetFloat("UtilityAIAbilityID"));

    C) Detect Next Action. In this case I run an ability on AI user.
    The Ability has a simple battle event. inside I have a custom battle event node, that tells my code to search for actions and targets and exits node once it's done.

    So, after this it goes back to Main AI node, and AI node with either do nothing(A), or perform ability (B) detected by my code.


    In all cases I'm trying not to mess with battle order and let ORK do the actual actions. So, what I need to do in "battle order safe method". Is, to
    1) tell player to use ability.
    2) tell ai to use ability or do nothing.
    3) substract AP when moving.


    Post edited by hellwalker on
  • 1) Should be fine, you can also reduce AP in your custom code if you want to have it all in one place. Can be changed via:
    combatant.Battle.ActionBar -= value;

    2) Is the quick action bar available at any time or only when it's a combatant's turn? If you can use it to fire actions at any time, it'll certainly disrupt the turn based battle order, which will only further spiral out of control further into the battle.
    Using the shortcut's Use function should be fine - e.g. ORK's shortcut slots (via control maps or HUD) use the same functionality.

    3) Hm, as long as your battle action returns the action to use and you don't add an action to the system via custom code during battle AI, this shouldn't really disrupt the system. However, if your custom code does add an action to the system (instead of returning it via battle AI), it'll basically have the combatant at 2 actions at the same time, disrupting the system.

    Also, you can queue next actions for combatants via combatant.Actions.AddNextAction function. Works for both player and AI controlled combatants. The combatant will use the queued action(s) when the system asks to select the next action - but it'd only help to define the next action for the next time the system asks for an action, not while running a battle AI.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited June 2020
    The actions are only done when it's current selecting combatant and action state is available.
    For now I think I'm no longer getting this bug.

    I have a new question about selected data filtering.
    For example. I have a list of combatants that I feed into abilityshortcut.use().

    And in ability battle event I want to use selected data and filtering to select only allies/only enemies from the list of targets. I want to do this, because I have ability that applies positive status effect to allies, and negative to enemies.

    What filtering settings are best for this? I seem to be missing something here.
    image

    End goal is: From the targets of the ability select only enemies or only alies.
    Post edited by hellwalker on
  • Generally, the Is Enemy setting is enough to filter combatants being allies or enemies of the selected user.

    However, you can already set that up in the ability/item itself and don't have to manually do that in the battle event. You can add multiple target change settings in the ability/item target changes and also use an Is Enemy setting there to e.g. damage enemies and heal allies at the same time.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited June 2020
    For some reason the setting I have here, does not filter by target, but takes ALL the battle combatants. Is there a way to specifically only use list of targets for filtering?
    However, you can already set that up in the ability/item itself and don't have to manually do that in the battle event. You can add multiple target change settings in the ability/item target changes and also use an Is Enemy setting there to e.g. damage enemies and heal allies at the same time.
    The IsEnemy option is missing from status effect requirement

    image

    Am I doing something wrong?

    Actually I'm still a bit confused about this:
    image

    What does the group setting mean here? For example if I have three Combatant Groups, the player group, allies group and enemies group. Each has 10 combatants in it.

    If I select two players, two allies and two enemies and use an ability on them. Which is the target range I must have setup in ability to use this ability only on them?




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