Thread: Zulrah Facing Error

Results 1 to 8 of 8
  1. #1 Zulrah Facing Error 
    Banned
    Join Date
    May 2014
    Posts
    144
    Thanks given
    11
    Thanks received
    21
    Rep Power
    0
    No matter what we do we are unable to get zulrah to face the proper way when spawning, if anyone has tried add zulrah to its proper location and experienced the same issue, it would be greatly appreciated if you could point me in the right direction.

    Spoiler for Calling:
    Code:
      if (playerCommand.equalsIgnoreCase("zulrah")) {
       TeleportExecutor.teleport(c, new Position(2268, 3070, c.getInstancedHeight()));
     
       Server.getTaskScheduler().schedule(new ScheduledTask(4) {
        @Override
        public void execute() {
         NPCHandler.spawnNpc(c, 2042, 2266, 3073, c.getInstancedHeight(), 0, 500, 41, 1, 1, false, false);
         NPC npc = new NPC(2042);
         npc.facePlayer(c.getIndex());
         this.stop();
        }
       });
     
      }


    Spoiler for Spawning method:
    Code:
     public static NPC spawnNpc(Player c, int npcType, int x, int y, int heightLevel, int walkingType, int HP,
       int maxHit, int attack, int defence, boolean attackPlayer, boolean headIcon) {
      NPC npc = new NPC(npcType);
      npc.direction = 1;
      npc.setAbsX(x);
      npc.setAbsY(y);
      npc.makeX = x;
      npc.makeY = y;
      npc.heightLevel = heightLevel;
      npc.walkingType = walkingType;
      npc.HP = HP;
      npc.MaxHP = HP;
      npc.maxHit = maxHit;
      npc.attack = attack;
      npc.defence = defence;
      npc.spawnedBy = c.getIndex();
      if (attackPlayer) {
       npc.underAttack = true;
       if (c != null) {
        npc.killerId = c.getIndex();
       }
      }
      NPCHandler.NPCS.add(npc);
      if (npcType >= 4278 && npcType <= 4284) {
       npc.forceChat("I'M ALIVE!");
       npc.forceAnim(4410);
      }  
      if (npcType >= 2042 && npcType <= 2044) {
       npc.forceAnim(5073);
       npc.facePlayer(c.getIndex());
      }
      if (Pet.isPet(npc.npcType)) {
       npc.underAttack = true;
       npc.killerId = c.getIndex();
       c.getPet().setNpc(npc);
      }
      if (headIcon) {
       c.getPA().drawHeadicon(1, npc.getIndex(), 0, 0);
      }
      return npc;
     }



    Spoiler for Pic:
    Reply With Quote  
     

  2. #2  
    Banned
    Join Date
    May 2015
    Posts
    57
    Thanks given
    31
    Thanks received
    11
    Rep Power
    0
    Mhm... it worked fine for me :O
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    May 2012
    Posts
    445
    Thanks given
    31
    Thanks received
    19
    Rep Power
    48
    Quote Originally Posted by Pikachu View Post
    No matter what we do we are unable to get zulrah to face the proper way when spawning, if anyone has tried add zulrah to its proper location and experienced the same issue, it would be greatly appreciated if you could point me in the right direction.

    Spoiler for Calling:
    Code:
      if (playerCommand.equalsIgnoreCase("zulrah")) {
       TeleportExecutor.teleport(c, new Position(2268, 3070, c.getInstancedHeight()));
     
       Server.getTaskScheduler().schedule(new ScheduledTask(4) {
        @Override
        public void execute() {
         NPCHandler.spawnNpc(c, 2042, 2266, 3073, c.getInstancedHeight(), 0, 500, 41, 1, 1, false, false);
         NPC npc = new NPC(2042);
         npc.facePlayer(c.getIndex());
         this.stop();
        }
       });
     
      }


    Spoiler for Spawning method:
    Code:
     public static NPC spawnNpc(Player c, int npcType, int x, int y, int heightLevel, int walkingType, int HP,
       int maxHit, int attack, int defence, boolean attackPlayer, boolean headIcon) {
      NPC npc = new NPC(npcType);
      npc.direction = 1;
      npc.setAbsX(x);
      npc.setAbsY(y);
      npc.makeX = x;
      npc.makeY = y;
      npc.heightLevel = heightLevel;
      npc.walkingType = walkingType;
      npc.HP = HP;
      npc.MaxHP = HP;
      npc.maxHit = maxHit;
      npc.attack = attack;
      npc.defence = defence;
      npc.spawnedBy = c.getIndex();
      if (attackPlayer) {
       npc.underAttack = true;
       if (c != null) {
        npc.killerId = c.getIndex();
       }
      }
      NPCHandler.NPCS.add(npc);
      if (npcType >= 4278 && npcType <= 4284) {
       npc.forceChat("I'M ALIVE!");
       npc.forceAnim(4410);
      }  
      if (npcType >= 2042 && npcType <= 2044) {
       npc.forceAnim(5073);
       npc.facePlayer(c.getIndex());
      }
      if (Pet.isPet(npc.npcType)) {
       npc.underAttack = true;
       npc.killerId = c.getIndex();
       c.getPet().setNpc(npc);
      }
      if (headIcon) {
       c.getPA().drawHeadicon(1, npc.getIndex(), 0, 0);
      }
      return npc;
     }



    Spoiler for Pic:
    Thanks for the information
    Reply With Quote  
     

  4. #4  
    Extreme Donator


    Join Date
    Mar 2009
    Posts
    1,461
    Thanks given
    111
    Thanks received
    184
    Rep Power
    79
    Make it face the tile to the right of the player instead?
    Attached image
    Quote Originally Posted by MaxXi View Post
    Your combat is so awsome that i almost forgot its the combat matrix coded.
    Quote Originally Posted by twobrosplay View Post
    Try allowing the batch file through your firewall?
    Quote Originally Posted by SS_Alophonse View Post
    i have no life u say ha anything u say kid.i doubt u can even get a girlfriend
    i bet u cant even code anything.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Stanaveli's Avatar
    Join Date
    Aug 2014
    Posts
    1,490
    Thanks given
    184
    Thanks received
    653
    Rep Power
    1338
    Mhm, I find it weird though. You are registering the npc without the actual object you have created for it then later you try to set it's face with the object.

    Perhaps this will fix your problem.

    Code:
     public static NPC spawnNpc(Player c, int npcType, int x, int y, int heightLevel, int walkingType, int HP,
       int maxHit, int attack, int defence, boolean attackPlayer, boolean headIcon) {
      NPC npc = new NPC(npcType);
      npc.direction = 1;
      npc.setAbsX(x);
      npc.setAbsY(y);
      npc.makeX = x;
      npc.makeY = y;
      npc.heightLevel = heightLevel;
      npc.walkingType = walkingType;
      npc.HP = HP;
      npc.MaxHP = HP;
      npc.maxHit = maxHit;
      npc.attack = attack;
      npc.defence = defence;
      npc.spawnedBy = c.getIndex();
      if (attackPlayer) {
       npc.underAttack = true;
       if (c != null) {
        npc.killerId = c.getIndex();
       }
      }
      NPCHandler.NPCS.add(npc);
      if (npcType >= 4278 && npcType <= 4284) {
       npc.forceChat("I'M ALIVE!");
       npc.forceAnim(4410);
      }  
      if (npcType >= 2042 && npcType <= 2044) {
       npc.forceAnim(5073);
       npc.facePlayer(c.getIndex());
      }
     if (npcType == ###) {
       npc.facePlayer(c.getIndex());
     }
      if (Pet.isPet(npc.npcType)) {
       npc.underAttack = true;
       npc.killerId = c.getIndex();
       c.getPet().setNpc(npc);
      }
      if (headIcon) {
       c.getPA().drawHeadicon(1, npc.getIndex(), 0, 0);
      }
      return npc;
     }
    Change what's in red to Zulrah's npc id.
    Keep your head up.



    Reply With Quote  
     

  6. #6  
    Banned Zulrah Facing Error Market Banned


    Join Date
    Jan 2011
    Age
    26
    Posts
    3,112
    Thanks given
    1,198
    Thanks received
    1,479
    Rep Power
    0
    NPCHandler#spawnNpc should return the NPC instance, use that to make it face the player.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Andys1814's Avatar
    Join Date
    Feb 2013
    Posts
    974
    Thanks given
    688
    Thanks received
    455
    Rep Power
    727
    Quote Originally Posted by Stand up View Post
    Mhm, I find it weird though. You are registering the npc without the actual object you have created for it then later you try to set it's face with the object.

    Perhaps this will fix your problem.

    Code:
     public static NPC spawnNpc(Player c, int npcType, int x, int y, int heightLevel, int walkingType, int HP,
       int maxHit, int attack, int defence, boolean attackPlayer, boolean headIcon) {
      NPC npc = new NPC(npcType);
      npc.direction = 1;
      npc.setAbsX(x);
      npc.setAbsY(y);
      npc.makeX = x;
      npc.makeY = y;
      npc.heightLevel = heightLevel;
      npc.walkingType = walkingType;
      npc.HP = HP;
      npc.MaxHP = HP;
      npc.maxHit = maxHit;
      npc.attack = attack;
      npc.defence = defence;
      npc.spawnedBy = c.getIndex();
      if (attackPlayer) {
       npc.underAttack = true;
       if (c != null) {
        npc.killerId = c.getIndex();
       }
      }
      NPCHandler.NPCS.add(npc);
      if (npcType >= 4278 && npcType <= 4284) {
       npc.forceChat("I'M ALIVE!");
       npc.forceAnim(4410);
      }  
      if (npcType >= 2042 && npcType <= 2044) {
       npc.forceAnim(5073);
       npc.facePlayer(c.getIndex());
      }
     if (npcType == ###) {
       npc.facePlayer(c.getIndex());
     }
      if (Pet.isPet(npc.npcType)) {
       npc.underAttack = true;
       npc.killerId = c.getIndex();
       c.getPet().setNpc(npc);
      }
      if (headIcon) {
       c.getPA().drawHeadicon(1, npc.getIndex(), 0, 0);
      }
      return npc;
     }
    Change what's in red to Zulrah's npc id.

    Code:
      if (npcType >= 2042 && npcType <= 2044) {
       npc.forceAnim(5073);
       npc.facePlayer(c.getIndex());
      }
    He already did that here?
    Reply With Quote  
     

  8. #8  
    Krator || Indie Dev

    Jordan Belfort's Avatar
    Join Date
    Dec 2012
    Posts
    1,051
    Thanks given
    535
    Thanks received
    485
    Rep Power
    1172
    I don't know if you still need this but I see you call the method before you're in the area. I suggest using an event system to teleport you there, and shortly after execute another event to make Zulrah face you. Currently reading your code, Zulrah faces where you were at the position of your teleport and not when you appear there. It's not a constant thing, it doesn't make them face you the entire time, it just faces that direction when you call it.

    Hope this helped.
    Attached image
    [/CENTER]
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 8
    Last Post: 03-24-2013, 11:01 PM
  2. error im facing
    By doompkerz in forum Help
    Replies: 1
    Last Post: 07-05-2009, 07:40 AM
  3. Same error over and over?!!
    By phantomphreak in forum Tutorials
    Replies: 4
    Last Post: 09-28-2007, 01:20 AM
  4. [HELP]Render Error
    By Big J in forum General
    Replies: 3
    Last Post: 07-30-2007, 01:01 AM
  5. Error. Please reboot me :)
    By Inside Sin in forum Showcase
    Replies: 4
    Last Post: 05-13-2007, 03:39 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •