Thread: Base for Npc Thieving

Results 1 to 9 of 9
  1. #1 Base for Npc Thieving 
    Registered Member
    Shamon King's Avatar
    Join Date
    Aug 2007
    Posts
    3,336
    Thanks given
    90
    Thanks received
    228
    Rep Power
    1363
    Difficulty: 1/10
    Purpose: add npc pit pocketing
    Source Used: rs related
    Classes Modified: client.java

    first off add this method
    this is all that is going to be used for the npc thieving
    its alittle long but it works
    has the animations

    Installing Thieving:
    Code:
        public int theifstun = 0;
            public void theiving(int npc, int levelNeeded, double exp, int itemID, int amount, int amountOfTrys, int leastAmountOfTrys, int damage, int amountOfFails, int x, int y, int hieght, String teleMessage, boolean teleTrue) {
    
            if (playerLevel[17] >= levelNeeded) {
                if (misc.random(amountOfTrys) <= leastAmountOfTrys) {
                    addItem(itemID, amount);
                    addSkillXP(exp, 17);
                } else if (misc.random(amountOfTrys) >= leastAmountOfTrys) {
                    updateRequired = true;
                    hitUpdateRequired = true;
                    hitDiff = damage;
                    shoutText("Ouch!");
                    server.npcHandler.npcs[npc].updateRequired = true;
                    server.npcHandler.npcs[npc].textUpdateRequired = true;
                    server.npcHandler.npcs[npc].textUpdate = "What do you think you're doing?";
    
                    gfx100(80);
                    theifstun = 30;
                }	
                if (amountOfTrys == amountOfFails && teleTrue) {
                    tele2(x, y, hieght);
                    sendMessage(teleMessage);
                }
                setAnimation(881);
            } else if (playerLevel[17] < levelNeeded) {
                sendMessage(
                        "You need a theiving levle of " + levelNeeded
                        + " to complete this task.");
            }
    
        }
    
    
        public void shoutText(String text) {
            txt4 = text;
            string4UpdateRequired = true;
        }
    
        public void tele2(int x, int y, int hieght) {
            teleportToX = x;
            teleportToY = y;
            heightLevel = hieght;
            updateRequired = true;
            appearanceUpdateRequired = true;
        }
    add this to your boolean process
    Code:
            if (theifstun > 0) {
                theifstun -= 1;
            }
    in packet 98 (case 96)
    add
    Code:
                if (theifstun > 0) {
                    sendMessage("You are stuned and can't move.");
                }
    in the same packet find
    Code:
    EntangleDelay
    or
    Code:
    IsDead == false
    and next to it add
    Code:
    && theifstun < 1
    example
    Code:
    if (IsDead == false && EntangleDelay <= 0 && theifstun < 1) {
    next go to second click npc or case 17:
    heres a example i am going to be using

    (switch statement)
    Code:
    		case 1:
    		theiving(NPCSlot, 1, 5, 995, 3, 3, 2, 3, absX, absY, heightLevel, "", false);
    		break;
    (no switch)
    Code:
    		if(NPCID == 1) {
    		theiving(NPCSlot, 1, 5, 995, 3, 3, 2, 3, absX, absY, heightLevel, "", false);
    		}
    this will be the basic man

    Explaining:
    the first part NPCSlot is used for finding the id of the npc and sending the message "what do you think your doing?"

    next is the level needed and then the exp
    995 is the item id and the first 3 is the amount

    the next 3 is the amount of trys you have before getting hit
    it is used as the rareity
    right not you have 1/3 chance of getting the coins

    after the amount of tries is the damage you get if you fail to steal the coins
    which will result in say "Ouch!"

    at the end of the method if it is declared true once your amount of fails are used up you get teled out like the ham camp

    after the damge is the amount Of Fails reading above you'll know whats that is for
    it has to be equal to the amount of trys or some where below

    so absX, absY, and heightlevel are the cords of where you are going to tele to

    then the tele message is used for saying what has just happend to you
    example
    "You have been teleported out of the ham camp to an unknow area"

    tudah now you got a basic thieving system for your server
    have fun


    Few More Examples:

    Code:
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                    case 5:
                    case 6:
                        theiving(NPCSlot, 1, 5, 995, 3, 3, 1, 2, 3, absX, absY,
                                heightLevel, "", false);
                        break;
    
                    case 7:
                        if (misc.random(1) == 1) {
                            theiving(NPCSlot, 10, 14.5, randomSeeds(),
                                    misc.random(9), 5, 2, 5, 3, absX, absY,
                                    heightLevel, "", false);
                        }
                        if (misc.random(1) == 0) {
                            theiving(NPCSlot, 10, 14.5, 995, 9, 5, 2, 5, 3, absX,
                                    absY, heightLevel, "", false);
                        }
                        break;
    add this somewhere in client.java
    Code:
        public static int seeds[] = {
            299, 5096, 5097, 5098, 5305, 5306, 5307, 5308, 5309, 5318, 5319, 5320,
            5321, 5322, 5323, 5324, 299, 5096, 5097, 5098, 5305, 5306, 5307, 5308,
            5309, 5318, 5319, 5320, 5321, 5322, 5323, 5324, 5280, 5281, 5283, 5284,
            5285, 5286, 5287, 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5103, 5104,
            5105, 5100, 5099, 5100};
        public static int randomSeeds() {
            return seeds[(int) (Math.random() * seeds.length)];
        }
     

  2. #2  
    kilermage
    Guest
    Nice, good job. I think I may use.

    EDIT:Where is this method tele2. You haven't provided that method...people will get errors.
     

  3. #3  
    Registered Member
    Shamon King's Avatar
    Join Date
    Aug 2007
    Posts
    3,336
    Thanks given
    90
    Thanks received
    228
    Rep Power
    1363
    Quote Originally Posted by kilermage View Post
    Nice, good job. I think I may use.
    0.o fast post
    thanks and please do

    public void tele2(int x, int y, int hieght) {
    teleportToX = x;
    teleportToY = y;
    heightLevel = hieght;
    updateRequired = true;
    appearanceUpdateRequired = true;
    }
     

  4. #4  
    Registered Member

    Join Date
    Jan 2008
    Age
    28
    Posts
    1,380
    Thanks given
    76
    Thanks received
    384
    Rep Power
    962
    Very nice i like this rep+ i will use.
     

  5. #5  
    Registered Member

    Join Date
    Jan 2008
    Posts
    1,338
    Thanks given
    243
    Thanks received
    85
    Rep Power
    250
    pictures ? =)
    [Only registered and activated users can see links. ]
     

  6. #6  
    Ivo
    Ivo is offline
    Coding coding coding...

    Ivo's Avatar
    Join Date
    Mar 2008
    Age
    30
    Posts
    1,426
    Thanks given
    30
    Thanks received
    147
    Rep Power
    2017
    Quote Originally Posted by PasiipaZ View Post
    pictures ? =)
    pic how he thievs? mabe you wanna vid. too?

    nice job, used some things

    [Only registered and activated users can see links. ]
     

  7. #7  
    Registered Member Bonesdog's Avatar
    Join Date
    Nov 2006
    Age
    26
    Posts
    201
    Thanks given
    1
    Thanks received
    0
    Rep Power
    21
    To add stun you just make a stuntimer... like...
    you would add,

    public int stuntimer = 0;

    Search for if (actiontimer > 0)

    Should be like, actiontimer -=1;

    add,

    if (stuntimer > 0)
    {
    teleportToX = absX;
    teleporttoY = absY;
    stuntimer -=1;
    }

    then if you see what I mean you could get it...


    Well I had a perfect npc thieving, but I had to start all over and now its not working.

    gj
     

  8. #8  
    Registered Member
    Shamon King's Avatar
    Join Date
    Aug 2007
    Posts
    3,336
    Thanks given
    90
    Thanks received
    228
    Rep Power
    1363
    thank you bone dog
    and it works better in case 98
    updated also
     

  9. #9  
    Registered Member Bonesdog's Avatar
    Join Date
    Nov 2006
    Age
    26
    Posts
    201
    Thanks given
    1
    Thanks received
    0
    Rep Power
    21
    Shamon, theres one bug in it. (I made perfect thieving, sound, confusion, everything) You can click pickpocket again and it will disable you unable to walk...

    Also, it helps to add this to the walking junk. (Walking...)

    if (thiefstun > 0)
    {
    teleportToX = absX;
    teleportToY = absY;
    }

    Well im going to release mine in a bit... But gj still
     


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
  •