Thread: [email protected][email protected][email protected]

Results 1 to 4 of 4
  1. Registered Member
    Join Date
    Jul 2012
    Posts
    40
    Thanks given
    2
    Thanks received
    0
    Rep Power
    9
    if(itemId == 405) {
    c.getItems().addItem(1038, 1);
    c.getItems().addItem(1040, 1);
    c.getItems().addItem(1042, 1);
    c.getItems().addItem(1044, 1);
    c.getItems().addItem(1046, 1);
    c.getItems().addItem(1048, 1);
    c.getItems().addItem(1050, 1);
    c.getItems().deleteItem(405, 1);
    I want it to give me one of the items not all how do i do this? This is for ClickItem.java class because it's a mystery box
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jun 2011
    Posts
    220
    Thanks given
    3
    Thanks received
    13
    Rep Power
    2
    Code:
    public int[] Random() {
        int[] value = new int[7];
        int i = 1038;
        do {
            for(int j = 0; j < value.length; j++)
                value[j] = i;
            i += 2;
        } while(i <= 1050);
        return value;
    }
    Code:
    if(itemId == 405) {
        if(c.getItems().playerHasItem(405, 1) {
            c.getItems().deleteItem(405, 1);
            c.getItems().addItem(Random()[Misc.random(Random().length)], 1);
        }
    }
    import server.util.Misc;
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jul 2012
    Posts
    40
    Thanks given
    2
    Thanks received
    0
    Rep Power
    9
    This is for ClickItem class
    Reply With Quote  
     

  4. #4  
    Registered Member Tuvalu's Avatar
    Join Date
    Apr 2012
    Age
    25
    Posts
    114
    Thanks given
    8
    Thanks received
    3
    Rep Power
    26
    The reason why you're getting all those items as opposed to just is because you've specified that all those items are to occur under the same condition.

    Just add some "else if" statements which would give you certain items under certain conditions. Or, you could just delete every other subroutine within the if statement par one.

    i.e.

    Code:
    
    if (itemId == 405) {
    c.getItems().addItem(1038, 1);
    }
    else if (itemId == 406) {
    c.getItems().addItem(1040, 1);
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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

Similar Threads

  1. Random items
    By The evil ways in forum Help
    Replies: 11
    Last Post: 04-11-2012, 03:52 PM
  2. [PI] Gives a load of Random items !
    By rexz0rd in forum Help
    Replies: 12
    Last Post: 08-10-2011, 03:35 PM
  3. Replies: 5
    Last Post: 07-22-2010, 06:13 PM
  4. Random items?
    By Runebay™ in forum Help
    Replies: 10
    Last Post: 11-30-2009, 08:29 AM
  5. Random Items
    By Markk in forum Help
    Replies: 19
    Last Post: 06-25-2009, 12:26 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •