Thread: [pi] killing npc receiveing item to inventory?

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 [pi] killing npc receiveing item to inventory? 
    Registered Member
    Join Date
    Nov 2012
    Posts
    84
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    317
    pi.
    been trying to do this for a while..
    came up with this so far.

    public void dropItems(int i) {
    int npc = 0;
    //long start = System.currentTimeMillis();
    Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    if(c != null) {
    if (npcs[i].npcType == 1160)
    c.getItems().addItem(965, 15); <----

    got no errors.. but when i kill it. i dont receive anything..

    Please help.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Dec 2012
    Posts
    105
    Thanks given
    6
    Thanks received
    6
    Rep Power
    11
    You need something like:

    " public void handleDungDeath(int i) {
    Client c = (Client) Server.playerHandler.players[npcs[i].spawnedBy];
    c.getItems().addItem(18349, 1);
    c.sendMessage("You receive a Chaotic rapier as a reward!");
    }"

    It is basically the same code as defeating jad, just search jad's npc code, and copy and rename the id's and name of the publics and your done.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Nov 2012
    Posts
    84
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    dont have jad on my server. so.. still need help.
    Reply With Quote  
     

  4. #4  
    need java lessons
    Eclipse's Avatar
    Join Date
    Aug 2012
    Posts
    4,436
    Thanks given
    686
    Thanks received
    898
    Rep Power
    490
    You already made a thread, I already made a snippet for you specifically.

    Quote Originally Posted by jerryrocks317 View Post
    i am 14 and have my own laptop im on almost 24/7 currently creating rsps lol so please get off my thread lol
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Nov 2012
    Posts
    84
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Your snippet did not work if it worked, i wouldnt be asking again.
    Reply With Quote  
     

  6. #6  
    Registered Member Illadelph's Avatar
    Join Date
    Dec 2012
    Age
    29
    Posts
    78
    Thanks given
    0
    Thanks received
    1
    Rep Power
    10
    Need this also.


    Let your past become your future.

    Reply With Quote  
     

  7. #7  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    where you added this method? should add it before you're setting the npc null.
    Reply With Quote  
     

  8. #8  
    need java lessons
    Eclipse's Avatar
    Join Date
    Aug 2012
    Posts
    4,436
    Thanks given
    686
    Thanks received
    898
    Rep Power
    490
    Quote Originally Posted by love2toke11 View Post
    Your snippet did not work if it worked, i wouldnt be asking again.
    It did work; multiple people did it. You just couldn't follow the directions correctly.

    Quote Originally Posted by jerryrocks317 View Post
    i am 14 and have my own laptop im on almost 24/7 currently creating rsps lol so please get off my thread lol
    Reply With Quote  
     

  9. #9  
    Registered Member Illadelph's Avatar
    Join Date
    Dec 2012
    Age
    29
    Posts
    78
    Thanks given
    0
    Thanks received
    1
    Rep Power
    10
    public void dropItems(int i) {
    int npc = 0;
    //long start = System.currentTimeMillis();
    Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    if (npcs[i].npcType == 1572) <-----
    c.getItems().addItem(1021, 1); <---
    if(c != null) {
    if (npcs[i].npcType == 912 || npcs[i].npcType == 913 || npcs[i].npcType == 914)
    c.magePoints += 1;
    if (NPCDrops.constantDrops.get(npcs[i].npcType) != null) {
    for (int item : NPCDrops.constantDrops.get(npcs[i].npcType)) {
    Server.itemHandler.createGroundItem(c, item, npcs[i].absX, npcs[i].absY, 1, c.playerId);
    //if (c.clanId >= 0)
    //Server.clanChat.handleLootShare(c, item, 1);
    }
    }

    Heres what i added. With this. i get an error that doesnt even have anything to do with this code.
    cannot find rare symbol..

    But when i add it here.

    public void dropItems(int i) {
    int npc = 0;
    //long start = System.currentTimeMillis();
    Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
    if(c != null) {
    if (npcs[i].npcType == 1572) <-----
    c.getItems().addItem(1021, 1); <---
    if (npcs[i].npcType == 912 || npcs[i].npcType == 913 || npcs[i].npcType == 914)
    c.magePoints += 1;
    if (NPCDrops.constantDrops.get(npcs[i].npcType) != null) {
    for (int item : NPCDrops.constantDrops.get(npcs[i].npcType)) {
    Server.itemHandler.createGroundItem(c, item, npcs[i].absX, npcs[i].absY, 1, c.playerId);
    //if (c.clanId >= 0)
    //Server.clanChat.handleLootShare(c, item, 1);
    }
    }

    Theres no errors. but theres no results. as in i dont receive that item when i kill the npc.


    Let your past become your future.

    Reply With Quote  
     

  10. #10  
    There's only 1Day2Die
    1Day2Die's Avatar
    Join Date
    Oct 2012
    Posts
    467
    Thanks given
    22
    Thanks received
    33
    Rep Power
    8
    npchandler.java search there for
    private void killed
    and add it above that

    if (npcs[i].npcType == 1160) {
    Client c = (Client)Server.playerHandler.players[npcs[i].spawnedBy];
    c.getItems().addItem(965, 15);
    will always let the monster drop your item. if u want it to drop a item on like uuh 10% add

    if (npcs[i].npcType == 1160) {
    Client c = (Client)Server.playerHandler.players[npcs[i].spawnedBy];
    int random = Misc.random(100);
    if(random >=10){
    c.getItems().addItem(965, 15);
    }
    }
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Replies: 50
    Last Post: 12-27-2012, 05:10 PM
  2. Replies: 10
    Last Post: 03-02-2011, 08:06 AM
  3. [Pi] Item Inventory
    By jakehop22 in forum Help
    Replies: 1
    Last Post: 08-30-2010, 08:52 AM
  4. Replies: 1
    Last Post: 10-12-2009, 11:26 PM
  5. Item when killing a player?
    By arr0wtohell in forum Help
    Replies: 12
    Last Post: 05-10-2009, 07:19 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •