Jump to content

Npc walking?


1stTimeDev

Recommended Posts

How would I grab if the Npc is walking? n.isMoving will return true or false depending when the script grabs the npc. So if a guard is walking when the script gets to it, it will return true or if its stationary, it will return false but as we all know all guards will walk.

 

Hope this made sense and any help is appreciated.

Link to comment
Share on other sites

emote32342.png

 

Well, for example

 

public boolean dump(NPC n) {

log("Is npc moving" + "" + n.isMoving());

}

 

Only one npc around me, so if the npc is moving it will return true, but when the npc stops it will return false. It works the same way when writing to pastebin. It isn't right.

 

Edited by 1stTimeDev
Link to comment
Share on other sites

Well, for example

 

public boolean dump(NPC n) {

log("Is npc moving" + "" + n.isMoving());

}

 

Only one npc around me, so if the npc is moving it will return true, but when the npc stops it will return false. It works the same way when writing to pastebin. It isn't right.

 

So you are saying the method "isMoving" should return true even if the npc is not moving? emote32342.pngemote32342.pngemote32342.pngemote32342.png

 

The method is called isMoving() not canMove()

Edited by Explv
Link to comment
Share on other sites

So you are saying the method "isMoving" should return true even if the npc is not moving? emote32342.pngemote32342.pngemote32342.pngemote32342.png

 

The method is called isMoving() not canMove()

 

Okay, so the script will grab the initial movement for an NPC. You're right, it should return true if the npc is walking, but the problem is that the npc has two phases - Walks and stops. If the npc has stopped moving when the script is writing about it it will return false which is wrong.

 

So, if the goblin is stationary when the script finds it it will return false, and if one goblin is active when the script finds it it will return true, whereas we know, all goblins move. Is there any way we could actually check if the npc has walked in a given time and if not, it would return false.

Link to comment
Share on other sites

I think you misunderstand primitives in java.

 

They are nothing but values; not references to something somewhere. A boolean value is never going to change by itself, and is immediately stale if you declare one for whether the NPC is moving or not. Just keep checking npc.isMoving directly; whether or not he was moving 10 minutes ago is most likely irrelevant

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