Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • kepoly: 11 years ago, damn
      Today at 01:38:39 PM
    • B50: Sever error what happen
      May 22, 2018, 08:23:40 PM
    • The Soul: 10 years later
      May 21, 2018, 05:23:10 PM
    • The Soul: wow people are still here?
      May 21, 2018, 05:19:27 PM
    • Wilkooo: and apologies to the OG forum guys on behalf of that fudgewit dr house that pretty much killed this entire domain
      May 21, 2018, 04:14:28 PM
    • Wilkooo: shoutout to all those that played back in the beginning, all new people that hang around now seem to be pretty braindead
      May 21, 2018, 04:13:54 PM
    • Wilkooo: born sep 2016 - died whenever pink eggs resigned
      May 21, 2018, 04:11:29 PM
    • Wilkooo: Rip moparscape rsps
      May 21, 2018, 04:11:10 PM
    • puta loca: or what section can i ask this
      May 21, 2018, 05:45:08 AM
    • puta loca: does someoen has platinum ps v2 files?
      May 21, 2018, 05:44:59 AM
    • w azza 3: server down??
      May 21, 2018, 05:07:47 AM
    • charmie: rippppppppppppppppppppppppppppppppppppppppppppppp
      May 20, 2018, 09:03:41 PM
    • Tesco Value: eco reset? :o
      May 20, 2018, 08:54:27 PM
    • Tesco Value: aw is server down? :P
      May 20, 2018, 08:54:03 PM
    • mandmgalaxy: is the game down?
      May 20, 2018, 08:05:07 PM
    • bliss death: i believe 95% of the community disliked this change heavily as it came out of nowhere. and the fact you clear ironmen banks as well. terrible change. disappointed.
      May 20, 2018, 06:08:36 PM
    • bliss death: just wondering when the server is gonna be fixed and reverted
      May 20, 2018, 06:07:36 PM
    • Saltyspade10: I'll be back ;)
      May 15, 2018, 04:43:53 PM
    • Nunubuffs:[link]
      May 15, 2018, 12:06:25 PM
    • Nunubuffs: .info god
      May 15, 2018, 12:05:40 PM

    Author Topic: Changing back to config.java drops  (Read 1028 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 »
    RS2Ad banner

    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.
    RS2Ad banner

    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();
    RS2Ad banner

    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