i think you have to rebuild the npc map
so it updates its position as to not be there
|
I've tried using this method:
But sadly, it doesn't work.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(); }
Mind explaining what I'm doing wrong/ What I need to do?
i think you have to rebuild the npc map
so it updates its position as to not be there
Shouldn't you just do 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.Code:Region region = World.getWorld().getRegionManager().getRegionByLocation(npc.getSpawnLocation()); npc.removeFromRegion(region); World.getWorld().unregister(npc);
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.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |