Jump to content

WalkingEvent GroundItem


iJodix

Recommended Posts

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
Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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