Posted October 19, 201410 yr Hello all! I am planning to make a mod for forge 1.7.10, and I'm wondering how I can make the player pathfind itself without any player intervention. This is sort of what I'm looking for: Any Idea on how to go about this? Thanks in advance
October 22, 201410 yr I haven't watched the video, so merely speculating. Also, it generally helps people if you post what you have tried. My proposed method: Tickhandler. Call the pathfinder for the player to get a path. Every tick use your tickhandler to call the player-navigator to move him along said path. It might be easier than that... you -might- be able to just set him a path and let him go (as he shares most of the code with EntityLiving/etc). But I'm guessing because of the player-controlled aspect you will have some additional handling to do (i.e. through the tick-handler).
October 22, 201410 yr Okay, so, to do this, you would probably need a pretty good understanding of the concept of pathfinding and how it works, How well do you know A-Star, DFS (Depth-First Search), or BFS (Breadth-First Search)? Here is a good source to help you decide which is best suited for what you require. I would say that the pathfinding bit is the difficult bit, once you have a path for the player, all you need is a way to make the player move. As mentioned above by shadowmage4513, EntityPlayer does share a lot of code with EntityLivingBase, so you could override some code in there, or (what I would do) have a fake key presser for the player, so it simulates 'w' 'a' 's' 'd' or 'space' which may be more efficient than making the player move like a mob. Hope this helped. Here are some good sources for the three algorithms: A-Star in games Introduction to A-Star DFS BFS I would recoment using A-Star, but the other two should also work. I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
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.