Decrease players sight range.

Discussion in 'Plugin Development' started by fresser123, Apr 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    fresser123

    Hi there.
    I am developing on a very exiting project atm.

    It is some sort of arena, (Dont want to reveal the idea) where the players only have a given sightrange.

    I am developing the plugin, and i have tried:
    - Effect(potion) blindness - Too short distance (3 blocks) - Needs to be like 10-15
    - Sphere around moving players of stone - Too laggy and buggy.
    - Moving the entire arena down to bedrock level - Didnt work, do not know why.

    All i want is some kind of blindness, but not that effective.
    Is this possible?
     
  2. Offline

    WolfGangSen

    all the players blind at the same time?

    if not bedrock idea is a bad one.

    but instead of moving the arena. Just make 2 arenas and teleport the players?
     
  3. Offline

    fresser123

    I want all players in the arena to have a sightrange about 12-15blocks :) Not spectators tho (Walking on glass over the arena.)
     
  4. Offline

    TheButlah

    do they need to be blind to the entire arena or only other players?
     
  5. Offline

    fresser123

    Its best if it could work like blindness, with a higher range. If that isnt possible, i would prefer just players being invisible
     
  6. Offline

    microgeek

    I released a particle library, you could use that and send smoke particles(very large smoke particles, to be exact) just like the stone.
     
  7. Offline

    fresser123

    Can you please send me a link? ;)
     
  8. Offline

    microgeek

  9. Offline

    fresser123

    microgeek Okay ;)
    Im pretty new to plugins. I dont quite understand how i should implement that link in my code, sorry.
    Can you tell me, maybe?
     
  10. Offline

    microgeek

    fresser123
    You said you tried using blocks to limit their view. Where you set a block, send the CLOUD effect instead.
     
  11. Offline

    fresser123

    microgeek
    Ehm. Im using this code:
    Code:
                    for (Player p : Bukkit.getOnlinePlayers()) {
                        //Ellers gør hvad der nu er efter denne linje
                        int viewdist = 10;
                        Location loc = p.getLocation();
                        for (int x = loc.getBlockX()-viewdist;x<loc.getBlockX()+viewdist;x++) {
                            for (int y = loc.getBlockY()-viewdist;y<loc.getBlockY()+viewdist;y++) {
                                for (int z = loc.getBlockZ()-viewdist;z<loc.getBlockZ()+viewdist;z++) {
                                    Location loc2 = new Location(p.getWorld(), x, y, z);
                                    if (Math.round(loc2.distance(loc)) == (viewdist)) {
                                        try {
                                            ParticleEffects.LARGE_SMOKE.sendToPlayer(p, loc2, 0, 0, 0, 0, 10);
                                        } catch (Exception e1) {
                                            p.sendMessage("DERP AN ERROR OCCURED DERP" + loc2);
                                        }
                                    }
                                }
                            }
                        }
    and its of course run every tick. The problem is, that it somehow "waves" over the player, and it still causes GIANT lagg for the client.
     
Thread Status:
Not open for further replies.

Share This Page