Thread: Combat Level Difference and Vengeance Fix

Results 1 to 5 of 5
  1. #1 Combat Level Difference and Vengeance Fix 
    Tetris
    Guest
    Intro: Hey guys, do you have vengeance on your server and a combat certain combat level difference outside of which players cannot attack eachother? If so, you may find that vengeance still attacks any player that you click "Attack" on, regardless of whether or not this player can actually engage in combat with you. I have a fix for this, a short little vengeance modification involving a new boolean and a modification to the attackplayerswithin void.


    Tested On: Czar (Should Work on All/Most)
    Difficulty: 0/10 (Unless you are mentally challenged)
    Assumed Knowledge: How to copy and how to paste, where some things go (maybe).
    Modified classes: Client class (client.java)

    Step One:

    If you already have a boolean for combat level difference, you can skip this step, otherwise complete this step.

    Open Client.java and search for "public void MagicProjectile" (Do NOT use the quotes in your searches for anything that I tell you to search).

    Above that add...

    Code:
    public boolean vengDifference() {
    if (server.playerHandler.players[AttackingOn].combat-combat >= 21 || server.playerHandler.players[AttackingOn].combat-combat <= -21)
    return true;
    else
    return false;     
    }
    This is a boolean that will return true if a player is trying to attack another player that is 20 levels higher or lower than another player, you can edit the combat level difference by changing the numbers "-21" and "21" that are shown in this boolean.

    Step 2:

    If you already have modified case 73 for combat level differences using your own boolean, skip this step as well, otherwise complete this step.

    We will now modify case 73 for combat only if a player is within a certain combat level of your own.

    Search for "case 73: //Attack (Wilderness)"

    and under
    Code:
    client plz = (client) server.playerHandler.players[AttackingOn];
    add the following:


    Code:
    if (vengDifference())
    {
    IsAttacking = false;
    teleportToX = absX;
      teleportToY = absY;
    sendMessage("You must be within 20 levels of your opponent's combat level to attack them.");
    }
    What this does is stop the player from attacking another player if the boolean "vengDifference()" returns true.

    Next search for "if(!nonWild() && !plz.nonWild() && plz != null"

    next to "plz != null" add "&& !vengDifference()"

    so it should look like...

    Code:
    if(!nonWild() && !plz.nonWild() && plz != null && !vengDifference()) {

    This states that a player can only attack another player if they are in the wilderness and the vengDifference boolean returned false.

    Step Three:

    Everyone should follow the directions in this step, because it prevents vengeance from doing damage to players that are not within a player's combat level range.

    Due to the fact that vengeance uses the "attackplayerswithin" void, this is the void that will be modified.

    Search for "public void attackPlayersWithin(int gfx, int maxDamage, int range) {"

    and under that add "if(IsAttacking == true) {"

    so it should look like

    Code:
    public void attackPlayersWithin(int gfx, int maxDamage, int range) {
     if(IsAttacking == true) {
    Now scroll down until you see
    Code:
    person.KillerId = playerId;
    		}
    		}
          }
        }
      }
    }
    }
    Or something similar to that, and at the bottom add one more return bracket that looks like this "}"

    So it should look like...

    Code:
    person.KillerId = playerId;
    		}
    		}
          }
        }
      }
    }
    }
    }

    Step 4: Save and close client.java, compile, and run your server!

    Step 5: Post here with any comments as to whether or not it worked etc.


    Credits: Me (Tetris) (70%) (For the vengeance modifcation and application of the boolean.
    Some guy on RuneLocus that posted a working level difference boolean - Tony Hobo (30%)
     

  2. #2  
    Banned

    Join Date
    Oct 2007
    Posts
    375
    Thanks given
    9
    Thanks received
    23
    Rep Power
    0
    Dont like this version of this Combat levels
     

  3. #3  
    Tetris
    Guest
    May I ask why not?
     

  4. #4  
    Registered Member
    Shamon King's Avatar
    Join Date
    Aug 2007
    Posts
    3,336
    Thanks given
    90
    Thanks received
    228
    Rep Power
    1363
    *sigh*
    all you did was rename the method...
     

  5. #5  
    Tetris
    Guest
    That, and I applied it and changed vengeance so you have to be in combat to inflict damage on other players.
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •