Compass pointing to the nearest player

Discussion in 'Plugin Requests' started by AcedGod, Jun 6, 2012.

  1. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hi
    My friends and I wish to play a large custom map for the Hunger Games. I don't want the game to last forever, so I hope that I can find a plugin that has a compass which points to the nearest player.

    What I want
    -Compass points to the nearest player
    -Compass can only track one player (Nearest Player)
    -Does not track ops

    Hopefully it can be done within 2 days?

    ~I really, really, really thank you in advance

    -Ace
  2. Offline

    chenr1

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hmnn. I wouldnt mind taking a look at it. Maybe you should consider a client side mod. Look up tracers.
  3. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    No, I don't want a mod because the only tracers I can find are ones which can see through blocks.
  4. Offline

    rileysut8991

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I think I can do it.
    I'm new to this but I'm not new to java so I'm learning pretty fast
    I'll contact you tommorow
  5. Offline

    izak12345678910

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This has been done before but its says [HungerGames] and points to player nearest to you with a customizable distance
  6. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I think that that plugin generates a random map which I do not want.
  7. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thanks
  8. Offline

    izak12345678910

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    No it doesn't its just a small plugin when you right click with compass it says [HungerGames] Now tracking player AcedGod and thats about it you can customize the distance and no commands or permissions
  9. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Could I have a link please?
  10. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Ok I found it although it's not exactly how I wanted it.
  11. Offline

    izak12345678910

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Let me see if you have the right link? What is missing?
  12. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  13. Offline

    zecheesy

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  14. Offline

    izak12345678910

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Its public we can use it if we want to... and @AcedGod ask the developer in the thread or private message him and if you do get it mind sharing an update with me?
  15. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    He said he'll try to see what he can do by monday.
  16. Offline

    izak12345678910

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Well ok thats goos then i guess wait till then and see what happens
  17. Offline

    MiniUSB

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Nice concept! I think someone already beat me to it, so I won't try.
    But still, I really like your concept.
  18. Offline

    YoshiGenius

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I can do this right now. I'll have all the features you want in it.

    So no pointing to ops EVER, or do you want a permission node to allow people to see where ops are, OR do you want a permission node to hide them?
  19. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thanks but another person has answered my request and is trying to help me at the moment.
  20. Offline

    izak12345678910

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Do you know when it will be ready?
  21. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I have it now but I have not tested it yet.
  22. Offline

    TheFluffey

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Share with the rest of us?
  23. Offline

    Codisimus

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I coded this like a month ago, maybe someone here will find it useful. It takes the list (array) of players and points their compass to the nearest person in the list. This should be put inside a scheduler that repeats every second or tick (how ever often you want). This requires no clicking and is always set to the nearest player.
    Code:
        public static void updateCompases(Player[] players) {
            for (int i = 0; i < players.length; i++) {
                Location l = players[i].getLocation();
                double shortestDistance = 99999;
                int nearestPlayer = i;
                for (int j = 0; j < players.length; j++) {
                    double distanceToPlayer = l.distance(players[j].getLocation());
                    if (distanceToPlayer < shortestDistance && i != j) {
                        nearestPlayer = j;
                        shortestDistance = distanceToPlayer;
                    }
                }
               
                players[i].setCompassTarget(players[nearestPlayer].getLocation());
          }
        }
    bobacadodl and AcedGod like this.
  24. Offline

    AcedGod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  25. Online

    bobacadodl

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thanks Codisimus! I was trying to something else with compasses and your code helped me :)
    Codisimus likes this.
  26. Offline

    pzxc

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I liked this idea so much I had to add it as a feature in my plugin: http://dev.bukkit.org/server-mods/vitals-plugin/

    In the config under mechanics mods set usefulcompass: true, then compasses will ALWAYS work like that, pointing to the nearest player (if there is one). It properly checks for multiworlds and only tries to point to the nearest player in your current world.

Share This Page