Code-x

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

 

 pickpocketing

Go down 
AuthorMessage
Evil Mage
Admin
Admin
Evil Mage

Number of posts : 432
Age : 28
Registration date : 2008-05-08

pickpocketing Empty
PostSubject: pickpocketing   pickpocketing Icon_minitimeFri Aug 08, 2008 2:17 pm

Purpose: To add my version of pickpocketing to your server, with a chance to fail which causes you to be stunned and take damage.

Difficulty: 2/10

Assumed Knowledge: How to add voids, how to add interaction with npcs, how to edit a void.

Server Base: Jukks Cleaned V3

Classes Modified: client.java

Procedure
Step 1: Add this void:

Code:
public void pickPocket(int lev, int loot, int amount, int exp, String name, int hit) {
int chance = 0;
if(playerLevel[17]  >= lev) {
chance = 3 + (playerLevel[17] - lev);
            if(actionTimer == 0) {
               if(misc.random(chance) >= 3) {
               addSkillXP(exp, 17);
               sendMessage("You pickpocket the "+name);
               addItem(loot, amount);
               actionTimer = 5;
               startAnimation(881);
               updateRequired = true;
               appearanceUpdateRequired = true;
            }
            else {
               sendMessage("You fail to pickpocket the "+name);
               stunDelay = 10;
               actionTimer = 10;
               stillgfx(80, absY, absX);
               startAnimation(881);
               hitDiff = misc.random(hit);
               hitUpdateRequired = true;
               updateRequired = true;
               appearanceUpdateRequired = true;
            }
}
}
else if(playerLevel[17] < lev) {
sendMessage("You need a thieving level of "+lev+" to pickpocket "+name);
}
}

Step 2: Decide which npc your going to add to be pickpocketed. Find second or third click npc, depending on the option position on your chosen npc. Add this somewhere there:

Code:
else if (NPCID == ####) {
pickPocket(1, 2, 3, 4, "name", 5);
}

Replace #### with the NPC id of your chosen npc to be pickpocketed. Replace the number 1 with the level required to pickpocket the npc. Replace the number 2 with the item you wish to loot from the npc, and replace the number 3 with the amount of the item to add. Replace 4 with the amount of exp given and replace name with the name of the npc. Finally replace 5 with the max amount of damage that can be caused by the npc if you fial. e.g to steal 1k cash from a man, with a thieving level of 1 and receive 100 exp, and if you fail get hit upto 2, add:

Code:
else if(NPCID == 1) {
pickPocket(1,995,1000,100,"Man",2);
}

Step 3: Declare this int:


Code:
public int stunDelay = 0;

Step 4: Find:

Code:
if (EntangleDelay >= 1) {
teleportToX = absX;
teleportToY = absY;
sendMessage("A magical force stops you from moving!");
}

Step 5: Under }, add:

Code:
if(stunDelay >= 1) {
   teleportToX = absX;
teleportToY = absY;
sendMessage("You are stunned!");
}

Step 6: Find:

Code:
if(EntangleDelay > 0)
        EntangleDelay -= 1;

under that add:

Code:
if(stunDelay > 0)
        stunDelay -= 1;
Back to top Go down
 
pickpocketing
Back to top 
Page 1 of 1

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