Replicate player movement with NPC

Discussion in 'Spigot Plugin Development' started by Roro, May 23, 2016.

  1. Hello,
    I don't know if it is possible and I know it may be hard to do. I would like to save player's movement to some file/database (some points he went through, that would be logged let's say twice a second) and than make an NPC do the movement. Basicly something like Replay mod does, but with a plugin and wihout saving video file, the camera paths etc. If it would be possible I would even like actions like swinging sword, jumping... I don't mind using an API, but I couldn't find any for what I need. Could anyone point me to som tutorial/API or help in some different way?
    Thanks for answer in advance.
     
  2. MiniDigger

    Supporter

    just save the position of the player every 30s and add it to a list. save that list somewhere (file,db,idk)
    when you loaded that list spawn a npc with a custom pathfindgoal that will walk through all you points.
    If you want to record additional actions I sugesst creating a class Keyframe or smth like that, that caputres all the stuff you want to capture every 30s. make a list with all keyframes and save it.
    after you loaded the list have a runable that plays the next keyframe every 30s.
     
    • Like Like x 1
  3. Thanks for reply. How can you point an NPC to a specific location? (I only know how to point it to another entity) Also can I make the NPC look like player in some way or should I use zombie (it wouldn't be a problem). And how do you make the NPC do that actions?
     
  4. MiniDigger

    Supporter

    custom pathfindgoal
    you can spawn a fake player and change the gameprofile to change the skin
    packets I guess
     
    • Like Like x 1
  5. I don't know much about packets, but it seems like the time has come to learn something about them. :D I will search for the pathfinder goals and spawning a fake player. Thanks for help anyway and if you know about some tutorial that could help me in any of these things, please give me a link. :)
     
  6. MiniDigger

    Supporter

    Packets -> http://wiki.vg/Protocol
     
    • Like Like x 1