Does setTarget() even work !?!

Discussion in 'Plugin Development' started by Clemens, Mar 31, 2011.

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

    Clemens

    Hi, does anyone have any experience with the setTarget() method?
    I'm wondering if it even works...
    I tried the following:

    Code:
    if (args[0].equalsIgnoreCase("spawn"))
    {
        int X =(int) player.getLocation().getX();
        int Y =(int) player.getLocation().getY();
        int Z =(int) player.getLocation().getZ();
        z = world.spawnCreature(new Location(world, X+15, Y+3, Z), CreatureType.ZOMBIE);
    }
    and then from a far away spot:

    Code:
    if (args[0].equalsIgnoreCase("target"))
    {
        Creature zombie = (Creature) z;
        zombie.setTarget(player);
    }
    But nothing happens... The stupid zombie just stands and looks around.
    As I stood next to the zombie, I even tried:
    Code:
    if (args[0].equalsIgnoreCase("target"))
    {
        final Creature zombie = (Creature) z;
        getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
           public void run(){zombie.setTarget(null);}
           }, 1L, 5L);
    }
    ..which should actually make the zombie stay still or move strange. But again - nothing happens, the zombie just chased me like zombies also do !

    Did I maybe just make a silly mistake? Is the "Creature zombie = (Creature) z;" wrong?
    Please help.
     
  2. Offline

    titog176

    well from my prior knowledge i think that its wrong but dont listen to me im ganna get you some help!
     
  3. Offline

    Clemens

    Thanks ^^
     
  4. Offline

    titog176

    Np ,so i still am looking for people and ill try my best
     
  5. Offline

    mughi

    thread moved to plugin development (just a heads up so you can find it later)
     
Thread Status:
Not open for further replies.

Share This Page