The RuneLocus forum has been archived and does not accept new registrations.
Click here for more information, and click here to join the community on Discord.
Search the Community
Showing results for tags 'npc'.
The search index is currently processing. Current results may not be complete.
-
-Daily Updates -Daily Events -Dicing -A lot of Bosses(More than 23) -Prestiging (50+) -Custom teleporting commands/portals -Unique customs(More than 400!) -Donor ranks -Discord -active staff* -Worldwide community -Stable vpn -Dedicated host 99.5% uptime -Customs Minigames -Christmas Event -Sponsor's Rank -10-15 Active Players Daily ! -Customized Npc's As a PVM Server, our main focus is on Bossing. Currently we have more than 23 unique bosses! You can access them via the Portal at home. See you in-game!
-
I'm searching how i can rotate my NPC's. I've been searching so many tutorials, but non of them works. I have a customSpawns.txt, do i have to change it there ?
-
Hello, this is my first post here so hopefully I don't do anything wrong within this thread. I am what I would consider essentially new to RSPS development. Prior to picking up this source I had no Java experience but I am proficient in C++ and assembly. I'm a CS student and know my way around code in general, but don't know much about managing a package of this size or scale. I've been messing with my source on and off for a little over 2 months and have run into some snags that I can't work out on my own due to a lack of understanding and resources on the web. I have a 718+ Matrix source which *I think* is loading a 742 cache. I've worked through all the typical noob stuff of getting the server to compile, run, client connect, port forward, host it on a server, etc. To make this easier to read I'll simply list what I'm having the most trouble with. [LIST] [*]Large (and some small) NPC animations not working properly [*]NPC Spawning [*]Interface management [*] [/LIST] For the animation issue, I do know that it has to do with selecting the proper attack/defence animations in the NPCdefinitions file, but I have no idea where to get the proper animations from or how to narrow it down. NPC spawning, upon deleting my packed NPC spawn file I am getting an error while trying to generate the new packed file by running the server. The error is telling me there's an invalid spawn in my unpackedSpawns.txt. The weird thing is, I only get this error about half the time with the exact same spawns in the unpacked list. Interface management... where do I even begin. What kind of clusterfuck is the interface system? I don't even know where to start looking to try and edit existing interfaces or add one such as a quest tab server info pane. Also, when opening the popout equipment stats window, it opens fine and shows my stats as it should, but I can't click the equipment to unequip it without going back and using the tab interface to do it. Lastly, I would like to add items from another server as practice with cache management (just some 120 master capes and the mage and range versions of the kiln capes). I can find tutorials for loading entire caches but how do I edit just parts of my cache? Sorry if the post is too wordy or long, but I have looked all over and can't find specific enough answers for my situations. Also, I'd appreciate it if people would hold off on the "drop down to a lower source" comments as I don't really see the value in it since the mechanics between 317 and 700+ are completely different for what I'm struggling to do. EDIT*: The specific source is Project Runescape, I don't have the link but it is somewhere on the Runelocus forums, hopefully this helps. Thanks in advance, and I appreciate all genuine input.
- 4 replies
-
- 718
- animations
-
(and 3 more)
Tagged with:
-
So i'm trying to make a NPC that looks like a regular character in my game, and when I spawn it it spawns, and I can see the yellow dot on the minimap, but the npc is invisible. [CODE]if(i == 5000) { stream.currentOffset = streamIndices[630]; entityDef.aByte68 = 3; entityDef.readValues(stream); // Collect original NPC data entityDef.actions = new String[5]; entityDef.actions[1] = "Attack"; int changedColors = 1; // Number of model colors changed on the NPC entityDef.originalModelColors = new int[changedColors]; entityDef.modifiedModelColors = new int[changedColors]; entityDef.originalModelColors[0] = 40; // Original model color entityDef.modifiedModelColors[0] = 34; // Changed model color entityDef.models = new int[9]; entityDef.models[0] = 10653;//Npc's Cape entityDef.models[1] = 11718;//Npc's Head entityDef.models[2] = 11724;//Npc's Plate entityDef.models[3] = 11726;//Npc's Legs entityDef.models[4] = 4151;//Npc's Weapon entityDef.models[5] = 7462;//Npc's Gloves entityDef.models[6] = 11732;//Npc's Boots entityDef.models[7] = 17461;//Npc's Darkness(Shadow) entityDef.models[8] = 20147;//Npc's Arms(You Dont Have To Edit) entityDef.standAnim = 6001;// Npc's Stand Emote entityDef.name = "@[email protected] Warrior"; entityDef.combatLevel = 175;//Combat Level entityDef.description = "A warrior of GalaxyRS".getBytes(); }[/CODE]
-
Hello all, Im working on a 317 Sever and im trying to make a NPC talk via the talk to action for adding quests and other stuff however, all my goggle searches have simply returned making the npc talk with text above there head. could anyone link me to a thread that may help?
-
[QUOTE]java.lang.NullPointerException at com.xeno.content.combat.AggressiveNPC.execute(AggressiveNPC.java:24) at com.xeno.event.Event.run(Event.java:81) at com.xeno.model.World.processEvents(World.java:218) at com.xeno.model.World.tick(World.java:285) at com.xeno.GameEngine.tick(GameEngine.java:117) at com.xeno.Server.processEvents(Server.java:180) at com.xeno.Server.go(Server.java:116) at com.xeno.Main$1.run(Main.java:35) at java.lang.Thread.run(Unknown Source) java.lang.NullPointerException java.lang.NullPointerException java.lang.NullPointerException[/QUOTE] [CODE]package com.xeno.content.combat; import com.xeno.event.Event; import com.xeno.model.World; import com.xeno.model.npc.NPC; import com.xeno.model.player.Player; import com.xeno.util.Area; public class AggressiveNPC extends Event { public AggressiveNPC() { super(750); } [MENTION=15855]Over[/MENTION]ride public void execute() { for (NPC npc : World.getInstance().getNpcList()) { if (!npc.getDefinition().isAggressive()) { continue; } for (Player p : World.getInstance().getPlayerList()) { if (p != null && npc != null) { if (p.getLocation().getZ() == npc.getLocation().getZ()) { if (p.getLocation().inArea(npc.getMinimumCoords().getX(), npc.getMinimumCoords().getY(), npc.getMaximumCoords().getX(), npc.getMaximumCoords().getY())) { if (p.getLocation().inArea(npc.getLocation().getX() - 3, npc.getLocation().getY() - 3, npc.getLocation().getX() + 3, npc.getLocation().getY() + 3)) { if (!npc.isDead() && !npc.inCombat() && !npc.isDestroyed() && !npc.isHidden() && !p.inCombat() && ((npc.getDefinition().getCombat() >= (p.getLevels().getCombatLevel() * 2)) || Area.inWilderness(p.getLocation()))) { npc.setTarget(p); npc.setEntityFocus(p.getClientIndex()); npc.getFollow().setFollowing(p); } } } } } } } } }[/CODE] Help enyone?
-
Since a lot of people are beginning to use Asteria (based of runesource and heavily edited by lare96) I thought it would be helpful for members who wish to use that base and would like some NPC Spawns. Link: here Preview: { "npc-id": 1160, "position": { "x": 3479, "y": 9492, "z": 0 }, "walking-policy": { "coordinate": false, "radius": 0 } }[/CODE]
-
hey i am using a pretty good base to start with but i did notice that i can't attack 1npc, yes this npc is "Torag the Corrupted". now i know some basics of how it's passble. Note: other barrow brothers are attackable. I am did try to find a problem in this but i can't find it. this is what i have, barrows.java [CODE]// object,npc,HP,MAXHIT,ATTACK,DEFENCE,X,Y,TYPE, AHRIM(6821,2025, 1050, 20, 175, 175, 3556, 9701, 0), DHAROK(6771, 2026, 1000, 24, 200, 200, 3554, 9716, 1), GUTHAN(6773, 2027, 1000,24, 275, 200, 3538, 9702, 2), KARIL(6822, 2028,1050, 20, 175, 175, 3549, 9683, 3), TORAG(6772, 2029, 1000, 23, 275, 200, 3568, 9686, 4), VERAC(6823, 2030, 1000, 24, 275,200, 3575, 9706, 5);[/CODE] npcanims.xml [CODE]<npcDefinition> <id>2028</id> <name>karil the tainted</name> <examine>Run away!</examine> <respawn>10</respawn> <combat>98</combat> <hitpoints>100</hitpoints> <maxHit>21</maxHit> <attackSpeed>5</attackSpeed> <attackAnim>2075</attackAnim> <defenceAnim>-1</defenceAnim> <deathAnim>-1</deathAnim> </npcDefinition> <npcDefinition> <id>2029</id> <name>torag the corrupted</name> <examine>Run away!</examine> <respawn>10</respawn> <combat>115</combat> <hitpoints>100</hitpoints> <maxHit>23</maxHit> <attackSpeed>5</attackSpeed> <attackAnim>2068</attackAnim> <defenceAnim>-1</defenceAnim> <deathAnim>-1</deathAnim> </npcDefinition> <npcDefinition> <id>2030</id> <name>verac the defiled</name> <examine>Run away!</examine> <respawn>10</respawn> <combat>115</combat> <hitpoints>100</hitpoints> <maxHit>24</maxHit> <attackSpeed>5</attackSpeed> <attackAnim>2062</attackAnim> <defenceAnim>2063</defenceAnim> <deathAnim>-1</deathAnim>[/CODE] npc.cfg [CODE] npc = 2025 Ahrim_the_Blighted 98 100 npc = 2026 Dharok_the_Wretched 115 100 npc = 2027 Guthan_the_Infested 115 100 npc = 2028 Karil_the_Tainted 98 100 npc = 2029 Torag_the_Corrupted 115 100 npc = 2030 Verac_the_Defiled 115 100[/CODE] there is not 1 of them in spawnconfig since that is getting done in barrows.java. if someone could help me out shall be very helpfull since i am have no idea what i am missing :P
-
I'm still learning and reading what I can all the help is appreciated. [B]This is what it looked like before and it worked but i wanted to make it more simple and less bulky[/B] [code] if(componentId == OPTION_2) { stage = 13; if (player.getInventory().containsItem(####, 1)); if (player.getInventory().containsItem(#, 1)); if (player.getInventory().containsItem(####, 125)); player.getInventory().deleteItem(####, 1); player.getInventory().deleteItem(#, 1); player.getInventory().deleteItem(####, 125); sendNPCDialogue(npcId, 9827, "Alright thank you!, let me see what this design does for this particular item!"); } else if (player.getInventory().containsItem(####, 1));{ player.getInventory().deleteItem(####, 1); stage = 14; sendNPCDialogue(npcId, 9827, "OH you have a abyssal whip! may i see!"); break; } [/code] [B]This is what it looks like now but for some reason shes doing the else option but is skippiing the dialogue and going to another dialogue stage,[/B] [code] [B][I][COLOR="#00FF00"] } if(componentId == OPTION_2) { stage = 13; if (player.getInventory().containsItem(4151, 1) && player.getInventory().containsItem(1, 1) && player.getInventory().containsItem(20269, 125)){ player.getInventory().deleteItem(4151, 1); player.getInventory().deleteItem(1, 1); player.getInventory().deleteItem(20269, 125); sendNPCDialogue(npcId, 9827, "Alright thank you!, let me see what this design does for the whip"); } else if (player.getInventory().containsItem(4151, 1) && player.getInventory().containsItem(1, 1) && player.getInventory().containsItem(20269, 0)); stage = -2; sendNPCDialogue(npcId, 9827, "You are missing 125 noted infernal ashes"); }[/COLOR][/I][/B] < this works. [COLOR="#FF0000"]/**else if (player.getInventory().containsItem(4151, 1) && player.getInventory().containsItem(1, 0) && player.getInventory().containsItem(20269, 125)){ stage = -2; sendNPCDialogue(npcId, 9827, "Come back to me when you have a tool-kit"); } else if (player.getInventory().containsItem(451, 0) && player.getInventory().containsItem(1, 1) && player.getInventory().containsItem(20269, 125)){ stage = -2; sendNPCDialogue(npcId, 9827, "You are missing the Abyssal whip please come back you have one."); } else if (player.getInventory().containsItem(4151, 0) && player.getInventory().containsItem(1, 0) && player.getInventory().containsItem(20269, 0)){ stage = -2; sendNPCDialogue(npcId, 9827, "You are missing the abyssal whip, 1 tool-kit and 125 noted infernal ashes please come back you have them."); break; }**/[/COLOR][B]But I can't get her to do this I compile with no errors but if I add it in she skips all of this and goes straight to Stage 11.[/B] case 11: stage = 12; player.getInventory().addItem(####, #); sendNPCDialogue(npcId, 9827, "I've binded the items together and this is what happend to the staff it is truly remarkable"); break; case 12: stage = -2; sendNPCDialogue(npcId, 9827, "Please if you find any more please bring them to me!"); break; case 13: stage = 12; player.getInventory().addItem(4153, 1); sendNPCDialogue(npcId, 9827, "I've binded the items together and this is what happend to the whip it is truly remarkable"); break; default: end(); break; } } [MENTION=15855]Over[/MENTION]ride public void finish() { // TODO Auto-generated method stub } } [/code] [B]Another thing is IF you do have all the items then she is doing the main option's[/B] [code] player.getInventory().deleteItem(4151, 1); player.getInventory().deleteItem(1, 1); player.getInventory().deleteItem(20269, 125); [/code] [B]But then skips to and says[/B] [code] sendNPCDialogue(npcId, 9827, "You are missing 125 noted infernal ashes"); break; [/code]
-
I'm Still learning stuff i've been reading tutorials and figuring things out as I go. But [B]the problems I am having[/B] is the npc is [B]skipping case 0 and is going straight to case 1[/B]... Another thing is [B]even if I select a option[/B] at npc start talking [B]it goes straight to case 1 on all 3 starting options[/B] after case -1: Also sometimes when I add in certain cases it will tell me i have duplicate cases when I compile why is that? It's telling me I have Zero errors when I compile but it skips the dialogue i don't get it :/ If anyone is willing to help me that'd be great. [code] package com.rs.game.player.dialogues; import com.rs.utils.ShopsHandler; import com.rs.Settings; import com.rs.cache.loaders.NPCDefinitions; import com.rs.game.WorldTile; import com.rs.game.tasks.WorldTask; import com.rs.game.tasks.WorldTasksManager; import com.rs.game.World; import com.rs.game.Graphics; import com.rs.game.item.Item; public class Researcher extends Dialogue { private int npcId; [MENTION=15855]Over[/MENTION]ride public void start() { npcId = (Integer) parameters[0]; sendNPCDialogue(npcId, 9827, "Hello!, "+player.getDisplayName()+" Do you have any Ancient or Rare items for me to look at?" ); } [MENTION=15855]Over[/MENTION]ride public void run(int interfaceId, int componentId) { switch(stage) { case -1: stage = 0 sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "Who are you?", "Rare or Ancient items?", "I think found one of these ancient or rare items."); break; case 0: switch(componentId) { case OPTION_1: stage = 1; sendPlayerDialogue(9827, "Who are you?"); break; case OPTION_2: stage = 4; sendPlayerDialogue(9827, "Rare or Ancient items?"); break; case OPTION_3: stage = 8; sendPlayerDialogue(9827, "I think found one of these ancient or rare items, you were looking for."); break; } case 1: stage = 2; sendNPCDialogue(npcId, 9827, "Oh, Sorry for not introducing myself!. I am the head researcher in lumbridge castle I oversee all items, documents, and maps that come in or out."); break; case 2: stage = 3; sendNPCDialogue(npcId, 9827, "If you find anything you are un-sure about bring it to me and I'll take a look at it and see if I have any information on it. Some items I may even to restore power in it."); break; case 3: stage = 4; sendPlayerDialogue(9827, "What do these rare or ancient items include?"); break; case 4: stage = 5; sendNPCDialogue(npcId, 9827, "Well rumor has it there is a item that exist that can ###### increase magical damage. But nothing has been found to prove it is true. Unless someone could bring us the proof to show us other wise."); break; case 5: stage = 6; sendNPCDialogue(npcId, 9827, "But I doubt it, logic just doesn't support it. And well if we don't have it then it may just be a myth. unless shown other-wise."); case 6: stage = 7; sendNPCDialogue(npcId, 9827, "We've also found documentation about a design on the ###### bring one to me and I'll see what it does."); break; case 7: stage = -2; sendNPCDialogue(npcId, 9827, "I forgot to mention for me to do anything with any item I'll need #### and a #####."); break; case 8: stage = 9; sendNPCDialogue(npcId, 9827, "Really let me have a look!"); break; case 9: sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "######", "######"); stage = 10; break; case 10: switch(componentId) { case OPTION_1: stage = 11; if (player.getInventory().containsItem(#####, 1)); if (player.getInventory().containsItem(#####, 1)); if (player.getInventory().containsItem(#####, 1)); player.getInventory().deleteItem(#####, 1); player.getInventory().deleteItem(#####, 1); player.getInventory().deleteItem(#####, 1); player.getInventory().deleteItem(#, 1); player.getInventory().deleteItem(#####, 125); player.getInventory().addItem(#####, 1); sendNPCDialogue(npcId, 9827, "Oh my this is the #####. I can't believe my eyes that a item like this truly exist!"); break; case OPTION_2: stage = 13; if (player.getInventory().containsItem(#####, 1)); if (player.getInventory().containsItem(#, 1)); if (player.getInventory().containsItem(#####, 125)); player.getInventory().deleteItem(####, 1); player.getInventory().deleteItem(#, 1); player.getInventory().deleteItem(#####, 125); player.getInventory().addItem(#####, 1); sendNPCDialogue(npcId, 9827, "Alright thank you!, let me see what this design does for this particular item!"); break; } case 11: stage = 13; sendNPCDialogue(npcId, 9827, "I've binded the items together and this is what happend to the ##### it is truly remarkable"); break; case 12: stage = -2; sendNPCDialogue(npcId, 9827, "Please if you find any more please bring them to me!"); break; case 13: stage = 13; sendNPCDialogue(npcId, 9827, "I've binded the items together and this is what happend to the ##### it is truly remarkable"); break; default: end(); break; } } [MENTION=15855]Over[/MENTION]ride public void finish() { // TODO Auto-generated method stub } } [/code] another thing why the heck is this a thing on the forums? when trying to make a thread title... Tags cannot be overly common words (why)., Tags cannot be overly common words (but) [B]i've tried naming this as dialogue no errors but npc skips stages and the forum said i can't use but that's stupid.[/B] its not like i'm useing repeated words.
-
Hi , Would anybody be able to help me in this question I Kill some NPCs in my server, but Sometimes if I move or eat the drop doesnt appear on the floor, what would be the cause of this?
-
Hi all. I have recently just deleted my packedDrops.d from the source I am using as I was trying to update drops for several NPCs. When I run the server in Eclipse I get the following error [code] [Launcher] Running Server... ERROR! THREAD NAME: main java.io.FileNotFoundException: data/npcs/packedDrops.d (No such file or directory) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.<init>(RandomAccessFile.java:241) at java.io.RandomAccessFile.<init>(RandomAccessFile.java:122) at com.rs.utils.NPCDrops.loadPackedNPCDrops(NPCDrops.java:62) at com.rs.utils.NPCDrops.init(NPCDrops.java:20) at com.rs.Launcher.main(Launcher.java:67) [Launcher] Server took 2858 milli seconds to launch. [/code] The Server runs fine, just that NPC's don't drop nothing. Obviously... I have tried to recreate packedDrops.d, but nothing is happening. Also, the source came with a Drop Editor which is really handy, but I'm unable to run it on my Mac. I know that *.bat files are not able to run on Mac's but I know that *.sh or *.command are a Mac equivalent to Windows *.bat file. I have Googled about trying to convert it to .command or anything that will make it run. But I can't seem to get it right. If someone could help me with this, I will be very grateful! If you need the file contents, post and I'll post them if needed. Thanks Majorly! Stoneyz.
-
718/742 source Hey there I got the following proplem and cant seem to figure out how to fix it. For example sergeant steelwill has a chance to drop 3 sharks when killed. If I get that drop the drop pile only shows 1 shark in the pile, but when I pick it up, it picks up 3 like it should. Now I want to fix it so it shows up 3 sharks in the drop pile. I've been looking through: NPC.java (sendDrop method), Drop.java, and every .java that has the word: groundItem in it... If anyone could point me in the right direction I would greatly appreciate it.
-
Im having this problems with Rex and Prime Daggonoth, supreme is good. They can attack me, and they hit high. But when I try to attack them, I dont even hit a 0 lol. If you can help me, please <3:(:(:(:confused:
-
Most the NPC's on my server will not respawn. It also will not make packedspawns? If you need anymore codes I will post them. Really need this guys My NPCSpawn - I tried deleting the packed folder which did nothing really, the NPC's slowly stop respawning. I killed bandos twice then it completely stopped. [code] package com.rs.utils; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.channels.FileChannel.MapMode; import java.util.ArrayList; import java.util.List; import com.rs.cache.loaders.NPCDefinitions; import com.rs.game.World; import com.rs.game.WorldTile; import com.rs.game.npc.NPC; public final class NPCSpawns { private static final Object lock = new Object(); public static boolean addSpawn(String username, int id, WorldTile tile) throws Throwable { synchronized(lock) { File file = new File("data/npcs/spawns.txt"); BufferedWriter writer = new BufferedWriter(new FileWriter(file, true)); writer.write("// "+NPCDefinitions.getNPCDefinitions(id).name+", "+NPCDefinitions.getNPCDefinitions(id).combatLevel+", added by: "+username); writer.newLine(); writer.flush(); writer.write(id+" - "+tile.getX()+" "+tile.getY()+" "+tile.getPlane()); writer.newLine(); writer.flush(); World.spawnNPC(id, tile, -1, true); return true; } } public static boolean removeSpawn(NPC npc) throws Throwable { synchronized(lock) { List<String> page = new ArrayList<>(); File file = new File("data/npcs/spawns.txt"); BufferedReader in = new BufferedReader(new FileReader(file)); String line; boolean removed = false; int id = npc.getId(); WorldTile tile = npc.getRespawnTile(); while((line = in.readLine()) != null) { if(line.equals(id+" - "+tile.getX()+" "+tile.getY()+" "+tile.getPlane())) { page.remove(page.get(page.size()-1)); //description removed = true; continue; } page.add(line); } if(!removed) return false; file.delete(); BufferedWriter writer = new BufferedWriter(new FileWriter(file)); for(String l : page) { writer.write(l); writer.newLine(); writer.flush(); } npc.finish(); return true; } } public static final void init() { if (!new File("data/npcs/packedSpawns").exists()) packNPCSpawns(); } private static final void packNPCSpawns() { Logger.log("NPCSpawns", "Packing npc spawns..."); if (!new File("data/npcs/packedSpawns").mkdir()) throw new RuntimeException( "Couldn't create packedSpawns directory."); try { BufferedReader in = new BufferedReader(new FileReader( "data/npcs/unpackedSpawnsList.txt")); while (true) { String line = in.readLine(); if (line == null) break; if (line.startsWith("//")) continue; String[] splitedLine = line.split(" - ", 2); if (splitedLine.length != 2) throw new RuntimeException("Invalid NPC Spawn line: " + line); int npcId = Integer.parseInt(splitedLine[0]); String[] splitedLine2 = splitedLine[1].split(" ", 5); if (splitedLine2.length != 3 && splitedLine2.length != 5) throw new RuntimeException("Invalid NPC Spawn line: " + line); WorldTile tile = new WorldTile( Integer.parseInt(splitedLine2[0]), Integer.parseInt(splitedLine2[1]), Integer.parseInt(splitedLine2[2])); int mapAreaNameHash = -1; boolean canBeAttackFromOutOfArea = true; if (splitedLine2.length == 5) { mapAreaNameHash = Utils.getNameHash(splitedLine2[3]); canBeAttackFromOutOfArea = Boolean .parseBoolean(splitedLine2[4]); } addNPCSpawn(npcId, tile.getRegionId(), tile, mapAreaNameHash, canBeAttackFromOutOfArea); } in.close(); } catch (Throwable e) { Logger.handle(e); } } public static final void loadNPCSpawns(int regionId) { File file = new File("data/npcs/packedSpawns/" + regionId + ".ns"); if (!file.exists()) return; try { RandomAccessFile in = new RandomAccessFile(file, "r"); FileChannel channel = in.getChannel(); ByteBuffer buffer = channel.map(MapMode.READ_ONLY, 0, channel.size()); while (buffer.hasRemaining()) { int npcId = buffer.getShort() & 0xffff; int plane = buffer.get() & 0xff; int x = buffer.getShort() & 0xffff; int y = buffer.getShort() & 0xffff; boolean hashExtraInformation = buffer.get() == 1; int mapAreaNameHash = -1; boolean canBeAttackFromOutOfArea = true; if (hashExtraInformation) { mapAreaNameHash = buffer.getInt(); canBeAttackFromOutOfArea = buffer.get() == 1; } World.spawnNPC(npcId, new WorldTile(x, y, plane), mapAreaNameHash, canBeAttackFromOutOfArea); } channel.close(); in.close(); } catch (Throwable e) { Logger.handle(e); } } private static final void addNPCSpawn(int npcId, int regionId, WorldTile tile, int mapAreaNameHash, boolean canBeAttackFromOutOfArea) { try { DataOutputStream out = new DataOutputStream(new FileOutputStream( "data/npcs/packedSpawns/" + regionId + ".ns", true)); out.writeShort(npcId); out.writeByte(tile.getPlane()); out.writeShort(tile.getX()); out.writeShort(tile.getY()); out.writeBoolean(mapAreaNameHash != -1); if (mapAreaNameHash != -1) { out.writeInt(mapAreaNameHash); out.writeBoolean(canBeAttackFromOutOfArea); } out.flush(); out.close(); } catch (Throwable e) { Logger.handle(e); } } private NPCSpawns() { } } [/code]
- 3 replies
-
- npc
- packedspawns
-
(and 1 more)
Tagged with:
-
Trying to make Hans say something in lumbridge (not out loud but in a dialogue) but it doesn't work. Help please :emb:
-
How to make an NPC walk to a specified location? i wanted npc walk to specified coords like npc.forceWalkRespawnTile(); but i want my coords! any can help me?
-
Im using the rune evo 3 source. There are certain npc's that dont spawn. Like general gradoor, once you kill him he dosent re spawn again. Also fight caves dosent work all the time. Its stuck at level 2 most of the time. I need help resolving the general gradoor issue!
-
[CENTER][B]Hi Runelocus, I would prefer to make a helpful entry into the community, rather than ask for things. So to start of my time here, I thought I would make a tutorial on a really handy command that I've used in all projects in the 666 and 667 revisions. The original npc spawn command, onyl temporarily spawns the npc in, once the server is restarted the npc's dissapear. To save hassle of getting coordinates ingame and typing them in unpackedSpawns.txt, I've made a simple command which gets the players coordinates, the npc id they type in and writes it into a file you have specified in the path. I will paste the command below and explain how each part works and what it does. [/B] [B]Files needed : commands.java Skills needed : Ctrl + C & Ctrl + V Difficulty : 1/10[/B] [QUOTE] if (cmd[0].equalsIgnoreCase("permspawn") && (player.getUsername().equalsIgnoreCase("Your Name Here"))) { try { World.spawnNPC(Integer.parseInt(cmd[1]), player, -1, true, true); BufferedWriter bw = new BufferedWriter(new FileWriter( "./data/npcs/unpackedSpawns.txt", true)); bw.write("//Spawned in using Le Vieux Perm Spawn Command"); bw.newLine(); bw.write(Integer.parseInt(cmd[1])+" - " + player.getX() + " " + player.getY() + " " + player.getPlane()); bw.flush(); bw.newLine(); bw.close(); } catch (Throwable t) { t.printStackTrace(); } return true; }[/QUOTE] [B]The first line [/B][QUOTE]if (cmd[0].equalsIgnoreCase("[COLOR="#0000FF"]permspawn[/COLOR]") && (player.getUsername().equalsIgnoreCase("[COLOR="#FF0000"]Your Name Here[/COLOR]"))) {[/QUOTE][B] basically says, if the user types permspawn into the console and the players username equals something, It will continue on to execute a piece of code. Edit the [COLOR="#0000FF"]blue[/COLOR] text to what you want a player to enter when permanently spawning a npc in, so something like 'permnpc' or 'permspawnnpc'. After you've done that, continue on to edit the [COLOR="#FF0000"]red[/COLOR] text, put your owner's name into here, this means only the players name you enter will be able to type this command.[/B] [B]The chunk of code after that[/B] [QUOTE] try { World.spawnNPC(Integer.parseInt(cmd[1]), player, -1, true, true); BufferedWriter bw = new BufferedWriter(new FileWriter( "[COLOR="#00FF00"]./data/npcs/unpackedSpawns.txt[/COLOR]", true));[/QUOTE] [B]Basically means, it will get the integer the user has typed after the command ( the npc id ) , it then 'prepares to write in the file specified', edit the [COLOR="#00FF00"]green[/COLOR] text to the file you currently spawn npc's in. So if it was in 'source/data/npcs/npcspawnfile.txt' you would replace the green text with ./data/npcs/npcspawnfile.txt . The final piece of code [/B][QUOTE] bw.write("//Spawned in using Le Vieux Perm Spawn Command"); bw.newLine(); bw.write(Integer.parseInt(cmd[1])+" - " + player.getX() + " " + player.getY() + " " + player.getPlane()); bw.flush(); bw.newLine(); bw.close(); } catch (Throwable t) { t.printStackTrace(); } return true; }[/QUOTE][B] This code writes a comment on the next line available, 'bw.newLine();' means it will now basically press enter, and move to the next line. [QUOTE]bw.write(Integer.parseInt(cmd[1])+" - " + player.getX() + " " + player.getY() + " " + player.getPlane());[/QUOTE] This line of code takes the npc id the user has typed after the command, the player's x position, the player's y position and the player's z position. So ingame if I was to type 'permspawn 73' while in edgeville which has the x coords of - 3468 and the y coords of - 3467 and the z coords of - 0, unpackedSpawns.txt would then have a new line that would say 73 - 3468 3467 0 . Finally add 2 imports at the top of your command.java unless they are already there, find [QUOTE]import com.rs.game.WorldTile;[/QUOTE] and below that add [QUOTE]import com.rs.game.NPC; import com.rs.utils.NPCSpawns;[/QUOTE] . This means all you have to do is delete the folder called packedSpawns and recompile and run your server. Now the npc you spawned in before you compiled should be there, this also solved a few errors that people were having with npc's not moving or attacking you. [B]Also if anyone wants the full code, here is a pastebin link with it - [/B][COLOR="#0000FF"]http://pastebin.com/1A5Rs2fW[/COLOR] Hopefully this has helped some people, if you have any more suggestions and improvements please feel free to post them below. Expect more tutorials soon :)[/B][/CENTER]
-
Hello runelocus community! After recently moving to the 667 revision, I'm a little bit stuck, I have around about 300 npc's I need to spawn, and I really, really cannot be bothered to get the coordinates of each and have to type 300 lines out. I've been searching all over the internet, and the closest thing i came to was this : [CODE]case "npc": try { World.spawnNPC(Integer.parseInt(cmd[1]), player, -1, true, true); BufferedWriter bw = new BufferedWriter(new FileWriter( "./spawns/npc.txt", true)); bw.write("//" + NPCDefinitions.getNPCDefinitions(Integer.parseInt(cmd[1])).name + " spawned by "+ player.getUsername()); bw.newLine(); bw.write(Integer.parseInt(cmd[1])+" - " + player.getX() + " " + player.getY() + " " + player.getPlane()); bw.flush(); bw.newLine(); bw.close(); } catch (Throwable t) { t.printStackTrace(); } return true;[/CODE] What this does is close to what i need done, but this for 714. Is there anyone out there who could help me make a command, which spawns a zombie ( npc id of 73 ) on the players coordinates, at the time they write the command. It then writes the id, coords, plane etc, and logs it in NPCSpawning.java. Thanks!
-
Out of no where, the NPC's started disconnecting players whenever they try to attack an npc. WHATS HAPPENING? Here is a little gif overview of it: [URL=http://www.makeagif.com/OUCLTN][IMG]http://cdn.makeagif.com/media/8-11-2014/OUCLTN.gif[/IMG][/URL] DOES ANYONE KNOW WHAT'S CAUSING THIS AND/OR FIX THIS? Would really love it if someone would help me out here.
- 2 replies
-
- attack
- disconnect
-
(and 2 more)
Tagged with:
-
Hello i have a custom npc "Astro Mage" and when i attack it it only has 1 hp so its useless i was wondering if someone could help me out heres the codes i have so far Unpacked bonuses [CODE]8335 - 2000 2000 2000 2000 2000 400 500 500 500 400[/CODE] unpackedcombatdefinitionsList [CODE]8335 - 1000 -1 -1 -1 5 0 10 300 SPECIAL -1 -1 AGRESSIVE[/CODE] Help me <3
-
I was just wondering how I would change, for example, King Roald's name in his dialogue to King Fortis. I can't seem to figure it out myself or find any tutorials on it. Note that I'm looking for how to change it at the top of the dialogue box, not the NPC's actual name. I already did that part. Thanks!