Thread: [RUSE] Having troubles getting my pet battle system to engage (Get no errors)

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1 [RUSE] Having troubles getting my pet battle system to engage (Get no errors) 
    Registered Member

    Join Date
    Oct 2016
    Posts
    158
    Thanks given
    76
    Thanks received
    39
    Rep Power
    105
    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());
    		}
    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
    Make sure that this part here is true:
    Code:
    wholeCommand.equalsIgnoreCase("petbattle")
    If it is true then it is something to do with your initiation code.


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

    Join Date
    Oct 2016
    Posts
    158
    Thanks given
    76
    Thanks received
    39
    Rep Power
    105
    Quote Originally Posted by arch337 View Post
    Make sure that this part here is true:
    Code:
    wholeCommand.equalsIgnoreCase("petbattle")
    If it is true then it is something to do with your initiation code.
    yeah its true. I'm pretty sure it's somewhere in here-

    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());
    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:
    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;
    			}
    Than if both are pets than it should trigger this part and make the two pets fight each other here-
    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());
    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.


    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.
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Oct 2016
    Posts
    158
    Thanks given
    76
    Thanks received
    39
    Rep Power
    105
    So, I've made sure that the
    Code:
     isPet()
    is working correctly, and it is. I've checked to make sure that the pets actually use the Boolean and they do. Anyone got suggestions.
    Reply With Quote  
     

  5. #5  
    Im an albatraoz

    Nand0's Avatar
    Join Date
    Feb 2010
    Age
    31
    Posts
    948
    Thanks given
    233
    Thanks received
    128
    Rep Power
    241
    uhm that is not going to work ruse pets are summoning familiars and they can't attack eachother the way ruse comes only players in wild/other npcs



    Looking for blazing fast and affordable vps or web hosting?
    AllGeniusHost



    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Oct 2016
    Posts
    158
    Thanks given
    76
    Thanks received
    39
    Rep Power
    105
    Quote Originally Posted by Nand0 View Post
    uhm that is not going to work ruse pets are summoning familiars and they can't attack eachother the way ruse comes only players in wild/other npcs
    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.
    Reply With Quote  
     

  7. #7  
    Im an albatraoz

    Nand0's Avatar
    Join Date
    Feb 2010
    Age
    31
    Posts
    948
    Thanks given
    233
    Thanks received
    128
    Rep Power
    241
    Quote Originally Posted by Jrage View Post
    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.
    Doesn't eclipse give you any errors?



    Looking for blazing fast and affordable vps or web hosting?
    AllGeniusHost



    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    Oct 2016
    Posts
    158
    Thanks given
    76
    Thanks received
    39
    Rep Power
    105
    Quote Originally Posted by Nand0 View Post
    Doesn't eclipse give you any errors?
    As I stated in the title, No Errors.

    There is nothing that happens, not even the message saying "Pets only".
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Jan 2019
    Posts
    26
    Thanks given
    4
    Thanks received
    16
    Rep Power
    29
    Quote Originally Posted by Nand0 View Post
    uhm that is not going to work ruse pets are summoning familiars and they can't attack eachother the way ruse comes only players in wild/other npcs
    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.
    Reply With Quote  
     

  10. #10  
    Im an albatraoz

    Nand0's Avatar
    Join Date
    Feb 2010
    Age
    31
    Posts
    948
    Thanks given
    233
    Thanks received
    128
    Rep Power
    241
    you commented out
    Code:
    //String player = command[1];
    i think that is used to get the players name



    Looking for blazing fast and affordable vps or web hosting?
    AllGeniusHost



    Reply With Quote  
     

Page 1 of 2 12 LastLast

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: 0
    Last Post: 11-27-2012, 03:46 AM
  2. I'm having trouble configuring my OS
    By X r4ng3r X in forum Software
    Replies: 3
    Last Post: 08-01-2012, 07:16 AM
  3. Having trouble with my client maybe jaring
    By Zonebird in forum Help
    Replies: 4
    Last Post: 07-12-2012, 05:50 AM
  4. having trouble starting my server on a linux vps
    By OodlesOfNoodles in forum Help
    Replies: 0
    Last Post: 12-23-2011, 07:25 AM
  5. [PI] having trouble with my interface
    By Xseil in forum Help
    Replies: 7
    Last Post: 11-04-2011, 03: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
  •