Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • Emulous: Come check out Emulous: [link]
      Today at 03:37:19 PM
    • Emulous:[link]
      Today at 03:37:00 PM
    • Travas: ur mom
      July 21, 2018, 06:04:50 PM
    • YNRDAB: Watcha big ballers up too?
      July 20, 2018, 11:01:06 AM
    • dark250: i need help for coding client
      July 19, 2018, 08:27:37 AM
    • Travas: yes
      July 14, 2018, 02:19:44 PM
    • drubrkletern: lmao racist and sexist much?
      July 14, 2018, 01:11:52 PM
    • Cole1497: yeah i got you lil boat give me a second
      July 13, 2018, 03:19:35 AM
    • B0ATY.: yo can anyone unban my ip, i got banned for saying i hope someone gets aids :p
      July 12, 2018, 09:16:00 PM
    • jme: ziplock this domain belongs to the kremlin now
      July 12, 2018, 06:54:31 PM
    • Pure_: lol
      July 12, 2018, 01:37:47 PM
    • ziplock: wtf is this forum? Haven't checked in in 4 years lmao
      July 11, 2018, 10:26:03 AM
    • ziplock: Idk
      July 11, 2018, 10:25:41 AM
    • _^_: guys is anyone still even here
      July 11, 2018, 01:54:43 AM
    • Travas: gay
      July 08, 2018, 02:00:14 PM
    • CheapOnlineHost: Hosting starting at $0.75 hostcheap.io
      July 08, 2018, 09:35:20 AM
    • q1w1e1r1t1y: is the server actually updating or is it down?? trying to log on for the first time in a few months and it says "server updating try again in 1 minute" for the last 10 minutes now
      July 07, 2018, 11:11:51 PM
    • Cole1497: gamers unite
      July 07, 2018, 04:26:07 PM
    • IamLation: LMFAO @cole
      July 06, 2018, 10:36:52 AM
    • drubrkletern: olfihsouhdiu
      July 04, 2018, 04:25:32 PM

    Author Topic: Changing back to config.java drops  (Read 1046 times)

    0 Members and 1 Guest are viewing this topic.

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Changing back to config.java drops
    « on: February 13, 2016, 11:23:24 PM »
    Right now my drop system is completely weird , i don't understand it at all i had thought all my drops were handled inside of config.java but there not, its in this file called json so basically it's in Data/json/drops i want my drops for npc's to be pulled from config.java.
    « Last Edit: February 13, 2016, 11:25:37 PM by tank nation »
    Runescape Gambling

    OfflineSoulxs

    • Member
    • ***
    • Posts: 131
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #1 on: February 14, 2016, 07:58:30 AM »
    When a NPC dies it will request a drop, backtrack and find out where it defines where to load the drops from. Then change that back to config.
    Runescape Gambling

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #2 on: February 14, 2016, 02:05:58 PM »
    When a NPC dies it will request a drop, backtrack and find out where it defines where to load the drops from. Then change that back to config.

    Here is a couple of things i found, now i wasnt sure on how the config file would come in to play. Would it go something like this if i went to change the drops on the json final: ./Server/src/server/Config.java? Considering you don't know where my config file is it's in the source folder it's self then when i click on src folder it says server then config.

    Code: [Select]
    public static final void load() {
    final Gson gson = new Gson();
    final File dir = new File("./Data/json/drops/");

    for (final File file : dir.listFiles()) {
    try (final BufferedReader parse = new BufferedReader(
    new FileReader(file))) {
    System.out.println(file.getName());
    final NPCLootTable table = gson.fromJson(parse,
    NPCLootTable.class);

    for (final int key : table.npcIdentifiers) {
    DROP_TABLE_REPO.put(key, table);
    }
    } catch (IOException e) {
    System.out.println("ERROR IN: " + file.getName());
    e.printStackTrace();
    }
    }
    }
    }

    Code: [Select]
    public static final String DEFINITION_FILE = "Data/json/npc_definitions.json";
    public static final String SPAWN_FILE = "Data/json/npc_spawns.json";

    Code: [Select]
    writer.write("// id, x, y, z, walking type");
    writer.newLine();
    for (int i2 = 0; i2 < NPCHandler.npcs.length; i2++) {
    NPC n1 = NPCHandler.npcs[i2];
    if (n1 == null)
    continue;
    NPCDefinition nl = n1.getDefinition();
    writer.write("spawn\t=\t" + nl.translationId + "\t" + n1.absX + "\t" + n1.absY + "\t" + n1.heightLevel + "\t" + n1.walkingType);
    writer.newLine();
    }
    writer.write("[ENDOFSPAWNLIST]");
    writer.flush();

    reader.close();
    Runescape Gambling

    Offlinelare69

    • Member
    • ****
    • *
    • Posts: 5,322
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #3 on: February 14, 2016, 08:15:32 PM »
    why would you want that... just use the json files
    hi. check out luna:)

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #4 on: February 17, 2016, 09:17:10 PM »
    why would you want that... just use the json files

    How is the rarity like can you tell me how these drops work i don't understand them. Here's what they look like.


    OfflineTree

    • Member
    • ****
    • Posts: 2,638
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #5 on: February 17, 2016, 09:49:43 PM »
    why would you want that... just use the json files

    How is the rarity like can you tell me how these drops work i don't understand them. Here's what they look like.



    Quote
    <_^_> this community has really collapsed
    <_^_> it is like a shitty version of friendster for washed up nerds

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #6 on: February 17, 2016, 10:21:20 PM »
    why would you want that... just use the json files

    How is the rarity like can you tell me how these drops work i don't understand them. Here's what they look like.





    All i need to know is what is the rarity like for this coding, i basically understand what's what but i just don't get the hitrollceil ik this is the rarity of the drops but is 100 always or what is 0.1 or what i don't get it.

    OfflineTree

    • Member
    • ****
    • Posts: 2,638
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #7 on: February 17, 2016, 11:07:40 PM »
    why would you want that... just use the json files



    How is the rarity like can you tell me how these drops work i don't understand them. Here's what they look like.





    All i need to know is what is the rarity like for this coding, i basically understand what's what but i just don't get the hitrollceil ik this is the rarity of the drops but is 100 always or what is 0.1 or what i don't get it.

    Follow the code.
    « Last Edit: February 17, 2016, 11:44:21 PM by Tree »
    Quote
    <_^_> this community has really collapsed
    <_^_> it is like a shitty version of friendster for washed up nerds

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #8 on: February 18, 2016, 09:32:48 AM »
    You know how easy it is to "convert" a drop system. All you do is replace code with other code.
    https://www.rune-server.ee/runescape-development/google/tutorials/251287-completely-rewrite-drops-pi.html
    Oh look, a tutorial on the drop system. Now what would happen if you replaced your system with it?

    Since you "Can't understand" the code for the current drop system, you'll have to manually input the data from the json files into your Config.java.
    Or..:

    why would you want that... just use the json files

    How is the rarity like can you tell me how these drops work i don't understand them. Here's what they look like.





    All i need to know is what is the rarity like for this coding, i basically understand what's what but i just don't get the hitrollceil ik this is the rarity of the drops but is 100 always or what is 0.1 or what i don't get it.
    Like tree said.. The code tells you what it does...

    If you really can't understand it; this is what you do:
    A) Post the code so someone can explain it to you. No, not pictures of the json files, not the json files, the code reading and using the json files.
    B) Read more about the language so you can understand it.
    C) Give up.

    The choice is yours.

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #9 on: February 18, 2016, 03:39:26 PM »
    You know how easy it is to "convert" a drop system. All you do is replace code with other code.
    https://www.rune-server.ee/runescape-development/google/tutorials/251287-completely-rewrite-drops-pi.html
    Oh look, a tutorial on the drop system. Now what would happen if you replaced your system with it?

    Since you "Can't understand" the code for the current drop system, you'll have to manually input the data from the json files into your Config.java.
    Or..:

    why would you want that... just use the json files

    How is the rarity like can you tell me how these drops work i don't understand them. Here's what they look like.





    All i need to know is what is the rarity like for this coding, i basically understand what's what but i just don't get the hitrollceil ik this is the rarity of the drops but is 100 always or what is 0.1 or what i don't get it.
    Like tree said.. The code tells you what it does...

    If you really can't understand it; this is what you do:
    A) Post the code so someone can explain it to you. No, not pictures of the json files, not the json files, the code reading and using the json files.
    B) Read more about the language so you can understand it.
    C) Give up.

    The choice is yours.

    i followed the tutorial and drops are not being dropped from the npcs any help with that? I believe there's something missing.
    « Last Edit: February 18, 2016, 10:08:50 PM by tank nation »

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #10 on: February 18, 2016, 11:12:36 PM »
    Use debugging.
    Place a statement like this in the dropitems method to see if it's being executed..
    Code: Java
    1. System.out.println("Dropping.");

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #11 on: February 19, 2016, 01:17:28 AM »
    Use debugging.
    Place a statement like this in the dropitems method to see if it's being executed..
    Code: Java
    1. System.out.println("Dropping.");

    does nothing.

    Code: [Select]
    public void dropItems(int i) {
    int npc = 0;
    Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    if(c != null) {
    for(int o = 0; o < c.barrowsNpcs.length; o++){
    if(npcs[i].npcType == c.barrowsNpcs[o][0]) {
    c.barrowsNpcs[o][1] = 2; // 2 for dead
    c.barrowsKillCount++;
    }
    }
    if (npcs[i].npcType == 912 || npcs[i].npcType == 913 || npcs[i].npcType == 914)
    c.magePoints += 1;

    for(npc = 0; npc < Config.NPC_DROPS.length; npc++){
    if(npcs[i].npcType == Config.NPC_DROPS[npc][0]) {
    if(Misc.random(Config.NPC_DROPS[npc][3]) == 0) {
    Server.itemHandler.createGroundItem(c, Config.NPC_DROPS[npc][1], npcs[i].absX, npcs[i].absY, Config.NPC_DROPS[npc][2], c.playerId);
    System.out.println("Dropping.");
    « Last Edit: February 19, 2016, 01:28:36 AM by tank nation »

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #12 on: February 19, 2016, 11:09:57 AM »
    If it does nothing then it's not being executed.
    It's that simple.

    You know what you get to do (key word: you)? Find out why.

    First things first: Check if the dropItems(int i) method is used. Just literally search for "dropItems(" in the class, there should be at minimal 2 results. 1 being the method, and 1 being when it's used. If you only get 1 result, that's your problem.

    Next: If the method is being used, you get to try 2 things. 1) Add a similar debugging statement ABOVE where the method is used 2) Spawn npc 1 (man) and kill it. Check for drops and for the new debugging message.

    The reason you're killing a man is because that npc is in the npc list the OP provided for the tutorial.

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #13 on: February 19, 2016, 12:57:39 PM »
    If it does nothing then it's not being executed.
    It's that simple.

    You know what you get to do (key word: you)? Find out why.

    First things first: Check if the dropItems(int i) method is used. Just literally search for "dropItems(" in the class, there should be at minimal 2 results. 1 being the method, and 1 being when it's used. If you only get 1 result, that's your problem.

    Next: If the method is being used, you get to try 2 things. 1) Add a similar debugging statement ABOVE where the method is used 2) Spawn npc 1 (man) and kill it. Check for drops and for the new debugging message.

    The reason you're killing a man is because that npc is in the npc list the OP provided for the tutorial.

    K now on the rockcrab its show the message dropping like so.

    Code: [Select]
    public void dropItems(int i) {
    int npc = 0;
    Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    if(c != null) {
    System.out.println("Dropping.");
    for(int o = 0; o < c.barrowsNpcs.length; o++){
    if(npcs[i].npcType == c.barrowsNpcs[o][0]) {
    c.barrowsNpcs[o][1] = 2; // 2 for dead
    c.barrowsKillCount++;
    }
    }
    if (npcs[i].npcType == 912 || npcs[i].npcType == 913 || npcs[i].npcType == 914)
    c.magePoints += 1;

    OfflineTree

    • Member
    • ****
    • Posts: 2,638
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #14 on: February 19, 2016, 10:05:08 PM »
    Dude, go figure it out.
    Quote
    <_^_> this community has really collapsed
    <_^_> it is like a shitty version of friendster for washed up nerds

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: Changing back to config.java drops
    « Reply #15 on: February 20, 2016, 01:07:58 PM »
    Dude, go figure it out.

    Dude ok, will do! haha nah im honestly done with rsps it's pretty annoying and old fashion to many servers out as it is. I wanna create my own game ect.. i'm actually gonna learn to write java the right way this time before i go and waste 2k questions lol.

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal