Make sure that this part here is true:
If it is true then it is something to do with your initiation code.Code:wholeCommand.equalsIgnoreCase("petbattle")
|
So I'm writing a pet battle system, to test the combat I added it to a command :etbattle "player2s username"
nothing happens not even the message that says only pets may be used. I used both pets and familiars (which should send the message saying only pets) but literally nothing works. Any suggestions? Here's the code-
Code:if(wholeCommand.equalsIgnoreCase("petbattle")) { //String player = command[1]; Player player2 = World.getPlayerByName(wholeCommand.substring(command[0].length() + 1)); if (player2 == null) { player.getPacketSender().sendMessage("Target does not exist. Unable to start PetBattle."); return; } NPC npc = player.getSummoning().getFamiliar().getSummonNpc(); NPC npc2 = player2.getSummoning().getFamiliar().getSummonNpc(); if (!player.getSummoning().getFamiliar().isPet() && !player2.getSummoning().getFamiliar().isPet() || !player.getSummoning().getFamiliar().isPet() || !player2.getSummoning().getFamiliar().isPet()) { player.getPacketSender().sendMessage("Only Pets May Be Used Here!"); player2.getPacketSender().sendMessage("Only Pets May Be Used Here!"); return; } npc.setSummoningCombat(true); npc2.setSummoningCombat(true); npc.getCombatBuilder().attack(npc2); npc2.getCombatBuilder().attack(npc); npc.setEntityInteraction(npc.getCombatBuilder().getVictim()); npc2.setEntityInteraction(npc2.getCombatBuilder().getVictim()); }
Make sure that this part here is true:
If it is true then it is something to do with your initiation code.Code:wholeCommand.equalsIgnoreCase("petbattle")
yeah its true. I'm pretty sure it's somewhere in here-
So they way I have it set up is to make sure that the followers of both players is a pet, and if neither OR one or the other is not a pet it should trigger this message-Code:NPC npc = player.getSummoning().getFamiliar().getSummonNpc(); NPC npc2 = player2.getSummoning().getFamiliar().getSummonNpc(); if (!player.getSummoning().getFamiliar().isPet() && !player2.getSummoning().getFamiliar().isPet() || !player.getSummoning().getFamiliar().isPet() || !player2.getSummoning().getFamiliar().isPet()) { player.getPacketSender().sendMessage("Only Pets May Be Used Here!"); player2.getPacketSender().sendMessage("Only Pets May Be Used Here!"); return; } npc.setSummoningCombat(true); npc2.setSummoningCombat(true); npc.getCombatBuilder().attack(npc2); npc2.getCombatBuilder().attack(npc); npc.setEntityInteraction(npc.getCombatBuilder().getVictim()); npc2.setEntityInteraction(npc2.getCombatBuilder().getVictim());
Than if both are pets than it should trigger this part and make the two pets fight each other here-Code:if (!player.getSummoning().getFamiliar().isPet() && !player2.getSummoning().getFamiliar().isPet() || !player.getSummoning().getFamiliar().isPet() || !player2.getSummoning().getFamiliar().isPet()) { player.getPacketSender().sendMessage("Only Pets May Be Used Here!"); player2.getPacketSender().sendMessage("Only Pets May Be Used Here!"); return; }
I've tried with pets, with just summoning familiars, with no followers, and nothing seems to happen at all. Not even the message saying only pets allowed.Code:npc.setSummoningCombat(true); npc2.setSummoningCombat(true); npc.getCombatBuilder().attack(npc2); npc2.getCombatBuilder().attack(npc); npc.setEntityInteraction(npc.getCombatBuilder().getVictim()); npc2.setEntityInteraction(npc2.getCombatBuilder().getVictim());
Off topic, thank you for always trying to help me figure this stuff out, its very cool of you, and you are a prime example of how a community like this should be.
So, I've made sure that theis working correctly, and it is. I've checked to make sure that the pets actually use the Boolean and they do. Anyone got suggestions.Code:isPet()
And what stops them? The summoning combat checks to make sure that they are not pets, and it only makes them target the player or npc that the player is attacking. There is nothing in the code that tells them not to attack each other, its just set up for players in wildy and npcs outside. Any npc that is spawned in, is counted as a character.
He just has to modify the way pets are processed while summoned.
@Jrage
Look in Summoning.java class for Ruse base then modify conditions in the processFamiliar() method for pets to attack. Just tested and was able to have pet tormented demon's attack each other. Don't forget to give pet attack speed/hitpoints though.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |