Thread: Overload Potion help!

Results 1 to 4 of 4
  1. #1 Overload Potion help! 
    Registered Member
    Join Date
    May 2017
    Posts
    1
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Hello everyone this is my first post on this forum, i got a problem with adding overloads in elvarg,

    I tried to add potions on Elvarg base this is what i got so far.

    Code:
    	private static void onOverloadEffect(Player player, int seconds) {
    		player.getPacketSender().sendEffectTimer(seconds, EffectTimer.OVERLOAD);	
    		
    //		player.performAnimation(new Animation(2383, Priority.MEDIUM));
    
    		player.getSkillManager().increaseCurrentLevelMax(Skill.ATTACK, (int) Math.floor(5 + (0.19 * 
    				player.getSkillManager().getMaxLevel(Skill.ATTACK))));
    
    		player.getSkillManager().increaseCurrentLevelMax(Skill.STRENGTH, (int) Math.floor(5 + (0.19 * 
    				player.getSkillManager().getMaxLevel(Skill.STRENGTH))));
    
    		player.getSkillManager().increaseCurrentLevelMax(Skill.DEFENCE, (int) Math.floor(5 + (0.19 * 
    				player.getSkillManager().getMaxLevel(Skill.DEFENCE))));
    		
    		player.getSkillManager().increaseCurrentLevelMax(Skill.RANGED, (int) Math.floor(5 + (0.19 * 
    				player.getSkillManager().getMaxLevel(Skill.RANGED))));
    		
    		player.getSkillManager().increaseCurrentLevelMax(Skill.MAGIC, (int) Math.floor(5 + (0.19 * 
    				player.getSkillManager().getMaxLevel(Skill.MAGIC))));
    
    		player.getSkillManager().decreaseCurrentLevel(Skill.HITPOINTS, (int) Math.floor(50 - (0. *    
    				player.getSkillManager().getCurrentLevel(Skill.HITPOINTS))), 1);
    
    			}
    We i got 50 HP I want to not drink the potion (also not the animation) thats why i made this:

    Code:
    		//HP overload	
    		if (PotionConsumable.OVERLOAD_POTIONS != null && player.getSkillManager().getCurrentLevel(Skill.HITPOINTS) < 50) {			
    			player.getPacketSender().sendMessage("I should get some more lifepoints before using this!");
    			return true;
    		}
    OVERLOAD_POTIONS
    [SPOIL]
    Code:
    	OVERLOAD_POTIONS(11730, 11731, 11732, 11733) {
    		@Override
    		public void onEffect(Player player) {
    			PotionConsumable.onOverloadEffect(player, 60 * 5);
    		}
    	},
    [/SPOIL]

    When I drink the potion below 50 health it give me the message and it didnt show the animation. But when i drink other potion below 50 HP it also gives me the message.

    EDIT: Can someone give me any advice how to let the hitmarkers show when the health drops?

    Can someone help me?

    Newb
    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
    debug: "PotionConsumable.OVERLOAD_POTIONS"
    Code:
    System.out.println("send potion: " + PotionConsumable.OVERLOAD_POTIONS);
    		if (PotionConsumable.OVERLOAD_POTIONS != null && player.getSkillManager().getCurrentLevel(Skill.HITPOINTS) < 50) {			
    			player.getPacketSender().sendMessage("I should get some more lifepoints before using this!");
    			return true;
    		}
    Then try one potion and see what it sends to the console.


    "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  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    PotionConsumable.OVERLOAD_POTIONS != null
    I don't get this. Why are you checking if a constant isn't null? A constant is a final field which should never be null (The only way it can be null is if you construct it as a null..)
    You should be able to get the hitmarkers to show by simply applying damage on the player; look inside the source how incoming damage is handled for example and just continue from there.
    Attached image
    Reply With Quote  
     

  4. #4  
    What's a sundial in the shade?

    Lumiere's Avatar
    Join Date
    May 2013
    Age
    27
    Posts
    543
    Thanks given
    224
    Thanks received
    100
    Rep Power
    113
    Code:
    	OVERLOAD(11730, 11731, 11732, 11733) {
    		@Override
    		public void onEffect(Player player) {
    			for (int i = Skill.ATTACK.ordinal(); i <= Skill.MAGIC.ordinal(); i++) {
    				
    				if (i == Skill.HITPOINTS.ordinal())
    					continue;
    				
    				PotionConsumable.onBasicEffect(player, Skill.forId(i), BoostType.OVERLOAD);
    			}
    		}
    	}
    In the #consume method (Obviously, PotionConsumable class);
    Code:
    		if (potion.get().equals(OVERLOAD) && player.hasOverloadEvent())
    			return false;
    In the statement block;
    Code:
    if(player.getPotionTimer().elapsed(1200)) {
    under the single line statement;
    Code:
    potion.get().onEffect(player);
    Add the following;
    Code:
    			if (potion.get().equals(OVERLOAD)) {
    				player.overloadTimer.start(240);
    				player.setOverloadEvent(true);
    				
    				TaskManager.submit(new Task(2, player, true) {
    					@Override
    					public void execute() {
    						
    						if (player.getOverloadDamage() >= 50 || !player.hasOverloadEvent()) {
    							stop();
    							return;
    						}
    						
    						if (player.getOverloadDamage() < 50 && player.hasOverloadEvent()) {
    							player.setOverloadDamage(player.getOverloadDamage() + 10);
    							
    							player.getCombat().getHitQueue().addPendingDamage(new HitDamage(10, HitMask.RED));
    							
    							player.performAnimation(new Animation(3170));
    						}
    					}
    					@Override
    					public void stop() {
    						setEventRunning(false);
    						player.setOverloadDamage(0);
    						player.setOverloadEvent(false);
    						player.performAnimation(Animation.DEFAULT_RESET_ANIMATION);
    					}
    				});
    			}
    In the Player class;
    Code:
    	private boolean overloadEvent;
    	
    	private int overloadDamage = 0;
    	
    	public SecondsTimer overloadTimer = new SecondsTimer();
    Code:
    	public boolean hasOverloadEvent() {
    		return overloadEvent;
    	}
    	
    	public int getOverloadDamage() {
    		return overloadDamage;
    	}
    
    	public void setOverloadEvent(final boolean input) {
    		overloadEvent = input;
    	}
    	
    	public void setOverloadDamage(final int damage) {
    		overloadDamage = damage;
    	}
    Then in the #onTick method, still in the Player class;
    Code:
    		if (!this.overloadTimer.finished()) {
    			PotionConsumable.OVERLOAD.onEffect(this);
    		}
    Enjoy.

    Spoiler for Revy is perfect:
    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: 9
    Last Post: 06-21-2010, 11:08 AM
  2. [req]overload potions + extreams
    By timdude214 in forum Models
    Replies: 6
    Last Post: 06-13-2010, 05:52 PM
  3. Potion Help :s
    By Clarke189 in forum Help
    Replies: 2
    Last Post: 05-04-2010, 07:24 PM
  4. 525 Potions Help - Newbie Coder :(
    By ShadyStyl3 in forum Help
    Replies: 0
    Last Post: 11-29-2009, 12:04 AM
  5. Potions Help.
    By Mr. Rave in forum Help
    Replies: 13
    Last Post: 02-11-2009, 08:33 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
  •