Thread: [Special Attack Issue]

Results 1 to 3 of 3
  1. #1 [Special Attack Issue] 
    Registered Member
    Levi X D's Avatar
    Join Date
    Feb 2012
    Posts
    567
    Thanks given
    104
    Thanks received
    72
    Discord
    Blunt sucks#7803
    Rep Power
    111
    Hey guys! In need of some assistance here.

    So I am trying to make the Dragon Hunter Lance special attack scale, based off of the special attack percentage the player has at the time. It seems to just skip the first set entirely, and just go to the bottom piece of code. Not taking into account the special attack percentage the player has.


    Code:
    case 24668://Dragon hunter lance spec
    		if (player.getCombatDefinitions().getSpecialAttackPercentage() == 100) {
    			player.animate(new Animation(10502));
    			delayNormalHit(weaponId, attackStyle,
    				getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.85, true)));
    			break;
    		} else
    		if (player.getCombatDefinitions().getSpecialAttackPercentage() <= 99) {
    			player.animate(new Animation(10502));
    			delayNormalHit(weaponId, attackStyle,
    				getMeleeHit(player, getRandomMaxHit(player, weaponId, attackStyle, false, true, 1.65, true)));
    			break;
    		}
    		break;
    Special Execute
    Code:
    public static boolean specialExecute(Player player) {
    		int weaponId = player.getEquipment().getWeaponId();
    		player.getCombatDefinitions().switchUsingSpecialAttack();
    		int specAmt = getSpecialAmmount(weaponId);
    		if (specAmt == 0) {
    			player.getPackets()
    					.sendGameMessage("This weapon has no special Attack, if you still see special bar please relogin.");
    			return false;
    		}
    		if (player.getCombatDefinitions().getSpecialAttackPercentage() > 0 && weaponId == 24668) {
    			player.getCombatDefinitions().setSpecialAttack(0);
    			return true;
    		}
    		if (player.getCombatDefinitions().hasRingOfVigour())
    			specAmt *= 0.9;
    		if (player.getCombatDefinitions().hasRingOfVigourImbued())
    			specAmt *= 0.75;
    		if (player.getInventory().containsItem(773, 1))
    			specAmt *= 0.0;
    		if (player.getCombatDefinitions().getSpecialAttackPercentage() < specAmt) {
    			player.getPackets().sendGameMessage("You don't have enough power left.");
    			player.getCombatDefinitions().desecreaseSpecialAttack(0);
    			return false;
    		}
    		player.getCombatDefinitions().desecreaseSpecialAttack(specAmt);
    		return true;
    	}
    Gif
    [Only registered and activated users can see links. ]

    Can anyone point me in the right direction?
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2013
    Posts
    4,409
    Thanks given
    58
    Thanks received
    476
    Rep Power
    138
    Start debugging with printing messages out.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Levi X D's Avatar
    Join Date
    Feb 2012
    Posts
    567
    Thanks given
    104
    Thanks received
    72
    Discord
    Blunt sucks#7803
    Rep Power
    111
    Quote Originally Posted by Mayne View Post
    Start debugging with printing messages out.
    With debugging, and printing messages, I can confirm it is just ignoring the first If statement entirely and going straight to the 2nd if statement. Odd... Gonna try and rework it.

    EDIT:

    Fixed it. It was due to me setting the special attack to 0, inside of specialExecute
    Code:
    public static boolean specialExecute(Player player) {
    		int weaponId = player.getEquipment().getWeaponId();
    		player.getCombatDefinitions().switchUsingSpecialAttack();
    		int specAmt = getSpecialAmmount(weaponId);
    		if (specAmt == 0) {
    			player.getPackets()
    					.sendGameMessage("This weapon has no special Attack, if you still see special bar please relogin.");
    			return false;
    		}
    		if (player.getCombatDefinitions().getSpecialAttackPercentage() > 0 && weaponId == 24668) {
    			player.getCombatDefinitions().setSpecialAttack(0); //This
    			return true;
    		}
    		if (player.getCombatDefinitions().hasRingOfVigour())
    			specAmt *= 0.9;
    		if (player.getCombatDefinitions().hasRingOfVigourImbued())
    			specAmt *= 0.75;
    		if (player.getInventory().containsItem(773, 1))
    			specAmt *= 0.0;
    		if (player.getCombatDefinitions().getSpecialAttackPercentage() < specAmt) {
    			player.getPackets().sendGameMessage("You don't have enough power left.");
    			player.getCombatDefinitions().desecreaseSpecialAttack(0);
    			return false;
    		}
    		player.getCombatDefinitions().desecreaseSpecialAttack(specAmt);
    		return true;
    	}
    [Only registered and activated users can see links. ]
    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. Server Issue - special attack
    By tekkit in forum Help
    Replies: 3
    Last Post: 03-28-2017, 07:54 AM
  2. Special attack bar issues
    By Crucify in forum Help
    Replies: 2
    Last Post: 08-23-2016, 05:51 AM
  3. 98% Special Attacks
    By Palidino in forum Tutorials
    Replies: 198
    Last Post: 01-24-2009, 08:26 PM
  4. special attacks. Tut
    By o0x vvv x0o in forum Tutorials
    Replies: 13
    Last Post: 10-14-2007, 07:08 PM
  5. Special attacks
    By corretje in forum Tutorials
    Replies: 16
    Last Post: 08-10-2007, 11:06 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
  •