Jump to content

WalkingEvent GroundItem


Recommended Posts

Posted (edited)
GroundItem khaleesi= getGroundItems().closest(gI -> gI.getName().equals("Khaleesi") && gI.hasAction("Touch"));
WalkingEvent walkingEvent = new WalkingEvent(khaleesi);
walkingEvent.setBreakCondition(new Condition() {
	@Override
	public boolean evaluate() {
	return myPlayer().getPosition().distance(khaleesi.getPosition()) <= 3;
	}
});
execute(walkingEvent);

When doing above, it is not going to walk to the ground item but when i do following;

WalkingEvent walkingEvent = new WalkingEvent(khaleesi.getPosition());
walkingEvent.setBreakCondition(new Condition() {
	@Override
	public boolean evaluate() {
	return myPlayer().getPosition().distance(khaleesi.getPosition()) <= 3;
	}
});
execute(walkingEvent);

It does walk, so, any reason why WalkingEvent needs .getPosition() for GroundItems for it to walk to it ?

Edited by iJodix
Posted
GroundItem khaleesi= getGroundItems().closest(gI -> gI.getName().equals("Khaleesi") && gI.hasAction("Touch"));
WalkingEvent walkingEvent = new WalkingEvent(khaleesi);
walkingEvent.setBreakCondition(new Condition() {
	@Override
	public boolean evaluate() {
	return myPlayer().getPosition().distance(khaleesi.getPosition()) <= 3;
	}
});
execute(walkingEvent);

When doing above, it is not going to walk to the ground item but when i do following;

WalkingEvent walkingEvent = new WalkingEvent(khaleesi.getPosition());
walkingEvent.setBreakCondition(new Condition() {
	@Override
	public boolean evaluate() {
	return myPlayer().getPosition().distance(khaleesi.getPosition()) <= 3;
	}
});
execute(walkingEvent);

It does walk, so, any reason why WalkingEvent needs .getPosition() for GroundItems for it to walk to it ?

 

I never tried to walk to an entity but I guess it searches for a walkable position around the entity first so it can generate a path (walking to an unwalkable tile will result in no path found), the method which walks to an entity might simply be broken. Walking to a position is considered "lower level" than walking to an entity so it is generally more stable... but why are you trying to touch @Khaleesi ... :ph34r:

Posted

I never tried to walk to an entity but I guess it searches for a walkable position around the entity first so it can generate a path (walking to an unwalkable tile will result in no path found), the method which walks to an entity might simply be broken. Walking to a position is considered "lower level" than walking to an entity so it is generally more stable... but why are you trying to touch @Khaleesi ... ph34r.png

Well, it works for entity/objects but doesn't want to work for Ground items and who wouldn't want to touch Khaleesi boge.png

  • Like 1
Posted

Yes, works for everything else expect GroundItem

Even GroundDecoration? :troll: Lol kidding, maybe there is something different in clipping flags for tiles containing GroundItem which the walking code does not handle. I never use anything but the position one because its definately the most stable one. If that one produces an error then all others will 100% be broken too.

Posted

Even GroundDecoration? Troll.png Lol kidding, maybe there is something different in clipping flags for tiles containing GroundItem which the walking code does not handle. I never use anything but the position one because its definately the most stable one. If that one produces an error then all others will 100% be broken too.

Well, i'm fine with adding .getPosition(), was just wondering why it doesn't work without .getPosition() boge.png

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...