Jump to content

How would I detect obstacles on a path


Recommended Posts

Posted

Imagine that I want to run from lumbridge castle to the cows.

 

IF you try to make a path to inside the cows area, the pathfinder will give you a path through the gate IF it's open.

When the gate is not open, the pathfinder won't be able to get in and get stuck.

 

I want to work out a general approach where the pathfinder would ignore that the gate is closed so I can codewise intercept it and handle it. However the pathfinder doesn't know that there's a gate when it's closed, it just treats it as an area where it can not pass/get in.

 

I'm looking for ideas on how I could get doors/gates and let the pathfinder ignore it.

Not looking for spoonfedding, I can work it out myself if only I had a lead.

 

Thanks in advance for any help towards this.

Posted

i think it's like getWalking().canReach();

or getMap().canReach();

something with canReach...

That won't tell us anything about any object's on the path, only that it can't be reached.

But if you put 4 walls without a door, it won't be able to reach it either, we have no clue about any obstacles on why we can't reach it.

Posted (edited)

That won't tell us anything about any object's on the path, only that it can't be reached.

But if you put 4 walls without a door, it won't be able to reach it either, we have no clue about any obstacles on why we can't reach it.

I think he meant, since you clearly now where this obstacle is, You could do a can reach to the middle of the field.

If you can, walk there.

If you can't, walk towards the gate and open it.

Edited by Isolate
Posted (edited)

I think he meant, since you clearly now where this obstacle is, You could do a can reach to the middle of the field.

If you can, walk there.

If you can't, walk towards the gate and open it.

That's what I'm doing now, and sure it works great. But for my AI project I want to build a more general approach where we don't need to know the specific situation.

Where I could send my bot to random coordinates and it would handle the obstacles it comes across.

I would be able to write the code for that, I just need to find out what I mentioned in my original post.

How do I let the pathfinder ignore obstacles and how do I know which kind of obstacle it is.

Edited by lisabe96
Posted

I want to find out why we can't reach it, what obstacle is stopping us from reaching the position is what I want to know

 

 

doorHandler.getNextObstacle(Entity or Position); //Returns an RS2Object

 

doorHandler.getObstacles(); //List of RS2Objects

 

Take a look at the api, it's all there ! 

 

http://osbot.org/api/org/osbot/rs07/api/DoorHandler.html#getNextObstacle(org.osbot.rs07.api.model.Entity)

Posted

doorHandler.getNextObstacle(Entity or Position); //Returns an RS2Object

 

doorHandler.getObstacles(); //List of RS2Objects

 

Take a look at the api, it's all there ! 

 

http://osbot.org/api/org/osbot/rs07/api/DoorHandler.html#getNextObstacle(org.osbot.rs07.api.model.Entity)

Thanks! Looks like this might be what I'm looking for at first glance.

Will check it out tomorrow, it's far past bed time im out ph34r.png

Posted

Overcoming obstacles isnt a 5 second scripting task. 

If you want to include a robust obstacle handler in your scripts, it will take quite some time to write. 

You will need to use collision flags and detect the type of obstacle blocking you, and what needs to be done to overcome it. 

There is some old example code to get you started, if I feel unlazy later I will find it and link it here. Otherwise, maybe someone else will. It was a simple obstacle handler written by Maxi. 

Posted

Overcoming obstacles isnt a 5 second scripting task. 

If you want to include a robust obstacle handler in your scripts, it will take quite some time to write. 

You will need to use collision flags and detect the type of obstacle blocking you, and what needs to be done to overcome it. 

There is some old example code to get you started, if I feel unlazy later I will find it and link it here. Otherwise, maybe someone else will. It was a simple obstacle handler written by Maxi.

That's what the door handler class is mainly built out of.
Posted

Overcoming obstacles isnt a 5 second scripting task. 

If you want to include a robust obstacle handler in your scripts, it will take quite some time to write. 

You will need to use collision flags and detect the type of obstacle blocking you, and what needs to be done to overcome it. 

There is some old example code to get you started, if I feel unlazy later I will find it and link it here. Otherwise, maybe someone else will. It was a simple obstacle handler written by Maxi. 

I know it's not a simple task, but I've written whole RSPS's from scratch so I'm confident that I could work something out.

Ill take a look to the doorhandler tonight and see what I can come up with

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...