Thread: Close

Results 1 to 8 of 8
  1. #1 Close 
    Registered Member remcowp's Avatar
    Join Date
    Jan 2011
    Posts
    651
    Thanks given
    57
    Thanks received
    37
    Rep Power
    12
    Already fixed thanks to everyone
    Reply With Quote  
     

  2. #2  
    NirvanaRS

    Join Date
    Mar 2013
    Posts
    97
    Thanks given
    26
    Thanks received
    21
    Rep Power
    20
    Code:
    private static final int mysteryItems[][] =  { { 995, 1000 }, { 555, 10000 } };
    
    public void openMysteryBox() {
    	for (int i = 0; i < mysteryItems.length; i++) 
    		c.getPA().addItems(mysteryItems[i][0], mysteryItems[i][1]);
    }


    Looking for a more stable base? Try Asteria 2.0
    Reply With Quote  
     

  3. #3  
    Registered Member
    TheChosenOne's Avatar
    Join Date
    Jan 2013
    Posts
    967
    Thanks given
    47
    Thanks received
    161
    Rep Power
    366
    Do it like you correctly thought how you should make the array.
    Then you got this:
    "Mysterybox[(int) (Math.random()*Mysterybox.length)]"
    That grabs one of the inner arrays (your new one is a 2D array). For example: {995, 10000000}
    Index 0 is the itemId, index 1 is the itemAmount.
    So in the end it'll be something like this (do not use Math.random() twice for the same reward!!!):
    Code:
    int reward = (int) (Math.random()*Mysterybox.length;
    int itemId = Mysterybox[reward][0];
    int amount = Mysterybox[reward][1];
    Reply With Quote  
     

  4. #4  
    Registered Member remcowp's Avatar
    Join Date
    Jan 2011
    Posts
    651
    Thanks given
    57
    Thanks received
    37
    Rep Power
    12
    Quote Originally Posted by TheChosenOne View Post
    Do it like you correctly thought how you should make the array.
    Then you got this:
    "Mysterybox[(int) (Math.random()*Mysterybox.length)]"
    That grabs one of the inner arrays (your new one is a 2D array). For example: {995, 10000000}
    Index 0 is the itemId, index 1 is the itemAmount.
    So in the end it'll be something like this (do not use Math.random() twice for the same reward!!!):
    Code:
    int reward = (int) (Math.random()*Mysterybox.length;
    int itemId = Mysterybox[reward][0];
    int amount = Mysterybox[reward][1];
    Hey, thanks for the great help with explaining.

    Could you help me a little further idk how to make it like 100%

    I have this so far but i keep getting errors

    Code:
    	int reward = (int) (Math.random()*MysteryBox.length);
    	int itemId = MysteryBox[reward][0];
    	int amount = MysteryBox[reward][1];
    	public static int MysteryBox[][] = 
    		{{4151, 1},
            {11694, 1},
            {4153, 1},
            {11696, 9},
            {11698, 9},
            {11700, 9},
            {5699, 3},
            {3440, 1}
        };
    	
    	public int randomMysterybox() {
    		return MysteryBox[(reward)(itemId)(amount) (Math.random()*MysteryBox.length)];
    	}
    Reply With Quote  
     

  5. #5  
    Registered Member remcowp's Avatar
    Join Date
    Jan 2011
    Posts
    651
    Thanks given
    57
    Thanks received
    37
    Rep Power
    12
    TheChosenOne helped me alot over PM

    Thanks
    Reply With Quote  
     

  6. #6  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Reply With Quote  
     

  7. #7  
    Registered Member remcowp's Avatar
    Join Date
    Jan 2011
    Posts
    651
    Thanks given
    57
    Thanks received
    37
    Rep Power
    12
    Quote Originally Posted by Jason View Post
    Haha thanks but i really would make it myself to learn and i totally understand it right now, now i can make alot more of this and make a class like you did.

    Thanks everyone.
    Reply With Quote  
     

  8. #8  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Quote Originally Posted by remcowp View Post
    Haha thanks but i really would make it myself to learn and i totally understand it right now, now i can make alot more of this and make a class like you did.

    Thanks everyone.
    You're welcome guy.
    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. Need Someone To Make Me A Webclient For My 317
    By MasonHadley in forum Requests
    Replies: 0
    Last Post: 10-25-2010, 01:15 AM
  2. Replies: 8
    Last Post: 06-04-2010, 08:34 AM
  3. Can someone make me an INT for this?
    By Magepro in forum Help
    Replies: 22
    Last Post: 10-19-2009, 09:57 PM
  4. Need help making a search for my website.
    By David in forum Application Development
    Replies: 3
    Last Post: 01-25-2009, 02:09 AM
  5. Need someone to make Maps for my game
    By Budda in forum Console
    Replies: 20
    Last Post: 01-12-2008, 10:56 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
  •