Thread: FULLY understand Npc drops

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 FULLY understand Npc drops 
    Kurt
    Guest
    Purpose: To help people understand drops fully.

    Difficulty: 1/10

    Assumed Knowledge: Not hard, just.. Sense?

    Server Base: My new server ( In progress ).

    Classes Modified: Hmm.. Item.java, Item2.java, Item3.java, Autospawn ( Depends ) Npchandler.java.

    Procedure
    Step 1: Firstly, I'll take you through making a npc drop a item 100% of the time.


    Code:
    if(npcs[NPCID].npcType == 2745) 
    {
    ItemHandler.addItem(Item2.randomJad(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);
    Ok.. Lets start.. You see
    Code:
    (Item2.randomJad()
    ,That means that the item what Jad is going to drop is in Item2.randomJad. So if you wish to change, go into Item2.java and search Item2.Randomjad and change the object.

    Ok you can see

    Code:
    if(npcs[NPCID].npcType == 2745)
    2745 = TzTok-jad Npcid. So that means that you want that npc id to drop out of Item2.randomjad.

    Ok in my Item2.java in randomjad it says

    Code:
    {1052,6585,1409,4131,4151,1377,6082,1052,6585,1409,4131,4151,1377,6082,1052,6585,1409,4131,4151,1377,6082,1052,6585,1409,4131,4151,1377,6082,1052,6585,1409,4131,4151,1377,6082,1052,6585,1409,4131,4151,1377,6082,1052,6585,1409,4131,4151,1377,6082,1052,6585,1409,4131,4151,1377,6082,1052,6585,1409,4131,4151,1377,6082,1052,6585,1409,4131,4151,1377,6082,6570,1149};
    There is around 50? Idk item ids there, so that means 6570 (Fire cape) Would have 1/50 chance to drop.

    Say you changed half of them to 6570, that means Fire cape would have 50% chance to drop or 25/50

    If you wanted it to drop 6570 100/100 or 100% ( Whichever way you prefer ) you would add only 1 item id and it would be 6570.

    Step 2: Ok, now we will get to grips with Random drops.

    Lets take this for example.


    Code:
    if(npcs[NPCID].npcType == 2029) 
    {
    ItemHandler.addItem(Item2.randomTorag(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);
    }
    This means, once again.. In Item2.randomTorag you will see what torag drops.

    This is mine

    Code:
    public static int Torag[] = {4745,4747,4749,4751};
    
        public static int randomTorag()
    {Ok.. It has 1/4 chance to drop a piece of Torags. Or 25%. Now say you wanted it to drop 4745 ( Hammer I tink. ) 4/10. You would add 3 more 4745's to the list then 1 more of each of the other Ids. Now you have 2/10 for the other pieces and 4/10 for the hammers.

    Say you wanted abby demons to drop a whip 1/300 you would add 1 4151 ( Whip id ) and 299 other things ( anything ). Now you would get 1 whip per 300 kills ( early if your lucky xD )


    Step 3: Working with Npchandler. Ok, you still dont understand? I'll break it down for you.


    Code:
    if(npcs[NPCID].npcType == 50) {
    ItemHandler.addItem(Item2.randomKBD(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);
    }
    Ok, 50 = King black dragon, that is it's npc id. Item2.randomKbd is were the drops come from, so if you open up item2.java and search kbd, you would see all the objects. Were is says "Random" it means a random item of that.

    I found this helpful to me when I didnt even know how to spawn a npc

    creds -kurt
     

  2. #2  
    O I K 0 I O
    Guest
    Wow, THanks for this tutorial R3P if i could ,

    Thanks again though,

    K0
     

  3. #3  
    Kurt
    Guest
    No problem, glad it told you somthing you did not know
     

  4. #4  
    Dharok
    Guest
    You could have explained it a little better, remember some of the poeple here barely know a thing about java when they are newbs. Try explaining it so that a monkey could get it.
     

  5. #5  
    Dan
    Dan is offline
    Community Veteran

    Dan's Avatar
    Join Date
    Oct 2006
    Age
    27
    Posts
    2,658
    Thanks given
    253
    Thanks received
    135
    Rep Power
    2754
    Thanks for this,
    It's not bad
     

  6. #6  
    Kurt
    Guest
    Ill edit it more, lol
     

  7. #7  
    my rep is h4x0r3d


    Join Date
    Dec 2006
    Posts
    1,760
    Thanks given
    10
    Thanks received
    8
    Rep Power
    207
    Couple things.
    1. Not a tut.
    2. Theres other ways to have drops, this makes it random, but you can make it random for each item instead of making 1 item thats really common have in randomtztokjad.
    3. Use ints.
    Quote Originally Posted by super_ View Post
    this is shit. you are shit. gtfo retard.
     

  8. #8  
    Kurt
    Guest
    I'd rather not use ints as I like the way I program, also if its not a tut what is it? It's teaching npcs drops, is it not?
     

  9. #9  
    MopTop
    Guest
    Very nice, this definitely helped me.
     

  10. #10  
    Crazy Cam10
    Guest
    I Already Knew This, And I Still Don't Fully Understand, You Haven't Said How To Change Drops Depending On Certain Switches >_<
     

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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •