Thread: 317 pi spec potion timer

Results 1 to 4 of 4
  1. #1 317 pi spec potion timer 
    Banned

    Join Date
    Oct 2012
    Posts
    4,722
    Thanks given
    1,684
    Thanks received
    1,101
    Rep Power
    0
    does anyone how to add a timer on a certain potion once you drink the potion you need to wait ... seconds to drink it again
    Reply With Quote  
     

  2. #2  
    Registered Member Nicholas's Avatar
    Join Date
    May 2011
    Age
    29
    Posts
    406
    Thanks given
    144
    Thanks received
    59
    Rep Power
    18
    Potions.java

    add this under the switch statement:

    Code:
                case 15300: //Recover Special
                    recoverSpecial(itemId, 15301, slot);
                    break;
                case 15301: //Recover Special
                    recoverSpecial(itemId, 15302, slot);
                    break;
                case 15302: //Recover Special
                    recoverSpecial(itemId, 15303, slot);
                    break;
                case 15303: //Recover Special
                    recoverSpecial(itemId, 229, slot);
                    break;
    and add this method anywhere in the class (it has a 30 second delay)

    Code:
        public void recoverSpecial(final int itemId, final int replaceItem, final int slot) {
            if (c.inWild()) {
                c.sendMessage("You are unable to restore special in the wilderness.");
                return;
            } else if (c.specAmount >= 7.5) {
                c.sendMessage("You are unable to drink the potion as your special is above 75%.");
            } else {
                if (System.currentTimeMillis() - c.restoreDelay >= 30000) {
                    c.specAmount += 2.5;
                    c.startAnimation(829);
                    c.sendMessage("As you drink drink the potion, you feel your special attack slightly regenerate.");
                    c.playerItems[slot] = replaceItem + 1;
                    c.getItems().resetItems(3214);
                    c.getItems().updateSpecialBar();
                    c.restoreDelay = System.currentTimeMillis();
                } else {
                    c.sendMessage("You can only restore your special once every 30 seconds.");
                }
            }
        }
    And declare this in Player.java

    Code:
    public long restoreDelay;


    R-S Admin Response  Albert Einstein
    If you can't explain it simply, you don't understand it well enough.
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Oct 2012
    Posts
    4,722
    Thanks given
    1,684
    Thanks received
    1,101
    Rep Power
    0
    Quote Originally Posted by Nicholas View Post
    Potions.java

    add this under the switch statement:

    Code:
                case 15300: //Recover Special
                    recoverSpecial(itemId, 15301, slot);
                    break;
                case 15301: //Recover Special
                    recoverSpecial(itemId, 15302, slot);
                    break;
                case 15302: //Recover Special
                    recoverSpecial(itemId, 15303, slot);
                    break;
                case 15303: //Recover Special
                    recoverSpecial(itemId, 229, slot);
                    break;
    and add this method anywhere in the class (it has a 30 second delay)

    Code:
        public void recoverSpecial(final int itemId, final int replaceItem, final int slot) {
            if (c.inWild()) {
                c.sendMessage("You are unable to restore special in the wilderness.");
                return;
            } else if (c.specAmount >= 7.5) {
                c.sendMessage("You are unable to drink the potion as your special is above 75%.");
            } else {
                if (System.currentTimeMillis() - c.restoreDelay >= 30000) {
                    c.specAmount += 2.5;
                    c.startAnimation(829);
                    c.sendMessage("As you drink drink the potion, you feel your special attack slightly regenerate.");
                    c.playerItems[slot] = replaceItem + 1;
                    c.getItems().resetItems(3214);
                    c.getItems().updateSpecialBar();
                    c.restoreDelay = System.currentTimeMillis();
                } else {
                    c.sendMessage("You can only restore your special once every 30 seconds.");
                }
            }
        }
    And declare this in Player.java

    Code:
    public long restoreDelay;

    isnt there another way because i made my special diffrent let me send my code


    Code:
    case 10925://sanfew serums
    	 			if(c.inPits || c.inFunPk() || c.isInHighRiskPK()) 
    				return;
    				if(c.inFaladorPvP())
    				return;
    				if (c.inWild() || c.safeTimer > 0){
    				c.sendMessage("You can't use this in the wilderness!");
    				return;
    				}
    	 			if (c.memberStatus < 0){
    				//c.sendMessage("@[email protected] donators can use this. Type ::donate for information.");
    				return;
    				}
    				drinkPrayerPot(itemId,10927,slot,true);
    				c.specAmount = 10.0;
    				c.drinkTimer = 45;
    				c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    				c.sendMessage("@[email protected] special attack has been restored.");
    				break;
    				case 10927:
    	 			if(c.inPits || c.inFunPk() || c.isInHighRiskPK())
    				return;
    				if(c.inFaladorPvP())
    				return;
    				if (c.inWild() || c.safeTimer > 0){
    				c.sendMessage("You can't use this in the wilderness!");
    				return;
    				}
    	 			if (c.memberStatus < 0){
    				//c.sendMessage("@[email protected] donators can use this. Type ::donate for information.");
    				return;
    				}
    				drinkPrayerPot(itemId,10929,slot,true);
    				c.specAmount = 10.0;
    				c.drinkTimer = 45;
    				c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    				c.sendMessage("@[email protected] special attack has been restored.");
    				break;
    				case 10929:
    	 			if(c.inPits || c.inFunPk() || c.isInHighRiskPK())
    				return;
    				if(c.inFaladorPvP())
    				return;
    				if (c.inWild() || c.safeTimer > 0){
    				c.sendMessage("You can't use this in the wilderness!");
    				return;
    				}
    	 			if (c.memberStatus < 0){
    				//c.sendMessage("@[email protected] donators can use this. Type ::donate for information.");
    				return;
    				}	
    				drinkPrayerPot(itemId,10931,slot,true);
    				c.specAmount = 10.0;
    				c.drinkTimer = 45;
    				c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    				c.sendMessage("@[email protected] special attack has been restored.");
    				break;
    				case 10931:
    	 			if(c.inPits || c.inFunPk() || c.isInHighRiskPK())
    				return;
    				if(c.inFaladorPvP())
    				return;
    				if (c.inWild() || c.safeTimer > 0){
    				c.sendMessage("You can't use this in the wilderness!");
    				return;
    				}
    	 			if (c.memberStatus < 0){
    				c.sendMessage("@[email protected] donators can use this. Type ::donate for information.");
    				return;
    				}
    				drinkPrayerPot(itemId,229,slot,true);
    				c.specAmount = 10.0;
    				c.drinkTimer = 45;
    				c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    				c.sendMessage("@[email protected] special attack has been restored.");
    				break;
    			}
    		}	
    	}
    any idea on how to make it with this code?

    c.drinkTimer = 45; doesnt work
    Reply With Quote  
     

  4. #4  
    Registered Member Nicholas's Avatar
    Join Date
    May 2011
    Age
    29
    Posts
    406
    Thanks given
    144
    Thanks received
    59
    Rep Power
    18
    Quote Originally Posted by ipkmills View Post
    any idea on how to make it with this code?
    If doesn't matter, I found that code in a basic PI... Just add the rest of your servers checks next to the c.isInWildy() check...

    Use that, or do it yourself. I gave you a pretty decent way to do it, i'm not catering to every one of your whims...


    R-S Admin Response  Albert Einstein
    If you can't explain it simply, you don't understand it well enough.
    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. Help Command [317 PI]
    By king dark in forum Snippets
    Replies: 3
    Last Post: 08-14-2016, 02:32 PM
  2. Replies: 3
    Last Post: 08-22-2013, 07:47 PM
  3. Replies: 2
    Last Post: 04-23-2013, 08:23 PM
  4. Korasi spec proper case 19780 317 pi
    By Cody289 in forum Requests
    Replies: 6
    Last Post: 06-27-2012, 04:31 AM
  5. [PI]Spec refill timer
    By gomomo11 in forum Help
    Replies: 2
    Last Post: 11-04-2010, 09:57 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
  •