Thread: Simple Mystery box and Crystal key combining

Page 1 of 3 123 LastLast
Results 1 to 10 of 28
  1. #1 Simple Mystery box and Crystal key combining 
    Ballin~
    Wulfite's Avatar
    Join Date
    Nov 2013
    Posts
    163
    Thanks given
    13
    Thanks received
    10
    Rep Power
    49
    Spoiler for Mystery box:
    Goto Clickitem.java and paste this anywhere

    Spoiler for code:
    Code:
    		/*Mystery box*/
    		if (itemId == 6199) { // item id
    			int mystbox = Misc.random(3); // How many options you want it to pick from
    			if (mystbox == 1) { // first option of 3
    				c.getItems().addItem(995, 10000000);    //Adding items to inventory
    				c.getItems().deleteItem(6199, 1);    //Removes the mystery box from inventory
    				c.sendMessage("Thank you for playing");   //Sends a message after you open the mystery box.
    			} else {
    				if (mystbox == 2) {
    				c.getItems().addItem(1050, 1);
    				c.getItems().deleteItem(6199, 1);
    				c.sendMessage("Thank you for playing");
    			} else {
    				if (mystbox == 3) {
    					c.getItems().addItem(1049, 3);
    					c.getItems().deleteItem(6199, 1);
    					c.sendMessage("Thank you for playing");
    				}
    			}
    			
    			}
    		}
    		/*end of mystery box*/


    Spoiler for crystal key:
    Go to itemonitem.java add this code anywhere.

    Spoiler for code:
    Code:
    		if (c.getItems().playerHasItem(985, 1) // checks if you have first half of key
    				|| c.getItems().playerHasItem(987, 1)) { // ^^^^^^^^^^^^^^^^
    			c.getItems().deleteItem(985, 1); // removes the first tooth half
    			c.getItems().deleteItem(987, 1);// ^^^^^^^^^^^^^^^^^^
    			c.getItems().addItem(989, 1); //  adds the key to your inventory
    			c.sendMessage("You combine the half keys and recieve a crystal key"); // sends you a message
    		}



    I've tryed to explain everything in detail this is simple stuff so most of you wont even need this but this for beginners such as myself.

    If you want a complex mystery box i suggest you go to this thread - [Only registered and activated users can see links. ]

    credits
    99 % me
    1 % to the guy who told me how to do this : Misc.random(3)
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    May 2013
    Posts
    1,173
    Thanks given
    28
    Thanks received
    132
    Rep Power
    53
    You don't have to declare c.sendMessage("Thank you for playing"); and the mystery box deleting 3 times. Can just call them once. Not that it matters, but should make it a switch statement
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Sep 2013
    Posts
    142
    Thanks given
    7
    Thanks received
    2
    Rep Power
    11
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Aug 2012
    Posts
    3,161
    Thanks given
    2,843
    Thanks received
    855
    Rep Power
    2235
    and if the Misc.random == 0?
    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Registered Member
    Join Date
    Sep 2013
    Posts
    142
    Thanks given
    7
    Thanks received
    2
    Rep Power
    11
    If people dont know how to use arrays:

    /*Mystery box*/
    if (itemId == 6199) { // item id
    int mystbox = Misc.random(2); // How many options you want it to pick from
    if (mystbox == 0) { // first option of 3
    c.getItems().addItem(995, 10000000); //Adding items to inventory.
    } else if (mystbox == 1) {
    c.getItems().addItem(1050, 1);
    } else if (mystbox == 2) {
    c.getItems().addItem(1049, 3);
    }
    c.getItems().deleteItem(6199, 1); //Removes the mystery box from inventory
    c.sendMessage("Thank you for playing"); //Sends a message after you open the mystery box

    }

    /*end of mystery box*/
    Reply With Quote  
     

  7. #6  
    Ballin~
    Wulfite's Avatar
    Join Date
    Nov 2013
    Posts
    163
    Thanks given
    13
    Thanks received
    10
    Rep Power
    49
    i did say i was a beginner, Correct ?
    Reply With Quote  
     

  8. #7  
    -Founder Off Returnofpk-


    Join Date
    Oct 2012
    Age
    25
    Posts
    657
    Thanks given
    97
    Thanks received
    211
    Rep Power
    297
    Quote Originally Posted by Balling View Post
    Spoiler for Mystery box:
    Goto Clickitem.java and paste this anywhere

    Spoiler for code:
    Code:
    		/*Mystery box*/
    		if (itemId == 6199) { // item id
    			int mystbox = Misc.random(3); // How many options you want it to pick from
    			if (mystbox == 1) { // first option of 3
    				c.getItems().addItem(995, 10000000);    //Adding items to inventory
    				c.getItems().deleteItem(6199, 1);    //Removes the mystery box from inventory
    				c.sendMessage("Thank you for playing");   //Sends a message after you open the mystery box.
    			} else {
    				if (mystbox == 2) {
    				c.getItems().addItem(1050, 1);
    				c.getItems().deleteItem(6199, 1);
    				c.sendMessage("Thank you for playing");
    			} else {
    				if (mystbox == 3) {
    					c.getItems().addItem(1049, 3);
    					c.getItems().deleteItem(6199, 1);
    					c.sendMessage("Thank you for playing");
    				}
    			}
    			
    			}
    		}
    		/*end of mystery box*/


    Spoiler for crystal key:
    Go to itemonitem.java add this code anywhere.

    Spoiler for code:
    Code:
    		if (c.getItems().playerHasItem(985, 1) // checks if you have first half of key
    				|| c.getItems().playerHasItem(987, 1)) { // ^^^^^^^^^^^^^^^^
    			c.getItems().deleteItem(985, 1); // removes the first tooth half
    			c.getItems().deleteItem(987, 1);// ^^^^^^^^^^^^^^^^^^
    			c.getItems().addItem(989, 1); //  adds the key to your inventory
    			c.sendMessage("You combine the half keys and recieve a crystal key"); // sends you a message
    		}



    I've tryed to explain everything in detail this is simple stuff so most of you wont even need this but this for beginners such as myself.

    If you want a complex mystery box i suggest you go to this thread - [Only registered and activated users can see links. ]

    credits
    99 % me
    1 % to the guy who told me how to do this : Misc.random(3)
    maby got a name

    1 % to the guy who told me how to do this : Misc.random(3)

    Reply With Quote  
     

  9. #8  
    -Founder Off Returnofpk-


    Join Date
    Oct 2012
    Age
    25
    Posts
    657
    Thanks given
    97
    Thanks received
    211
    Rep Power
    297
    Quote Originally Posted by Balling View Post
    Spoiler for Mystery box:
    Goto Clickitem.java and paste this anywhere

    Spoiler for code:
    Code:
    		/*Mystery box*/
    		if (itemId == 6199) { // item id
    			int mystbox = Misc.random(3); // How many options you want it to pick from
    			if (mystbox == 1) { // first option of 3
    				c.getItems().addItem(995, 10000000);    //Adding items to inventory
    				c.getItems().deleteItem(6199, 1);    //Removes the mystery box from inventory
    				c.sendMessage("Thank you for playing");   //Sends a message after you open the mystery box.
    			} else {
    				if (mystbox == 2) {
    				c.getItems().addItem(1050, 1);
    				c.getItems().deleteItem(6199, 1);
    				c.sendMessage("Thank you for playing");
    			} else {
    				if (mystbox == 3) {
    					c.getItems().addItem(1049, 3);
    					c.getItems().deleteItem(6199, 1);
    					c.sendMessage("Thank you for playing");
    				}
    			}
    			
    			}
    		}
    		/*end of mystery box*/


    Spoiler for crystal key:
    Go to itemonitem.java add this code anywhere.

    Spoiler for code:
    Code:
    		if (c.getItems().playerHasItem(985, 1) // checks if you have first half of key
    				|| c.getItems().playerHasItem(987, 1)) { // ^^^^^^^^^^^^^^^^
    			c.getItems().deleteItem(985, 1); // removes the first tooth half
    			c.getItems().deleteItem(987, 1);// ^^^^^^^^^^^^^^^^^^
    			c.getItems().addItem(989, 1); //  adds the key to your inventory
    			c.sendMessage("You combine the half keys and recieve a crystal key"); // sends you a message
    		}



    I've tryed to explain everything in detail this is simple stuff so most of you wont even need this but this for beginners such as myself.

    If you want a complex mystery box i suggest you go to this thread - [Only registered and activated users can see links. ]

    credits
    99 % me
    1 % to the guy who told me how to do this : Misc.random(3)
    and import this

    Code:
    import server.util.Misc;
    Reply With Quote  
     

  10. Thankful user:


  11. #9  
    Ballin~
    Wulfite's Avatar
    Join Date
    Nov 2013
    Posts
    163
    Thanks given
    13
    Thanks received
    10
    Rep Power
    49
    Quote Originally Posted by sheepmonger View Post
    and import this

    Code:
    import server.util.Misc;
    eclipse tells you but thanks
    Reply With Quote  
     

  12. #10  
    Donator


    Join Date
    Mar 2011
    Posts
    2,362
    Thanks given
    1,193
    Thanks received
    824
    Rep Power
    856
    Quote Originally Posted by Steen View Post
    If people dont know how to use arrays:

    /*Mystery box*/
    if (itemId == 6199) { // item id
    int mystbox = Misc.random(2); // How many options you want it to pick from
    if (mystbox == 0) { // first option of 3
    c.getItems().addItem(995, 10000000); //Adding items to inventory.
    } else if (mystbox == 1) {
    c.getItems().addItem(1050, 1);
    } else if (mystbox == 2) {
    c.getItems().addItem(1049, 3);
    }
    c.getItems().deleteItem(6199, 1); //Removes the mystery box from inventory
    c.sendMessage("Thank you for playing"); //Sends a message after you open the mystery box

    }

    /*end of mystery box*/
    i hope you're not being serious.

    OP: both have been released in a much better fashion than this. looks absolutely disgusting
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

Page 1 of 3 123 LastLast

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: 18
    Last Post: 08-17-2013, 01:18 AM
  2. Replies: 13
    Last Post: 08-12-2013, 02:18 PM
  3. Replies: 1
    Last Post: 05-21-2013, 03:46 AM
  4. Replies: 23
    Last Post: 05-23-2012, 11:53 AM
  5. Login box and button
    By andii in forum Graphics
    Replies: 37
    Last Post: 12-04-2008, 04:17 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
  •