Solved About aimove chase, run and runattack

Question that is answered or resolved.

kimono

Well-known member
Hello fellow Openbor enthusiast,

I had a question about
Code:
aimove chase
:
At what distance in pixels does the enemy start running towards the player and executing its runattack?
I'd like to know this parameter to adjust its behavior at close range and at long range, which is the part not taken into account by this pre-conditioned movement/attack :)
Thank you!
 
Solution
Hello fellow Openbor enthusiast,

I had a question about
Code:
aimove chase
:
At what distance in pixels does the enemy start running towards the player and executing its runattack?
I'd like to know this parameter to adjust its behavior at close range and at long range, which is the part not taken into account by this pre-conditioned movement/attack :)
Thank you!

At the moment, distance for AI to run at a target is hard coded to > 150 pixels on the X axis.

C:
//...
if(axis_x)
{
    if(acting_entity->position.x > target->position.x)
    {
        acting_entity->destx = target->position.x + range - 1;
    }
    else
    {
        acting_entity->destx = target->position.x - range + 1;
    }
    dx =...
Hello fellow Openbor enthusiast,

I had a question about
Code:
aimove chase
:
At what distance in pixels does the enemy start running towards the player and executing its runattack?
I'd like to know this parameter to adjust its behavior at close range and at long range, which is the part not taken into account by this pre-conditioned movement/attack :)
Thank you!

At the moment, distance for AI to run at a target is hard coded to > 150 pixels on the X axis.

C:
//...
if(axis_x)
{
    if(acting_entity->position.x > target->position.x)
    {
        acting_entity->destx = target->position.x + range - 1;
    }
    else
    {
        acting_entity->destx = target->position.x - range + 1;
    }
    dx = diff(acting_entity->position.x, acting_entity->destx);

    if(dx > 150 && validanim(acting_entity, ANI_RUN))
    {
        acting_entity->velocity.x = acting_entity->modeldata.runspeed;
        acting_entity->running &= ~RUN_STATE_START_Z;
        acting_entity->running |= RUN_STATE_START_X;
    }
    else
    {
        acting_entity->velocity.x = acting_entity->modeldata.speed.x;
    }
    if(acting_entity->destx < acting_entity->position.x)
    {
        acting_entity->velocity.x = -acting_entity->velocity.x;
    }

//...

There is nothing at all you can do to change this, even in 4.0, though I am going to add an adjustment in an upcoming version. For now, If you want to have a custom run trigger, you will have to script running movement yourself.

DC
 
Solution
At the moment, distance for AI to run at a target is hard coded to > 150 pixels on the X axis.
Hmm, that explains some behaviors. I noticed that when changing a game from 320x240 to 480x272, the entity with the chase subtype doesn't chase after a player after a certain distance.

But with an unusual fact: instead of walking or trying to do something, the entity simply stands still. If you play my Avengers game, you'll notice there are some mechanical dogs that stand still waiting for you to approach – I didn't program them to do that, they stand still on their own.
 
Thanks Damon, that's important information. I don't know if we can add it to the Openbor manual?
I now understand better why enemy entities only run at mid-range from the player.
 
Back
Top Bottom