Check your check for range ammounition and make a exception for this bow.
|
Hi all, my zaryte bow requires arrows to be fired but I want it to fire NO arrows,
I cannot copy the crystal bow methods because there not added but the bow is there and fires, but comes up as an melee weapon on the hit plates.
here is the zaryte bow RangedAmmo methods;
the {} is where the ammo id is meant to go, -1, 0 don't work, any ideas? the base is ruse.Code:ZARYTE_AMMO(new int[] {}, 250, 249, 3, 44, 200, 43, 31),
Check your check for range ammounition and make a exception for this bow.
Equip packet listener:
I've tried changing the ID's to dragon arrows, but still didn't work '78' is the spirit / soul arrow, what's the ID for no arrow to be fired? 0, -1 don't work, and I can't copy the crystal bow codeCode:case 20171: boolean haveAmmo = player.getEquipment().get(Equipment.AMMUNITION_SLOT).getId() == 78; boolean Arrow = player.getEquipment().get(Equipment.AMMUNITION_SLOT).getId() == 78; player.getPacketSender().sendMessage("<img=10> The Zaryte bow WILL NOT work in PvP fights!"); break; case 78: boolean zaryte = player.getEquipment().get(Equipment.WEAPON_SLOT).getId() == 20171; boolean hasArrow = player.getEquipment().get(Equipment.AMMUNITION_SLOT).getId() == 78; boolean noWep = player.getEquipment().get(Equipment.WEAPON_SLOT).getId() == -1; if (noWep) { player.getInventory().delete(78, 1); return; } break;
78, ID fires the bow but whats the ID for no arrow? because -1. 0 just say that you need ammo
I know but I tried changing those id's to dragon arrows, for an example and they didn't work
whats the id for firing nothing? 0 or -1
So on ruse when you add a ranged weapon you want to first off add it like you did in CombatRangedAmmo under the weapons side and then in weapon_interfaces.json you want to add the item id with the correct weapon interface like SHORTBOW or LONGBOW. You don't need to create a "custom" ammunition with 0 or -1 because it's not guaranteed to be set up to work like that.
The best option for you to do is go to DefaultRangedCombatStrategy and you'll find all the methods you need there. You just have to add an exception in like 3 or 4 methods like if(itemId == ZARYTE_BOW_ID) then return (do not check for ammo) basically. A bit more effort than that because you have to add some checks to prevent decrementing ammo and stuff like that, but basically all you need is in DefaultRangedCombatStrategy. Thats actually where your crystal bow is handled where you said it wasn't. If you go to that file and search for the crystal bow id or just "crystal" in general you'll probably find what you're looking for
Thanks for the communication, "Crystal" won't appear in any ide search anywhere, and crystal bow is an ranged weapon (fires and uses gfx) but when it hits the player or npc its showing melee hitplates
So in DefaultRangedCombatStrategy you have a canAttack method and this comes default on every ruse server. I wouldn't think that yours would be different, but if it is, then here is the crystal bow code that you're missing.
canAttack
and then in the attack methodCode:if (CombatFactory.crystalBow(player)) { return true; }
Like I was saying before you want to return true in your canAttack method for the specific item id of the zaryte bow and then for your attack method you want to decrement ammo if it's not a certain id. Where mine says CombatFactory.crystalBow you would put the item id there instead. Also your crystal bow could be showing up as melee because you don't have the interface set in weapon_interfaces.json and it's defaulting to meleeCode:if (!CombatFactory.crystalBow(player)) { decrementAmmo(player, victim.getPosition()); if(dBow || player.getRangedWeaponData() == RangedWeaponData.MAGIC_SHORTBOW && player.isSpecialActivated() && player.getCombatSpecial() != null && player.getCombatSpecial() == CombatSpecial.MAGIC_SHORTBOW) { decrementAmmo(player, victim.getPosition()); } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |