Thread: Using 2 keys on a door

Results 1 to 9 of 9
  1. #1 Using 2 keys on a door 
    Registered Member
    Join Date
    Apr 2016
    Posts
    194
    Thanks given
    25
    Thanks received
    3
    Rep Power
    63
    Code:
    	case 7407:
    			if (c.getItems().playerHasItem(9651, 1)) {
    				c.getItems().deleteItem2(9651, 1);
    			c.getPA().movePlayer(3071, 3857, 0);
    			c.sendMessage("@[email protected] from the right, leave from the right!");
    			} else {
    				c.sendMessage("@[email protected] will need the Fountain Key from these nasty barbarians."); 
    			}
    			break;
    So that is in my actionhandler.java under firstclickobject. It currently just requires one key. I wanted to add the option of if they had a different key (2440) they could get in as well. I'm trying to make a Master Key for all my key areas/key bosses. I dont want it to require both keys, rather one or the other. I added an else statement under the first if with the key ids swapped but that didn't work.
    Reply With Quote  
     

  2. #2  
    Registered Member
    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,699
    Thanks given
    170
    Thanks received
    285
    Discord
    Arch337#1337
    Rep Power
    590
    If you just want it to check after the keys you could do:
    Code:
    	case 7407:
    	boolean checkKeys = c.getItems().playerHasItem(9651, 1) || c.getItems().playerHasItem(2440, 1) ? true : false;
    		if(!checkKeys) {
    		c.sendMessage("@[email protected] do not have the right key required to enter these nasty barbarians."); 
    		return;
    		}
    		c.getPA().movePlayer(3071, 3857, 0);
    		c.sendMessage("@[email protected] from the right, leave from the right!");
    	break;


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Apr 2016
    Posts
    194
    Thanks given
    25
    Thanks received
    3
    Rep Power
    63
    Quote Originally Posted by arch337 View Post
    If you just want it to check after the keys you could do:
    Code:
    	case 7407:
    	boolean checkKeys = c.getItems().playerHasItem(9651, 1) || c.getItems().playerHasItem(2440, 1) ? true : false;
    		if(!checkKeys) {
    		c.sendMessage("@[email protected] do not have the right key required to enter these nasty barbarians."); 
    		return;
    		}
    		c.getPA().movePlayer(3071, 3857, 0);
    		c.sendMessage("@[email protected] from the right, leave from the right!");
    	break;
    Revising my statement. Thanks for this.
    Reply With Quote  
     

  4. #4  
    Registered Member
    arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,699
    Thanks given
    170
    Thanks received
    285
    Discord
    Arch337#1337
    Rep Power
    590
    Quote Originally Posted by Raiga View Post
    Well there isn't an error but it also does not work. I understood the concept and thought it would but nada.
    In what way would it not work? Cause it would atleast send something if the method was being send.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Apr 2016
    Posts
    194
    Thanks given
    25
    Thanks received
    3
    Rep Power
    63
    Quote Originally Posted by arch337 View Post
    In what way would it not work? Cause it would atleast send something if the method was being send.
    I was stoned and had my IDs mixed up. lol. Thanks

    Finished implementing this and it works smooth as fuck
    Reply With Quote  
     

  6. Thankful user:


  7. #6  
    Registered Member
    Join Date
    Feb 2018
    Posts
    20
    Thanks given
    1
    Thanks received
    1
    Rep Power
    0
    Quote Originally Posted by Raiga View Post
    I was stoned and had my IDs mixed up. lol. Thanks
    Story of my life!! LOL
    Reply With Quote  
     

  8. #7  
    Registered Member
    Join Date
    Apr 2016
    Posts
    194
    Thanks given
    25
    Thanks received
    3
    Rep Power
    63
    Quote Originally Posted by OmegaX View Post
    Story of my life!! LOL
    dude right. I was doing 2440 instead of 2400 luul
    Reply With Quote  
     

  9. #8  
    Donator

    Join Date
    Feb 2017
    Posts
    101
    Thanks given
    0
    Thanks received
    11
    Rep Power
    46
    I would recommend writing a class for this. It seems like something that could get used more then once.
    Reply With Quote  
     

  10. #9  
    Registered Member
    Join Date
    Apr 2016
    Posts
    194
    Thanks given
    25
    Thanks received
    3
    Rep Power
    63
    Quote Originally Posted by XScapeRsps View Post
    I would recommend writing a class for this. It seems like something that could get used more then once.
    Yeah I just renamed the Boolean in each instance ex checkkeys1 checkkeys2 checkkeys3 etc
    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: 21
    Last Post: 02-19-2015, 04:32 PM
  2. how to use a item on another?
    By sheezy2 in forum Help
    Replies: 5
    Last Post: 04-24-2009, 11:16 AM
  3. Using donator icons on bluurs client.
    By Philz in forum Help
    Replies: 0
    Last Post: 03-29-2009, 05:35 AM
  4. Replies: 2
    Last Post: 03-02-2009, 05:40 PM
  5. Using ObjectDefinitions techniques on servers
    By wizzyt21 in forum Tutorials
    Replies: 3
    Last Post: 12-25-2008, 09:16 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
  •