Examples would be Divinity: Original Sin, where its all distance based.

  • edited February 20
    It would be pretty challenging to recreate D:OS exactly but I can sort of visualize how you might go about it.

    By using active time battle you could create a move command that, using raycasts, gives the combatant's nav mesh agent a location to move to and you could pretty easily limit their distance as well based on a stat.

    Displaying all that on the terrain like D:OS does? Much trickier.
    Post edited by Wrofir on
  • If you don't use battle grids, all combat is distance based (if you use things like use range for actions).

    Having a movement system like Divinity is a completely different matter, though. Generally, yes, it's possible - but that movement has to be a custom solution, as something like that isn't available out of the box.
    Integrating it with ORK is no problem - e.g. movement can just be an ability/action that you can use that triggers your movement solution's path selection, etc.
    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 February 25
    For a custom solution, it's totally doable, but a lot of work. I've done something similar in the past.

    However, totally doable with the basic nav mesh agent. You would not simply check distance, as that does not account for turns. Here's some code I made to calculate the actual distance. You can also draw debug lines to show where the player will move. You'll want to make/initialize a new NavMeshPath as path

    // This tells you how far in distance your entire path is, which should be translated to AP later.
    public float CalculatePath(Vector3 target, bool drawLine)
    NavMesh.CalculatePath(transform.position, target, NavMesh.AllAreas, path);

    float lng = 0;

    for (int i = 0; i < path.corners.Length - 1; i++)
    if (drawLine)
    Debug.DrawLine(path.corners[i], path.corners[i + 1], Color.red);
    lng += Vector3.Distance(path.corners[i], path.corners[i + 1]);

    return lng;

    if you have more AP than this float, then you would call agent.destination = position; and it will run there.

    Don't forget to set your agent speed as well with things like

    if (running)
    agent.speed = runSpeed;
    else agent.speed = walkSpeed;

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