Code-x
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Code-x

Code-x Private Server
 
HomeHome  PortalPortal  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

 

 Correct Spot to adding attack timers

Go down 
AuthorMessage
purez
Member
Member



Number of posts : 33
Registration date : 2008-06-07

Correct Spot to adding attack timers Empty
PostSubject: Correct Spot to adding attack timers   Correct Spot to adding attack timers Icon_minitimeTue Jul 01, 2008 1:14 pm

Part 1: Adding in Attack Npc Weapon Delays

Open up client.java and search for this
Code:
public boolean AttackNPC() {

You should see this
Code:
public boolean AttackNPC() {
  int EnemyX = server.npcHandler.npcs[attacknpc].absX;
  int EnemyY = server.npcHandler.npcs[attacknpc].absY;
  int offsetX = (absX - EnemyX) * -1;
  int offsetY = (absY - EnemyY) * -1;
  int EnemyHP = server.npcHandler.npcs[attacknpc].HP;
  int hitDiff = 0;
                int Npchitdiff = 0;
                int wepdelay = 0;
                CalculateMaxHit();
                hitDiff = misc.random(playerMaxHit);
faceNPC(attacknpc);
//viewTo(server.npcHandler.npcs[attacknpc].absX, server.npcHandler.npcs[attacknpc].absY);

if(server.npcHandler.npcs[attacknpc].followPlayer < 1 || server.npcHandler.npcs[attacknpc].followPlayer == playerId || inwildy2 == true) {
if(playerEquipment[playerWeapon] == (1333)) //rune scimi here

Or something related to that than below that add in a statement like this

Code:
if(playerEquipment[playerWeapon] == (ItemID)) // Note
{
PkingDelay = 3;
wepdelay = 3;
resetanim = 3;
}

this is the basic one Where it says ItemID you add in the id of the weapon you want to have these delays while attacking npcs than after the (ItemId)) there is a //Note that is just a note next to the weapon so you can know what weapon that is so for example if you had a whip there you would say in the note //Whip Delay or something like that. But you do not need to have the note, if you do not delete both the // and the note next to it
Than the PkingDelay, wepdelay, resetanim = 3;'s you change the 3s to change the delays easy

Part 2: Changing Delays while attacking people

Search client.java for
Code:
  public boolean Attack() {

You should see a code set like this
Code:
   public boolean Attack() {
  int EnemyX = PlayerHandler.players[AttackingOn].absX;
  int EnemyY = PlayerHandler.players[AttackingOn].absY;
  int offsetX = (absX - EnemyX) * -1;
  int offsetY = (absY - EnemyY) * -1;
  int EnemyHP = PlayerHandler.players[AttackingOn].playerLevel[playerHitpoints];
  int EnemyHPExp = PlayerHandler.players[AttackingOn].playerXP[playerHitpoints];
                client AttackingOn2 = (client) server.playerHandler.players[AttackingOn];
  boolean RingOfLife = false;
  if (PlayerHandler.players[AttackingOn].playerEquipment[playerRing] == 2570) {
     RingOfLife = true;
  }
  int hitDiff = 0;
                int wepdelay = 0;
                CalculateMaxHit();
  hitDiff = misc.random(playerMaxHit);

//viewTo(server.playerHandler.players[AttackingOn].absX, server.playerHandler.players[AttackingOn].absY);

Below that add in a if statement like this

Code:
if(playerEquipment[playerWeapon] == (ItemID)) // Note
{
PkingDelay = 30;
wepdelay = 30;
}

Once again the same rules apply

Part 3: adding more weapon/Items for delay to work

If you want to make the if statement for example need Full dharoks and than it has a certain delay you would do something like this

Code:
if(playerEquipment[playerWeapon] == (ItemId)) //Note
if(playerEquipment[playerChest] == (ItemId))
if(playerEquipment[playerLegs] == (ItemId))
{
PkingDelay = 20;
wepdelay = 20;
}

Again put the item id in the ItemId slot and the note part again


IF you wanted them to need a certain ring, Amulet, Shield, cape, arrows, hands, or feet to have the delay the ifs would be like this

Code:
if(playerEquipment[playerShield] == (ItemId))  //Shield
if(playerEquipment[playerRing] == (ItemId))  //Ring
if(playerEquipment[playerHands] == (ItemId))  //Hands
if(playerEquipment[playerFeet] == (ItemId))  //Feet
if(playerEquipment[playerCape] == (ItemId))  //Cape
if(playerEquipment[playerAmulet] == (ItemId))  //Amulet
if(playerEquipment[playerArrows] == (ItemId))  //Arrows

Hope this Helped you out and taught you something related to Java

Thanks Purez/wangdoodle
Back to top Go down
 
Correct Spot to adding attack timers
Back to top 
Page 1 of 1
 Similar topics
-
» Adding Working Combat Pot - Some what glitched
» Adding Working Potions - Combat Included
» Adding A Jail! (nice to lock nubs up for a while)

Permissions in this forum:You cannot reply to topics in this forum
Code-x :: General Chat :: runescape private [TUT] section-
Jump to: