Thread: Noted items in an int

Results 1 to 9 of 9
  1. #1 Noted items in an int 
    H_E_N_T_A_I_H_E_A_V_E_N_
    Tatsumi's Avatar
    Join Date
    May 2013
    Posts
    1,779
    Thanks given
    537
    Thanks received
    269
    Rep Power
    337
    Okay so i have caskets in my server.

    public static int Casket[] = {995,315,361,1333

    The casket contains alot of items, eg coin, shark etc.
    Is it possible (if yes, then how) to make it drop eg 15 gp instead of just one, or like 5 noted sharks?
    Attached image
    Reply With Quote  
     

  2. #2  
    H_E_N_T_A_I_H_E_A_V_E_N_
    Tatsumi's Avatar
    Join Date
    May 2013
    Posts
    1,779
    Thanks given
    537
    Thanks received
    269
    Rep Power
    337
    Hello ?
    Attached image
    Reply With Quote  
     

  3. #3  
    Ballin~
    Wulfite's Avatar
    Join Date
    Nov 2013
    Posts
    164
    Thanks given
    13
    Thanks received
    10
    Rep Power
    49
    i have had this problem before and i gave up on it never could figure it out but good luck ( bump )
    Reply With Quote  
     

  4. #4  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    Code:
    if (Item.itemStackable[itemRecieved]) {
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  5. #5  
    H_E_N_T_A_I_H_E_A_V_E_N_
    Tatsumi's Avatar
    Join Date
    May 2013
    Posts
    1,779
    Thanks given
    537
    Thanks received
    269
    Rep Power
    337
    Quote Originally Posted by Sponjeno View Post
    Code:
    if (Item.itemStackable[itemRecieved]) {
    Could you please explain, i am not so good in java, i need a bit more info.
    Attached image
    Reply With Quote  
     

  6. #6  
    H_E_N_T_A_I_H_E_A_V_E_N_
    Tatsumi's Avatar
    Join Date
    May 2013
    Posts
    1,779
    Thanks given
    537
    Thanks received
    269
    Rep Power
    337
    anybody?
    Attached image
    Reply With Quote  
     

  7. #7  
    Registered Member huch's Avatar
    Join Date
    Jul 2013
    Age
    29
    Posts
    128
    Thanks given
    4
    Thanks received
    6
    Rep Power
    20
    2d array.

    int casket[] = {{itemId, amount}, {995, 15}};
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    yeah, you can do a 2d array like the guy up there suggested

    Code:
    int CASKET_ITEMS[][] = {
    {995, 15}, {555, 100}
    };
    Code:
    getItems().addItem(CASKET_ITEMS[i][0], CASKET_ITEMS[i][1]);
    Reply With Quote  
     

  9. #9  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    As mentioned a 2d array can easily do this for you. Regarding how it's fairly simple, ill give you an example usage of how it can be done.

    Code:
    public class Casket {
    
        public static final int[][] CONTENTS = {
            {892, 25},
            {995, 15000},
            {4151, 1},
            {11694, 1}
        };
    
        public static void drop(Player player) {
            int index = Misc.random(CONTENTS.length - 1);
            int itemId = CONTENTS[index][0];
            int amount = CONTENTS[index][1];
            //drop item
        }
    }
    Reply With Quote  
     


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. Cannot Note items in bank/?
    By ItzMason in forum Help
    Replies: 3
    Last Post: 11-13-2012, 04:28 AM
  2. Replies: 6
    Last Post: 06-13-2011, 06:46 PM
  3. Replies: 3
    Last Post: 05-15-2011, 03:24 AM
  4. Replies: 3
    Last Post: 11-07-2009, 11:33 PM
  5. Replies: 5
    Last Post: 06-29-2008, 11:07 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
  •