Thread: Mystery Box

Results 1 to 10 of 10
  1. #1 Mystery Box 
    Registered Member Kelso's Avatar
    Join Date
    Dec 2010
    Posts
    81
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    OK so I want to make a mystery box that gives you all items. I want to use the object instead of item. The object ID is 357 and I want the items to go from 0 to 20072 and for now to be player rights 3. For example, when I click on the box I have an 100% chance of getting any item that exists but only 1 of the item. I already know that it looks something like this when declaring:

    Code:
    	public int mysteryBox() {
    		return mysteryBox[(int) (Misc.random(0) + 20072)];
    however I could be wrong. I do have skype and teamview so I can pm details. All help is appreciated.
    Reply With Quote  
     

  2. #2  
    I'm Back

    Stewie's Avatar
    Join Date
    Jul 2008
    Age
    26
    Posts
    7,989
    Thanks given
    1,877
    Thanks received
    1,491
    Rep Power
    5000
    What is the point of adding a random value when it can only be 0..?


    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  3. #3  
    Registered Member Kelso's Avatar
    Join Date
    Dec 2010
    Posts
    81
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    I want to make it so I can get item 0-20072 at random
    Reply With Quote  
     

  4. #4  
    Donator

    Kickyamom's Avatar
    Join Date
    Jul 2010
    Posts
    1,606
    Thanks given
    208
    Thanks received
    156
    Rep Power
    835
    Code:
    	public int mysteryBox() {
    		return mysteryBox[(int) (Misc.random(20072))];
    Isn't it that? lol
    [Only registered and activated users can see links. ]

    Spoiler for Respect for the Truest:

    [Only registered and activated users can see links. ] GANG 4 LYFE
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Aug 2011
    Posts
    396
    Thanks given
    66
    Thanks received
    14
    Rep Power
    0
    pretty pointless man no offence.
    Reply With Quote  
     

  6. #6  
    Registered Member Kelso's Avatar
    Join Date
    Dec 2010
    Posts
    81
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    I tried that and it says "cannot find symbol : variable mysteryBox"
    and I also need the switch statement so an action occurs when object 357 is clicked.
    Reply With Quote  
     

  7. #7  
    Respected Member

    Join Date
    Jan 2009
    Posts
    5,682
    Thanks given
    1,093
    Thanks received
    3,494
    Discord
    View profile
    Rep Power
    5000
    Code:
    player.addItem(Misc.random(20072), 1);
    Reply With Quote  
     

  8. #8  
    Registered Member Kelso's Avatar
    Join Date
    Dec 2010
    Posts
    81
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    thank you doors, it works, however is there anyway so I can add an exception to the switch:

    Code:
    		case 357:
    			if (c.playerRights == 3) {
    				c.getItems().addItem(mysteryBox(),Misc.random(1));
    			}
    so I dont get null items?
    Reply With Quote  
     

  9. #9  
    Respected Member

    Join Date
    Jan 2009
    Posts
    5,682
    Thanks given
    1,093
    Thanks received
    3,494
    Discord
    View profile
    Rep Power
    5000
    Quote Originally Posted by Kelso View Post
    thank you doors, it works, however is there anyway so I can add an exception to the switch:

    Code:
    		case 357:
    			if (c.playerRights == 3) {
    				c.getItems().addItem(mysteryBox(),Misc.random(1));
    			}
    so I dont get null items?
    Code:
    c.getItems().addItem(Misc.random(20072, 1);
    Also you will have to get the item name to do that.
    Reply With Quote  
     

  10. #10  
    Registered Member Kelso's Avatar
    Join Date
    Dec 2010
    Posts
    81
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    I got mine to work but I am wondering if I can make it so items with the name "null" wont be in the box.
    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. Donation Box (Mystery Box)
    By Project in forum Tutorials
    Replies: 24
    Last Post: 04-24-2014, 03:54 AM
  2. [317] Mystery Box [317]
    By pyrotic in forum Tutorials
    Replies: 25
    Last Post: 08-18-2011, 12:24 AM
  3. A Cache Downloading Mystery
    By Jack Daniels in forum Help
    Replies: 2
    Last Post: 08-02-2011, 11:02 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
  •