edited February 2 in ORK Support
Hello everybody,
I'm currently experimenting on a battle system similar to the one in Final Fantasy XII. I'm using Active Time battles, not blocking user controls (so the player can run around while fighting) and the actions are menu-driven (so I select attack, select a target and act). I'd like to create an enemy that behaves in the following way:
if (time bar < N) {
try to keep a fixed distance from player
}
else if (time bar > N and time bar < M) {
run to attack range and move around the player while keeping minimum attack distance
}
else {
attack
}
Is there a way to do this? I looked into AI behaviours and AI rules but I'm not sure how these are handled.

I'm using Move AIs to move around with NavMeshAgent and a custom controller script. Thanks for your help
Post edited by azazello on
  • I'd recommend using the Caution mode in the move AI for that. The Stop Range of the caution settings allows you to define the distance to the player the enemy will keep, in combination with Use Action Range setting here, this should be what you're looking for.
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Thank you! This solved the issue at hand. However, for a more general purpose, is there a way to "directly" control a specific combatant's move AI behaviour during a battle (but before its turn)? For example, to change the behaviour in different conditions (low HP, status effect, timebar fill...)?
  • You can change the move AI and move AI mode of a combatant using the event system.
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • edited May 15
    Hello, sorry for reopening an old thread but I still need clarification on the matter and thought it was best not to open a new one.

    First things first: I'm trying to use as much as ORK's features as I can and trying to integrate my own scripts in the ORK workflow. So, for example, when I need specific behaviours I can control with the event system instead of creating my own behaviour I create new nodes and use those. I'm not sure if this is recommended, but like I said I'd like to preserve as much as ORK's workflow as I possibly can when adding my own stuff. On to move AIs and battle AIs.

    Like I said in the first post my battle system is similar to the one in FFXII. It's basically an active time menu driven system, but characters can move around and act when in a certain range. I could set this up in minutes thanks to ORK and got it to work quite smoothly. Now I'm trying to extend this behaviour further than basic action choosing and would like for enemies (or npcs) to have specific behaviours that I can't really seem to get right with my (very limited) knowledge of ORK.

    The way I understand it is that Battle AIs are run during the enemy's turn, while Move AIs are run constantly (unless I do something about it with the event system). Here's an example of behaviour I would like to obtain:


    [choose next action]
    if (next action == melee)
    {
    // hunt
    }
    else if (next action == ranged)
    {
    // caution
    }
    else if (next action == heal)
    {
    // flee
    }


    The only way I could think about to do this would be to create an ability to set each movement mode through the event system and select it in the battle AI based on the chosen behaviour.

    Also, I would like to modify some of the move AI behaviours, especially the hunt mode.


    var minimumHuntRange = 5;
    var actionRange = 3;

    if (player distance > minimumHuntRange)
    {
    hunt and get into actionRange
    }
    else if (player distance < minimumHuntRange && player distance > actionRange)
    {
    wait for turn
    enter range
    act
    }
    else
    {
    wait for turn
    act
    }


    In other words, I'd like the enemy to hunt the player until it's in the action range, but to start hunting only if the player gets outside a wider, minimum hunting range. Or, to simplify it even further, I'd like the enemy to wait a bit before starting to hunt the player.

    More generally you could say that what I would really like to understand is a way to connect Battle AI decisions with Move AI modes and if there is any way to extend or even add Move AI modes.

    Thanks for your help and sorry for the chaotic explanation
    Post edited by azazello on
  • I can add battle AI nodes to directly change the move AI mode instead of going through abilities for that to make this easier. For the time being, using an ability to do that is the way to go.
    An alternative would be using AI behaviours/rulesets (i.e. the slotable AI feature) to change between move AI modes.

    There's currently no wait time between mode changes (e.g. starting to hunt), you'd have to add that in the MoveAIComponent script in ORK's source code.
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.