Thread: Knifes with bolts in ammo

Results 1 to 3 of 3
  1. #1 Knifes with bolts in ammo 
    Junior Programmer

    Stoked's Avatar
    Join Date
    Apr 2012
    Age
    20
    Posts
    3,635
    Thanks given
    424
    Thanks received
    428
    Rep Power
    165
    Hello Rune-Server,

    I was wondering if anybody could help me with this?

    Basically, when wielding any items such as Rune knives (range weapon), if they have any ammo such as Runite bolts, ruby bolts or rune arrows for instance, they can hit so much more, how do i make it so even if they're wielding other ammo, that it only collects the str bonus from the knives?

    Players can hit really high agaisnt monsters with iron knives with ruby bolts (e) on their player.


    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
    Donator


    Join Date
    Oct 2012
    Posts
    4,723
    Thanks given
    1,685
    Thanks received
    1,098
    Rep Power
    1405
    Like this below, it's not hard to adapt to any other base. Goodluck.

    Code:
    public static void calcBonuses(Player player, boolean ignoreArrows) {
    		Arrays.fill(player.getBonuses(), 0);
    		for (int index = 0; index < player.getBonuses().length; index++) {
    			if (index == EquipmentConstants.AMMO_SLOT && ignoreArrows)
    				continue; 
    			final Item item = player.getEquipment().get(index);
    			
    			if (item != null) {
    				EquipmentDefinition def = EquipmentDefinition.EQUIPMENT_DEFINITIONS.get(item.getId());
    
    				for (int slot = 0; slot < Math.min(player.getBonuses().length, def.getBonuses().length); slot++) {
    					player.getBonuses()[slot] += def.getBonuses()[slot];
    				}
    			}
    		}
    	}
    Quote Originally Posted by Velocity View Post
    i'd love to get called in the middle of the night just to hear an indian voice whisper "the nulls are back friend, how i fix"
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Junior Programmer

    Stoked's Avatar
    Join Date
    Apr 2012
    Age
    20
    Posts
    3,635
    Thanks given
    424
    Thanks received
    428
    Rep Power
    165
    Quote Originally Posted by _Patrick_ View Post
    Like this below, it's not hard to adapt to any other base. Goodluck.

    Code:
    public static void calcBonuses(Player player, boolean ignoreArrows) {
    		Arrays.fill(player.getBonuses(), 0);
    		for (int index = 0; index < player.getBonuses().length; index++) {
    			if (index == EquipmentConstants.AMMO_SLOT && ignoreArrows)
    				continue; 
    			final Item item = player.getEquipment().get(index);
    			
    			if (item != null) {
    				EquipmentDefinition def = EquipmentDefinition.EQUIPMENT_DEFINITIONS.get(item.getId());
    
    				for (int slot = 0; slot < Math.min(player.getBonuses().length, def.getBonuses().length); slot++) {
    					player.getBonuses()[slot] += def.getBonuses()[slot];
    				}
    			}
    		}
    	}
    Much appreciated !


    [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)

Similar Threads

  1. Help with interface in wildu
    By WebsterScape in forum Help
    Replies: 0
    Last Post: 07-27-2009, 06:44 PM
  2. Need some help with IPBAN in BULBY
    By Creator Of Homiescape 317 in forum Requests
    Replies: 0
    Last Post: 04-11-2009, 06:14 PM
  3. Replies: 21
    Last Post: 03-18-2009, 06:51 AM
  4. help with freezes in server
    By anc13nts in forum Help
    Replies: 3
    Last Post: 08-05-2008, 09:42 AM
  5. Replies: 13
    Last Post: 04-11-2008, 10:33 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
  •