Thread: [Hyperion] Removing Npcs

Results 1 to 7 of 7
  1. #1 [Hyperion] Removing Npcs 
    Registered Member

    Join Date
    Mar 2009
    Posts
    1,123
    Thanks given
    36
    Thanks received
    217
    Rep Power
    183
    I've tried using this method:
    Code:
    		if(entity instanceof NPC) {
    			final NPC n = (NPC) entity;
    			entity.playAnimation(Animation.create(7197, 0));
    			final Region region = World.getWorld().getRegionManager()
    				.getRegionByLocation(n.getLocation());
    			region.removeNpc(n);
    			entity.setDead(false);
    			this.stop();
    		}
    But sadly, it doesn't work.

    Mind explaining what I'm doing wrong/ What I need to do?
    I'm not the devil, but I'm sure as **** not a saint.
     

  2. #2  
    Banned

    Join Date
    May 2008
    Posts
    2,327
    Thanks given
    55
    Thanks received
    67
    Rep Power
    0
    i think you have to rebuild the npc map
    so it updates its position as to not be there
     

  3. #3  
    Registered Member
    Its paris's Avatar
    Join Date
    Apr 2009
    Posts
    1,141
    Thanks given
    56
    Thanks received
    234
    Rep Power
    689
    Shouldn't you just do World.getWorld.unregister(NPC);?
     

  4. Thankful user:


  5. #4  
    Registered Member

    Join Date
    Mar 2009
    Posts
    1,123
    Thanks given
    36
    Thanks received
    217
    Rep Power
    183
    Quote Originally Posted by TheChosenOne View Post
    Shouldn't you just do World.getWorld.unregister(NPC);?
    Tried that. Now it does die anim, and just repeats it over and over again.
    I'm not the devil, but I'm sure as **** not a saint.
     

  6. #5  
    Banned
    Join Date
    Feb 2008
    Posts
    384
    Thanks given
    30
    Thanks received
    26
    Rep Power
    0
    Code:
    Region region = World.getWorld().getRegionManager().getRegionByLocation(npc.getSpawnLocation());
    npc.removeFromRegion(region);
    World.getWorld().unregister(npc);
    works for me BTW it seems like it will not remove an npc visually unless you use the spawn location of the npc, but this might be because of how I have my walking done for npcs.
     

  7. #6  
    Registered Member
    PSNB's Avatar
    Join Date
    Aug 2009
    Posts
    885
    Thanks given
    8
    Thanks received
    103
    Rep Power
    590
    Do like I do, create a 'Graveyard' at 0, 0, 0.

    When an NPC 'dies', teleport them there and wait until they're supposed to respawn, then reset their health and clear their target, etc.

    If the NPC is actually supposed to be removed (like a Barrows brother); teleport them to the graveyard and then remove them.
     

  8. #7  
    Registered Member

    Join Date
    Mar 2009
    Posts
    1,123
    Thanks given
    36
    Thanks received
    217
    Rep Power
    183
    Quote Originally Posted by billygotshot View Post
    Code:
    Region region = World.getWorld().getRegionManager().getRegionByLocation(npc.getSpawnLocation());
    npc.removeFromRegion(region);
    World.getWorld().unregister(npc);
    works for me BTW it seems like it will not remove an npc visually unless you use the spawn location of the npc, but this might be because of how I have my walking done for npcs.
    Worked, thanks a lot. Rep++;
    I'm not the devil, but I'm sure as **** not a saint.
     


Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •