Thread: [Pi] Need Help With Random Package

Results 1 to 7 of 7
  1. #1 [Pi] Need Help With Random Package 
    OoO Donor <3
    Rockstar Jax's Avatar
    Join Date
    Mar 2011
    Age
    27
    Posts
    608
    Thanks given
    77
    Thanks received
    78
    Rep Power
    21
    Alrighty I already have part of it done. Where if you click on the package you get a common reward.

    Code:
    if (itemId == 15290 && c.getItems().freeSlots() >= 2) {
    		c.getItems().deleteItem(15290,1);
    		c.getItems().addItem(c.skillerPackage1(),Misc.random(800));
    		c.sendMessage("You open the package and get a reward!");
    	}
    Code:
    int[] skillerPackage1 = { 452, 2510, 384, 378, 448, 1518, 533, 450, 216 }; //common
    	public int skillerPackage1() {
    			return skillerPackage1[(int) (Math.random() * skillerPackage1.length)];
    	}
    I want it to make it where there is a 5% chance you could get a rare.

    So like you open it you'll get one item, but the next time you open you might get the normal item and a rare? how would this be done..

    <-- amateur sig skills dont hate
    Reply With Quote  
     

  2. #2  
    Renown Programmer

    Join Date
    Dec 2010
    Posts
    2,876
    Thanks given
    508
    Thanks received
    1,898
    Rep Power
    5000
    if (Math.random() <= 0.05) {
    ....
    }
    never talk to me or my wife's son ever again
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Dec 2011
    Age
    29
    Posts
    214
    Thanks given
    1
    Thanks received
    7
    Rep Power
    13
    Easiest way to do this is to add like 10 or more of each of the common rewards and then put 1 of each of the rares in the list. It will easily dilute the rares, and be hard to get them.. Kinda like this.

    This is for my barrows rewards..
    Code:
    		6746,/* Darklight */
    		7462,/* Barrows Gloves */
    		4753,4757,4759,4755,/* Veracs */
    		4745,4749,4751,4747,/* Torags */
    		4716,4720,4722,4718,/* Dharoks */
    		4708,4712,4714,4710,/* Ahrims */
    		4732,4736,4738,4734,/* Karils */
    		4724,4728,4730,4726,/* Guthans */
    		4753,4757,4759,4755,/* Veracs */
    		4745,4749,4751,4747,/* Torags */
    		4716,4720,4722,4718,/* Dharoks */
    		4708,4712,4714,4710,/* Ahrims */
    		4732,4736,4738,4734,/* Karils */
    		4724,4728,4730,4726,/* Guthans */
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592

    It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic
    professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    OoO Donor <3
    Rockstar Jax's Avatar
    Join Date
    Mar 2011
    Age
    27
    Posts
    608
    Thanks given
    77
    Thanks received
    78
    Rep Power
    21
    Quote Originally Posted by buttaz54 View Post
    Easiest way to do this is to add like 10 or more of each of the common rewards and then put 1 of each of the rares in the list. It will easily dilute the rares, and be hard to get them.. Kinda like this.

    This is for my barrows rewards..
    Code:
    		6746,/* Darklight */
    		7462,/* Barrows Gloves */
    		4753,4757,4759,4755,/* Veracs */
    		4745,4749,4751,4747,/* Torags */
    		4716,4720,4722,4718,/* Dharoks */
    		4708,4712,4714,4710,/* Ahrims */
    		4732,4736,4738,4734,/* Karils */
    		4724,4728,4730,4726,/* Guthans */
    		4753,4757,4759,4755,/* Veracs */
    		4745,4749,4751,4747,/* Torags */
    		4716,4720,4722,4718,/* Dharoks */
    		4708,4712,4714,4710,/* Ahrims */
    		4732,4736,4738,4734,/* Karils */
    		4724,4728,4730,4726,/* Guthans */
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592
    Ima use this method but dilute common iems in it (: thanks for the help!

    <-- amateur sig skills dont hate
    Reply With Quote  
     

  6. #5  
    The One And Only

    01053's Avatar
    Join Date
    Apr 2011
    Age
    28
    Posts
    2,887
    Thanks given
    417
    Thanks received
    885
    Rep Power
    856
    Quote Originally Posted by buttaz54 View Post
    Easiest way to do this is to add like 10 or more of each of the common rewards and then put 1 of each of the rares in the list. It will easily dilute the rares, and be hard to get them.. Kinda like this.

    This is for my barrows rewards..
    Code:
    		6746,/* Darklight */
    		7462,/* Barrows Gloves */
    		4753,4757,4759,4755,/* Veracs */
    		4745,4749,4751,4747,/* Torags */
    		4716,4720,4722,4718,/* Dharoks */
    		4708,4712,4714,4710,/* Ahrims */
    		4732,4736,4738,4734,/* Karils */
    		4724,4728,4730,4726,/* Guthans */
    		4753,4757,4759,4755,/* Veracs */
    		4745,4749,4751,4747,/* Torags */
    		4716,4720,4722,4718,/* Dharoks */
    		4708,4712,4714,4710,/* Ahrims */
    		4732,4736,4738,4734,/* Karils */
    		4724,4728,4730,4726,/* Guthans */
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592
    wtf why would u do it like that that's a mess,


    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Dec 2011
    Age
    29
    Posts
    214
    Thanks given
    1
    Thanks received
    7
    Rep Power
    13
    wtf why would u do it like that that's a mess,
    I find this much more easier to mess with then some other ways I've seen this done.. It all goes in Item.java, which doesn't really contain much at all. It's not like this is over crowding it..

    It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic
    professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.
    Reply With Quote  
     

  8. #7  
    Registered Member
    Typoerased's Avatar
    Join Date
    Feb 2010
    Age
    30
    Posts
    1,114
    Thanks given
    103
    Thanks received
    150
    Rep Power
    540
    Quote Originally Posted by buttaz54 View Post
    Easiest way to do this is to add like 10 or more of each of the common rewards and then put 1 of each of the rares in the list. It will easily dilute the rares, and be hard to get them.. Kinda like this.

    This is for my barrows rewards..
    Code:
    		6746,/* Darklight */
    		7462,/* Barrows Gloves */
    		4753,4757,4759,4755,/* Veracs */
    		4745,4749,4751,4747,/* Torags */
    		4716,4720,4722,4718,/* Dharoks */
    		4708,4712,4714,4710,/* Ahrims */
    		4732,4736,4738,4734,/* Karils */
    		4724,4728,4730,4726,/* Guthans */
    		4753,4757,4759,4755,/* Veracs */
    		4745,4749,4751,4747,/* Torags */
    		4716,4720,4722,4718,/* Dharoks */
    		4708,4712,4714,4710,/* Ahrims */
    		4732,4736,4738,4734,/* Karils */
    		4724,4728,4730,4726,/* Guthans */
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		/* Ashes */
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
    		592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592

    This is unnecessary..
    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. Replies: 15
    Last Post: 12-30-2011, 10:29 PM
  2. Barrelchest Package!
    By CurrentTheory in forum Configuration
    Replies: 14
    Last Post: 03-29-2010, 04:36 AM
  3. package this for me?
    By Bando in forum Requests
    Replies: 0
    Last Post: 07-16-2009, 03:27 PM
  4. anyone have this package?
    By Colby in forum Requests
    Replies: 3
    Last Post: 06-09-2009, 02:55 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
  •