Thread: Vencillio object issue

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 Vencillio object issue 
    Registered Member
    Join Date
    Mar 2019
    Posts
    57
    Thanks given
    3
    Thanks received
    2
    Rep Power
    13
    Trying to add a thieving chest that requires 93 thieving. But when i click on the object, it keeps sending me the message "You need a thieving level of 93 to pick the lock on this chest. This is what i have done.

    Code:
    public class ThievingChest {
    
    
    
    	public static final Item[] BKR_REWARDS = { new Item(ItemNames.BLACK_KEY_RED) };
    
    	public static void searchChest(final Player player, final int x, final int y) {
    		if (player.getSkill().getLevels()[17] < 93) {
    			player.send(new SendMessage("You unlock the chest but find no key."));
    			//AchievementHandler.activateAchievement(player, AchievementList.OPEN_50_RAIDS_CHESTS, 1);
    			player.getUpdateFlags().sendAnimation(new Animation(881));
    			player.getInventory().add(new Item(3460, Utility.random(3200)));
    			Item itemReceived;
    			switch (Utility.random(50)) {
    			default:
    				itemReceived = Utility.randomElement(BKR_REWARDS);
    			}
    			player.getInventory().addOrCreateGroundItem(itemReceived.getId(), itemReceived.getAmount(), true);
    			player.send(new SendMessage("You find " + Utility.determineIndefiniteArticle(itemReceived.getDefinition().getName()) + " " + itemReceived.getDefinition().getName() + " in the chest."));
    			
    			if (itemReceived.getDefinition().getGeneralPrice() < 100_000) {
    				switch (Utility.random(50)) {
    				default:
    					itemReceived = Utility.randomElement(BKR_REWARDS);
    				}
    				player.getInventory().addOrCreateGroundItem(itemReceived.getId(), itemReceived.getAmount(), true);
    				player.send(new SendMessage("You find " + Utility.determineIndefiniteArticle(itemReceived.getDefinition().getName()) + " " + itemReceived.getDefinition().getName() + " in the chest."));
    			}
    
    		} else {
    			player.send(new SendMessage("You need a thieving level of 93 to pick the lock on this chest."));
    		}
    	}
    
    }
    & This in walktoactions.java

    Code:
    			case 6646:
    				if (player.getSkill().getLevels()[17] < 93) {
    					ThievingChest.searchChest(player, x, y);
    				} else {
    					player.send(new SendMessage("You need a thieving level of 93 to pick the lock on this chest."));
    				}	
    				break;
    Reply With Quote  
     

  2. #2  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Change
    Code:
    if (player.getSkill().getLevels()[17] < 93) {
    to
    Code:
    if (player.getSkill().getLevels()[17] >= 93) {
    Change
    Code:
    if (player.getSkill().getLevels()[17] < 93) {
    to
    Code:
    if (player.getSkill().getLevels()[17] >= 93) {
    Also just do
    Code:
    			case 6646:
    					ThievingChest.searchChest(player, x, y);	
    				break;
    instead of
    Code:
    			case 6646:
    				if (player.getSkill().getLevels()[17] < 93) {
    					ThievingChest.searchChest(player, x, y);
    				} else {
    					player.send(new SendMessage("You need a thieving level of 93 to pick the lock on this chest."));
    				}	
    				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
    Mar 2019
    Posts
    57
    Thanks given
    3
    Thanks received
    2
    Rep Power
    13
    @arch337 That fixed that issue, thanks!

    But now i always get 1 key.
    Code:
    public class ThievingChest {
    
    
    
    	public static final Item[] BRK_RAID = { new Item(ItemNames.BLACK_KEY_RED) };
    
    	public static void searchChest(final Player player, final int x, final int y) {
    		if (player.getSkill().getLevels()[17] >= 93) {
    			player.send(new SendMessage("You unlock the chest but find no key."));
    
    			player.getUpdateFlags().sendAnimation(new Animation(881));
    
    			Item itemReceived;
    			switch (Utility.random(50)) {
    			default:
    				itemReceived = Utility.randomElement(BRK_RAID);
    			}
    			player.getInventory().addOrCreateGroundItem(itemReceived.getId(), itemReceived.getAmount(), true);
    			player.send(new SendMessage("You find " + Utility.determineIndefiniteArticle(itemReceived.getDefinition().getName()) + " " + itemReceived.getDefinition().getName() + " in the chest."));
    			
    
    
    		} else {
    			player.send(new SendMessage("You need a thieving level of 93 to pick the lock on this chest."));
    		}
    	}
    
    }
    Reply With Quote  
     

  4. #4  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Quote Originally Posted by DDS ROfl View Post
    @arch337 That fixed that issue, thanks!

    But now i always get 1 key.
    Cause you made it always give that.


    "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
    Mar 2019
    Posts
    57
    Thanks given
    3
    Thanks received
    2
    Rep Power
    13
    Quote Originally Posted by arch337 View Post
    Cause you made it always give that.
    I can see that lol mind giving me an idea what I need to change? I tried adding a utility random but that doesn’t work at least the way I have it setup.
    Reply With Quote  
     

  6. #6  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    Code:
    			Item itemReceived;
    			switch (Utility.random(50)) {
    			default:
    				itemReceived = Utility.randomElement(BRK_RAID);
    			}
    Lol you're doing a random 0-50 but it doesn't even matter what it lands on, you've not added any other statements but the default one.

    Example...
    Code:
    			Item itemReceived = null;
    			switch (Utility.random(50)) {
    			case 10: // Random landed on 10
    				itemReceived = Utility.randomElement(SOMETHING_RAID);
    				break;
    			case 11: // Random landed on 11
    				itemReceived = Utility.randomElement(SOMETHING_RAID);
    				break;
    			default:
    				itemReceived = Utility.randomElement(BRK_RAID);
    				break;
    			}
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    Reply With Quote  
     

  7. Thankful user:


  8. #7  
    Registered Member
    Join Date
    Mar 2019
    Posts
    57
    Thanks given
    3
    Thanks received
    2
    Rep Power
    13
    @Professor Oak
    So under default I would add nothing since I don’t want there to be a reward?
    Reply With Quote  
     

  9. #8  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    Quote Originally Posted by DDS ROfl View Post
    @Professor Oak
    So under default I would add nothing since I don’t want there to be a reward?
    Yes, and add a null-check for the item becauase if it's null then the random didn't land on a drop.

    Code:
    			Item itemReceived = null;
    			switch (Utility.random(50)) {
    			case 10: // Random landed on 10
    				itemReceived = Utility.randomElement(SOMETHING_RAID);
    				break;
    			case 11: // Random landed on 11
    				itemReceived = Utility.randomElement(SOMETHING_RAID);
    				break;
    			default:
    				break;
    			}
    			if (itemReceived == null) {
    				player.send(new SendMessage("You unlock the chest but find no key."));
    				return;
    			}
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    Reply With Quote  
     

  10. #9  
    Registered Member
    Join Date
    Mar 2019
    Posts
    57
    Thanks given
    3
    Thanks received
    2
    Rep Power
    13
    @Professor Oak
    Awesome thank you. One last question, does case 10 mean you have 1/10 chance to receive the reward?
    Reply With Quote  
     

  11. #10  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    Quote Originally Posted by DDS ROfl View Post
    @Professor Oak
    Awesome thank you. One last question, does case 10 mean you have 1/10 chance to receive the reward?
    No because you've set the random to 50, which means it's gonna be 1/50 (or 51 I think? if its inclusive 0 and 50, never used vencillio and tired atm)
    just change the number in Utility.random(50)
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    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. Clicking Object issue.
    By Dat Guy in forum Help
    Replies: 0
    Last Post: 11-01-2012, 11:07 PM
  2. Replies: 4
    Last Post: 02-12-2012, 06:16 AM
  3. 508 OBJECT ISSUE * Help
    By Mr House in forum Help
    Replies: 13
    Last Post: 11-21-2011, 12:04 AM
  4. Object issues i will give rep [Dementhium]
    By demon dylan001 in forum Help
    Replies: 9
    Last Post: 07-17-2011, 11:15 PM
  5. object issue
    By gamerx in forum Help
    Replies: 2
    Last Post: 11-25-2008, 02:30 AM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •