[Help] Modifying how PvP Works

Results 1 to 5 of 5
  1. #1
    Account Upgraded | Title Enabled! Nmb1Gamer is offline
    MemberRank
    Apr 2009 Join Date
    Anime HeavenLocation
    383Posts

    [Help] Modifying how PvP Works

    So I've been trying to mess with my getNearestPvPChar method to change it from being able to only attack one character at a time to
    everyone within range. So far, all my attempts have ended up in failure. Think anyone can lead me to the right direction?

    For anyone who wants to see my getNearestPvPChar method~
    PHP Code:
    public Collection<MapleCharactergetNearestPvPChar(Point attackerdouble maxRangedouble maxHeightCollection<MapleCharacterchr) {
            
    Collection<MapleCharactercharacter = new LinkedList<MapleCharacter>();
            for (
    MapleCharacter a characters) {
                if (
    chr.contains(a.getClient().getPlayer())) {
                    
    Point attackedPlayer a.getPosition();
                    
    MaplePortal Port a.getMap().findClosestSpawnpoint(a.getPosition());
                    
    Point nearestPort Port.getPosition();
                    
    double safeDis attackedPlayer.distance(nearestPort);
                    
    double distanceX attacker.distance(attackedPlayer.getX(), attackedPlayer.getY());
                    if (
    MaplePvP.isLeft) {
                        if (
    attacker.attackedPlayer.&& distanceX maxRange && distanceX && attackedPlayer.>= attacker.maxHeight && attackedPlayer.<= attacker.maxHeight && safeDis 2) {
                            
    character.add(a);
                        }
                    }
                    if (
    MaplePvP.isRight) {
                        if (
    attacker.attackedPlayer.&& distanceX maxRange && distanceX && attackedPlayer.>= attacker.maxHeight && attackedPlayer.<= attacker.maxHeight && safeDis 2) {
                            
    character.add(a);
                        }
                    }
                }
            }
            return 
    character;
        } 


  2. #2
    Account Upgraded | Title Enabled! Nmb1Gamer is offline
    MemberRank
    Apr 2009 Join Date
    Anime HeavenLocation
    383Posts

    Re: [Help] Modifying how PvP Works

    bump #1~

  3. #3
    Account Upgraded | Title Enabled! AuroX is offline
    MemberRank
    Sep 2008 Join Date
    1,431Posts

    Re: [Help] Modifying how PvP Works

    Quote Originally Posted by Nmb1Gamer View Post
    So I've been trying to mess with my getNearestPvPChar method to change it from being able to only attack one character at a time to
    everyone within range.
    Few ways that you could do this
    1. Just add a break after you've added the character into the list since you only want one. (Basically just a "break;" after "character.add(a);")
    2. Another method is to modify the function to return only one character
      PHP Code:
      public MapleCharacter getNearestPvPChar(Point attackerdouble maxRangedouble maxHeightCollection<MapleCharacterchr) { 
              for (
      MapleCharacter a characters) { 
                  if (
      chr.contains(a.getClient().getPlayer())) { 
                      
      Point attackedPlayer a.getPosition(); 
                      
      MaplePortal Port a.getMap().findClosestSpawnpoint(a.getPosition()); 
                      
      Point nearestPort Port.getPosition(); 
                      
      double safeDis attackedPlayer.distance(nearestPort); 
                      
      double distanceX attacker.distance(attackedPlayer.getX(), attackedPlayer.getY()); 
                      if (
      MaplePvP.isLeft) { 
                          if (
      attacker.attackedPlayer.&& distanceX maxRange && distanceX && attackedPlayer.>= attacker.maxHeight && attackedPlayer.<= attacker.maxHeight && safeDis 2) { 
                              return 
      a;
                          } 
                      } 
                      if (
      MaplePvP.isRight) { 
                          if (
      attacker.attackedPlayer.&& distanceX maxRange && distanceX && attackedPlayer.>= attacker.maxHeight && attackedPlayer.<= attacker.maxHeight && safeDis 2) { 
                              return 
      a;
                          } 
                      } 
                  } 
              } 
              return 
      null;  // remember to add a null check just incase if the range does not have any players
          


  4. #4
    Account Upgraded | Title Enabled! Nmb1Gamer is offline
    MemberRank
    Apr 2009 Join Date
    Anime HeavenLocation
    383Posts

    Re: [Help] Modifying how PvP Works

    Quote Originally Posted by AuroX View Post
    Few ways that you could do this
    1. Just add a break after you've added the character into the list since you only want one. (Basically just a "break;" after "character.add(a);")
    2. Another method is to modify the function to return only one character
      PHP Code:
      public MapleCharacter getNearestPvPChar(Point attackerdouble maxRangedouble maxHeightCollection<MapleCharacterchr) { 
              for (
      MapleCharacter a characters) { 
                  if (
      chr.contains(a.getClient().getPlayer())) { 
                      
      Point attackedPlayer a.getPosition(); 
                      
      MaplePortal Port a.getMap().findClosestSpawnpoint(a.getPosition()); 
                      
      Point nearestPort Port.getPosition(); 
                      
      double safeDis attackedPlayer.distance(nearestPort); 
                      
      double distanceX attacker.distance(attackedPlayer.getX(), attackedPlayer.getY()); 
                      if (
      MaplePvP.isLeft) { 
                          if (
      attacker.attackedPlayer.&& distanceX maxRange && distanceX && attackedPlayer.>= attacker.maxHeight && attackedPlayer.<= attacker.maxHeight && safeDis 2) { 
                              return 
      a;
                          } 
                      } 
                      if (
      MaplePvP.isRight) { 
                          if (
      attacker.attackedPlayer.&& distanceX maxRange && distanceX && attackedPlayer.>= attacker.maxHeight && attackedPlayer.<= attacker.maxHeight && safeDis 2) { 
                              return 
      a;
                          } 
                      } 
                  } 
              } 
              return 
      null;  // remember to add a null check just incase if the range does not have any players
          

    I think you misunderstood me. I'm trying to change it to allow you to attack as many players that are in range as possible, kinda like with mobs. It already only allows me to attack one player at a time.

  5. #5
    Alpha Member TiredGuy is offline
    MemberRank
    Mar 2012 Join Date
    Behind YouLocation
    1,527Posts

    Re: [Help] Modifying how PvP Works

    Go to pvp java
    PHP Code:
    private static void DamageBalancer(AbstractDealDamageHandler.AttackInfo attack) { 
    scroll down and change the
    maxDis = 130;
    maxHeight = 45;

    add skills under
    PHP Code:
    private static boolean isRangeAttack(AbstractDealDamageHandler.AttackInfo attack) { 
    or whatever



Advertisement