Thread: [PI] Chest Question REP++

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 [PI] Chest Question REP++ 
    Registered Member
    Join Date
    Aug 2013
    Posts
    134
    Thanks given
    25
    Thanks received
    2
    Rep Power
    19
    Ok I am adding a chest in my minigame that gives u 5 different items at random, and I have everything done but I want it to be like this
    everytime the minigame restarts the chest reset, and everytime that one chest is opened it like either disappears or goes to a different chest that is already opened.

    I WILL REP++ ANYONE THAT CAN FIGURE THIS OUT THANKS!
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    Just add checks. Maybe create a Boolean for it

    private boolean chestOpened;

    When the player opens the chest turn the Boolean true. The chest should have a Boolean check checking if the booleans true or false, If booleans false, it'd get the random items and it'd turn the Boolean true, if the booleans true to do nothing or if you want, you can add a message saying you've already searched this chest or something.

    Example:

    case chestObjectId:
    if (!chestOpened) {
    doshit();
    chestOpened = true;
    } else if (chestOpened) {
    sendMessage("You've already searched this chest");
    }

    Then when the Minigame ends, just reset the Boolean to false.
    If only I hadn't given you up, my life could've been different.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Aug 2013
    Posts
    134
    Thanks given
    25
    Thanks received
    2
    Rep Power
    19
    Quote Originally Posted by True Faith View Post
    Just add checks. Maybe create a Boolean for it

    private boolean chestOpened;

    When the player opens the chest turn the Boolean true. The chest should have a Boolean check checking if the booleans true or false, If booleans false, it'd get the random items and it'd turn the Boolean true, if the booleans true to do nothing or if you want, you can add a message saying you've already searched this chest or something.

    Example:

    case chestObjectId:
    if (!chestOpened) {
    doshit();
    chestOpened = true;
    } else if (chestOpened) {
    sendMessage("You've already searched this chest");
    }

    Then when the Minigame ends, just reset the Boolean to false.
    So something like this:
    private boolean chestOpened;< ------ in Client Class

    case 4216:
    if (!chestOpened) {
    c.getItems.addItems(4151, 1);
    chestOpened = true;
    } else if (chestOpened) {
    c.sendMessage("You've already searched this chest");
    } <---- in ClickObject Class

    then how do I make it set that boolean to false?

    Like this?:

    c.chestOpened = false; I declare that at the end of the Minigame method? But will that make ALL the chest reset?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    Quote Originally Posted by Christoph3r View Post
    So something like this:
    private boolean chestOpened;< ------ in Client Class

    case 4216:
    if (!chestOpened) {
    c.getItems.addItems(4151, 1);
    chestOpened = true;
    } else if (chestOpened) {
    c.sendMessage("You've already searched this chest");
    } <---- in ClickObject Class

    then how do I make it set that boolean to false?

    Like this?:

    c.chestOpened = false; I declare that at the end of the Minigame method? But will that make ALL the chest reset?
    Yes it should make all the chests "reset" except, this would only work for one chest lol.. There's a better way if you're doing this for multiple chests, you don't wanna have to declare a bunch of booleans
    If only I hadn't given you up, my life could've been different.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Aug 2013
    Posts
    134
    Thanks given
    25
    Thanks received
    2
    Rep Power
    19
    Quote Originally Posted by True Faith View Post
    Yes it should make all the chests "reset" except, this would only work for one chest lol.. There's a better way if you're doing this for multiple chests, you don't wanna have to declare a bunch of booleans
    It is for multiple chest of the same ID?
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    Quote Originally Posted by Christoph3r View Post
    It is for multiple chest of the same ID?
    K. That makes the Boolean check a little irrelevant
    If only I hadn't given you up, my life could've been different.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Aug 2013
    Posts
    134
    Thanks given
    25
    Thanks received
    2
    Rep Power
    19
    Quote Originally Posted by True Faith View Post
    K. That makes the Boolean check a little irrelevant
    So uhhmmm would that work for them all or no?
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    Quote Originally Posted by Christoph3r View Post
    So uhhmmm would that work for them all or no?
    You'd have to create multiple booleans and use another way to identify each chest if you wanna do it this way lol. If you just do what I said with 1 Boolean declared for this chest of yours, theyd only be able to open one chest
    If only I hadn't given you up, my life could've been different.
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Aug 2013
    Posts
    134
    Thanks given
    25
    Thanks received
    2
    Rep Power
    19
    Quote Originally Posted by True Faith View Post
    You'd have to create multiple booleans and use another way to identify each chest if you wanna do it this way lol. If you just do what I said with 1 Boolean declared for this chest of yours, theyd only be able to open one chest
    Okay, then lol problem is not solved. I need it to reset all of the chest.
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    Quote Originally Posted by Christoph3r View Post
    Okay, then lol problem is not solved. I need it to reset all of the chest.
    Better off to remove the chest upon being used then. You spawned the object using checkObjectSpawn(blah blah blah right

    You could use the chests coordinates as its identification then upon being clicked to remove the object off those coords, then when the Minigame ends, respawn the chests
    If only I hadn't given you up, my life could've been different.
    Reply With Quote  
     

Page 1 of 2 12 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. [pi] 2 questions rep++
    By arcane-scape in forum Help
    Replies: 4
    Last Post: 10-05-2011, 07:59 AM
  2. Replies: 3
    Last Post: 06-28-2011, 01:27 AM
  3. [PI]Stupid question... (Rep++)
    By susurik in forum Help
    Replies: 3
    Last Post: 03-12-2011, 04:41 PM
  4. [PI] Easy Question....Rep++ [PI]
    By Kickyamom in forum Help
    Replies: 3
    Last Post: 11-27-2010, 01:24 PM
  5. [Pi]2 Questions || rep++
    By Itz Laurens in forum Help
    Replies: 2
    Last Post: 10-20-2010, 10:56 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •