codeing simple things

Discussion in 'RuneScape Miscellaneous' started by zanox96, Sep 17, 2008.

Thread Status:
Not open for further replies.
codeing simple things
  1. Unread #1 - Sep 17, 2008 at 6:54 PM
  2. zanox96
    Joined:
    Sep 15, 2008
    Posts:
    27
    Referrals:
    0
    Sythe Gold:
    0

    zanox96 Member

    codeing simple things

    _________________________________________________

    CODING SIMPLE THINGS

    _________________________________________________

    Purpose: To teach people how to code simple things

    Assumed Knowledge: Know wat client.java - autospawn.cfg and npchandler are.

    Difficulty: 3/10. (depends on your level of coding)

    Classes Modified: Client.java - autospawn.cfg and npchandler

    Heyy every 1 and welcome to my first ever tut

    today we will be covering the following:

    - How to add global objects
    - How to remove objects
    - How to make npcs
    - How to make npcs talk
    - How to make npcs move
    - Adding a simple command to tele you
    - Adding a simple command to give you a item
    - Adding a simple menu

    Ok lets get started:

    How to add global objects

    Firstly go to client.java and press ctrl + F. Now search for makeGlobalObject and go down until you reach the last one ( should be a long way down ) now when u reach the bottom add:


    CODE
    makeGlobalObject(X COORD, Y COORD, ID, 0, 10);// DESCRIPTION


    what this does is adds the item you want to add into your server - pretty easy

    ok so for the x coord you would put the x coord of the place u want the object added. for the y coord you would do the same thing. just add the y coord of the place u want to add this.

    Where it says id: this is the item id of the item you want to place at these coords. so say if i wanted a ladder i would put the item id to: 10

    Where it says description just simply add a little thing that the object is called such as ladder just for your own understanding of what the object is.

    FINAL CODE:

    ok so if you have followed what ive done you should have something similar to this:


    CODE
    makeGlobalObject(1000, 1000, 10, 0, 10);//ladder


    _________________________________________________

    How to remove global objects

    Ok firstly go to client.java and search for "deletethat" you will now see a whole list of things that look like this but with the coords set:


    CODE
    deletethatobject(X COORD, Y COORD); // DESCRIPTION


    OK so to delete the object just simply change the x coord to the x coord of the object and the y coord to the y coord of the object. then change the description to the name of the object you are deleteing for you own use to know what your deleting.

    What this does it deletes a item that are at the set coords.

    so the final code should be something similar to this:


    CODE
    deletethatobject(1500, 1500); // portal


    _________________________________________________

    How to make npcs

    well to add npcs you need to firstly go to autospawn.cfg. you should then see a ton of codes that look like this:


    CODE
    //---NpcID---CoordX---CoordY--Height--RangeX1-RangeY1-RangeX2-RangeY2-WalkType-Descrption
    spawn = 2026 3551 9694 0 0 0 0 0 2 Dharok


    Now go to the very bottom of them all and add this:


    CODE
    spawn = 0 0 0 0 0 0 0 0 0 description


    ok so to add a npc you need the id of it first. so get the id of it and then change the first 0 to the id.

    now we need to set the coords for the npc. so change the second 0 to the x coords and the third 0 to the y coords.

    now leave the 4th 0 as a zero unless ur adding the npc on the second floor or up. we will discuss all the other 0's later. But were it says description simply change that to the name of the npc for you to know what npc it is.

    what this does is it makes a npc of your choice at the coords you set. so your final result should be something like this:


    CODE
    //---NpcID---CoordX---CoordY--Height--RangeX1-RangeY1-RangeX2-RangeY2-WalkType-Descrption
    spawn = 2026 3551 9694 0 0 0 0 0 2 Dharok


    _________________________________________________

    How to make npcs talk

    Ok for this we need npchandler. so open that up and you should see a ton of text. Now search for


    CODE
    if (npcs.npcType ==


    and you should see a code similar to this one:


    CODE
    if (npcs.npcType == 2872) {
    if (misc.random2(30) <= 3) {
    npcs.updateRequired = true;
    npcs.textUpdateRequired = true;
    npcs.textUpdate = "Help me please! Im trapped!";
    }
    }


    Now copy this and paste it just below the last }

    ok this is what your npc is going to say. So to change what npc you want to say it you will get the bit were it says: "npcType == 2872) {" and change the 2872 to the id if your npc which you can get by right clicking the npc and ull see a little number like this one. after youve found the npc place it in.

    Now to change the text that it says. were it says:


    CODE
    npcs.textUpdate = "Help me please! Im trapped!";


    just change whats in between the brackets to the words of your choice. What this does is it makes it so when u log into the server abve your npc's head it will keep repeating what isin between those brackets.

    you final code shoudl look similiar to this one:


    CODE
    if (npcs.npcType == NPC ID HERE) {
    if (misc.random2(30) <= 3) {
    npcs.updateRequired = true;
    npcs.textUpdateRequired = true;
    npcs.textUpdate = "NPC TEXT HERE";
    }
    }


    _________________________________________________

    How to make npcs move

    well this is similar to making a npc. so we need to open up autospawn.cfg and search for the npc we wish to make walk. im going to use the npc we used above. so you should see something like this:


    CODE
    //---NpcID---CoordX---CoordY--Height--RangeX1-RangeY1-RangeX2-RangeY2-WalkType-Descrption
    spawn = 2026 3551 9694 0 0 0 0 0 2 Dharok


    Ok to make these npcs walk we need to get the coords. so firstly go to the TOP RIGHT of the place u want your npc to stop moving at. were it says rangex1 is were u put the top right x coord. now were it says rangey1 is were u put the top right y coord.

    so you should have this so far:


    CODE
    //---NpcID---CoordX---CoordY--Height--RangeX1-RangeY1-RangeX2-RangeY2-WalkType-Descrption
    spawn = 2026 3551 9694 0 1500 1500 0 0 2 Dharok


    ok so now we want the bottom left coords for range 2. so go to the bottom left of were u want ur npc to stop. so now get the x coord for the bottom left and place it for the zero at rangex2. now get the bottom left y coord and place it at rangey2. now set the very last 0 to a 2 and save it. compile your server and check to see if hes walking between those coords. you final result should be:


    CODE
    //---NpcID---CoordX---CoordY--Height--RangeX1-RangeY1-RangeX2-RangeY2-WalkType-Descrption
    spawn = 2026 3551 9694 0 1500 1500 1490 1490 2 Dharok


    _________________________________________________

    Adding a simple command to tele you

    Now open up client.java and search for


    CODE
    } else if (command.equalsIgnoreCase


    you should now see a code that looks something similar to this:


    CODE
    } else if (command.equalsIgnoreCase("westvarrock") && playerRights >= 0) {
    teleportToX = 3185;
    teleportToY = 3436;
    sendMessage("You go to varrock west bank");


    So just copy that code and below the code you searched for add that code. to change where it teles you just change the coords. so were it says "teleportToX = 3185;" change the 3185 to the x coords of the place u want to tele to. now were it says "teleportToY = 3436;" change the 3436 to the y coords of the place u want to.

    now to change the command. were it says west varrock change that to the command that u want to tele you. what this means is when u type ::westvarrock it will tele u to the coords you have set. but if you have change the west varrock when ur ingame you will need to type ::*your version* and you will be teled to the coords you set. so you should now have:


    CODE
    } else if (command.equalsIgnoreCase("westvarrock")


    if you want to set it so only a certain group can tele there for eg. only a admin can then add this to the end of it:


    CODE
    } else if (command.equalsIgnoreCase("westvarrock") && playerRights >= 2) {


    what this means is only admin and up can tele there.

    THE NUMBERS:
    0 = players
    1 = mods
    2 = admins
    3 = owners/co owners

    so you should now have


    CODE
    } else if (command.equalsIgnoreCase("westvarrock") && playerRights >= 0) {
    teleportToX = 3185;
    teleportToY = 3436;


    Well now if u want to send a message to the player when they tele add this


    CODE
    } else if (command.equalsIgnoreCase("westvarrock") && playerRights >= 0) {
    teleportToX = 3185;
    teleportToY = 3436;
    sendMessage("You go to varrock west bank");


    wwere it says "sendMessage("You go to varrock west bank");" change the you go to varrock bit to watever you want the message to say when they type in the command u set earlier.

    your final code should look like this:


    CODE
    } else if (command.equalsIgnoreCase("YOUR COMMAND") && playerRights >= YOUR PLAYER RIGHTS) {
    teleportToX = X COORD;
    teleportToY = Y COORD;
    sendMessage("MESSAGE HERE");


    _________________________________________________

    Adding a simple command to give you a item

    This is similar to the code above. open up client.java and search for


    CODE
    } else if (command.equalsIgnoreCase


    you should see a code similar to this one:


    CODE
    } else if (command.equalsIgnoreCase("ess")) && playerRights >= 1) {
    {addItem(1437, 1000);
    sendMessage("You get some ess");


    Copy this code and paste it under the one you searched. now to change what the command is. were it says ess just change that to what you want the command to be. by putting the command in there it means when u type in ::*command* you will receive the item(s) you choose

    changing the item. were it says {addItem(1437, 1000); just change the 1437 to the item id that u want to receive. and were it says 1000 change that to the amount of that item you want to receive.

    the same goes for the player rights as above. change the player rights to the group that u want to be able to use this command. you should now have:


    CODE
    } else if (command.equalsIgnoreCase("ess")) && playerRights >= 1) {
    {addItem(1437, 1000);
    sendMessage("You get some ess");


    to simply add more then 1 item just add more of these lines "addItem(1437, 1000);"

    so it should look like:


    CODE
    } else if (command.equalsIgnoreCase("ess")) && playerRights >= 1) {
    {addItem(1437, 1000);
    addItem(1437, 1000);
    sendMessage("You get some ess");


    What this does is make a command so when u type it you get a item that you have choosen.

    _________________________________________________

    Adding a simple menu

    Ok to add a menu firstly we need to open up client.java. now search for: "if(command.equalsIgnoreCase(" and you should see a bunch of these such as pickup or help or commands.

    just go underneath the first } you find and add this code in:

    CODE
    if(command.equalsIgnoreCase("COMMAND HERE") && (playerRights >= 0)) {
    String name = command.substring(5);
    sendQuest("@dre@TITLE GOES HERE", 8144); //Title
    clearQuestInterface();
    sendQuest("TITLE HERE ASWELL", 8146);
    sendQuest("", 8147);
    sendQuest("Text for menu", 8148);
    sendQuest("goes in all these brackets", 8149);
    sendQuest("like this", 8150);
    sendQuest("", 8151);
    sendQuest("", 8152);
    sendQuest("", 8153);
    sendQuest("", 8154);
    sendQuest("", 8155);
    sendQuest("", 8156);
    sendQuest("", 8157);
    sendQuest("", 8158);
    sendQuest("", 8159);
    sendQuest("", 8160);
    sendQuest("", 8161);
    sendQuest("", 8162);
    sendQuest("", 8163);
    sendQuest("", 8164);
    sendQuest("", 8165);
    sendQuest("feel free to remove this", 8166);
    sendQuest("to avoid leech i add this", 8167);
    sendQuest("made by legend 1234", 8168);
    sendQuestSomething(8143);
    showInterface(8134);
    flushOutStream();
    }


    ok so this is a blank menu for you to use. just copy that and add it were i said. Now to make the command for this menu. Were it says "if(command.equalsIgnoreCase("COMMAND HERE")" change the bit that says command here to the command you would like to use. so for example if mine said "if(command.equalsIgnoreCase("commands")" i would have to use ::commands in game to view this menu.

    now if you wnat this to be a admin only menu or a menu for every1 just change the bit that says: " && (playerRights >= 0)) { " and change that 0 to the member group of your choice:

    0= members
    1= mods
    2= admins
    3= owners

    Now for the menu title. find the bit that says


    CODE
    sendQuest("@dre@TITLE GOES HERE", 8144); //Title


    this is were the title of your menu will appear. so just edit the text to your name of the menu so when u type in the command for this menu what you wrote in the brackets will apear at the top if this. im sure you dont need an eg for this 1.

    Now to change whats in the menu. u will see a whole bunch of these lines:


    CODE
    sendQuest("TITLE HERE ASWELL", 8146);
    sendQuest("", 8147);
    sendQuest("Text for menu", 8148);
    sendQuest("goes in all these brackets", 8149);
    sendQuest("like this", 8150);


    whats these are is the individual lines of the menu. so were it says title here aswell "place your title there" but when u go into the menu that will be the first line of the menu. the second one were it has " sendQuest("", 8147); " is the second line and so on..

    to change what each line says just type what you want to in between these brackets. so for eg



    CODE
    sendQuest("COMMANDS", 8146);
    sendQuest("", 8147);
    sendQuest("here is the menu for commands", 8148);
    sendQuest("::pickup", 8149);
    sendQuest("::starter", 8150);
    sendQuest("and so on...", 8151);


    so after you have filled out your menu properly you should see a fully working menu when u type ::*YOU COMMAND*

    your final menu should like similar to this one:


    CODE
    if(command.equalsIgnoreCase("commands") && (playerRights >= 0)) {
    String name = command.substring(5);
    sendQuest("@dre@Darkscape commands", 8144); //Title
    clearQuestInterface();
    sendQuest("PLAYER COMMANDS FOR Darkscape", 8146);
    sendQuest("::updates to check latest updates", 8147);
    sendQuest("TRAINING COMMANDS AND NPC PLACES", 8148);
    sendQuest("::train", 8149);
    sendQuest("::rockcrabs", 8150);
    sendQuest("::kqueen", 8151);
    sendQuest("::dragons", 8152);
    sendQuest("::dungeon", 8153);
    sendQuest("TELE COMMANDS AND OTHER", 8154);
    sendQuest("PKING= ::1v1 - ::multi", 8155);
    sendQuest("::home", 8156);
    sendQuest("::bounty", 8157);
    sendQuest("::rc", 8158);
    sendQuest("::shops", 8159);
    sendQuest("::starter", 8160);
    sendQuest("::weed", 8161);
    sendQuest("::switch", 8162);
    sendQuest("::elementalhelp", 8163);
    sendQuest("::herb", 8164);
    sendQuest("::food", 8165);
    sendQuest("::mystats", 8166);
    sendQuest("::char", 8167);
    sendQuest("OTHER", 8168);
    sendQuestSomething(8143);
    showInterface(8134);
    flushOutStream();
    }


    NOTE: to add more lines for your menu just add more of these:

    CODE
    sendQuest("", 8168);

    and change the number at the very end to 1 number higher.so the next one would be: 8169 then 8170.

    _________________________________________________

    THANK YOU FOR READING
     
  3. Unread #2 - Sep 17, 2008 at 7:02 PM
  4. ~~Ayrtoo~~
    Joined:
    Mar 2, 2008
    Posts:
    36
    Referrals:
    0
    Sythe Gold:
    0

    ~~Ayrtoo~~ Member

    codeing simple things

    wow nice tut now im so much closer to finishing my server
    Thanks :)
     
  5. Unread #3 - Sep 17, 2008 at 7:06 PM
  6. zanox96
    Joined:
    Sep 15, 2008
    Posts:
    27
    Referrals:
    0
    Sythe Gold:
    0

    zanox96 Member

    codeing simple things

    your welcom love the (\__/)
    ( o_O )This is Bunny.
    ( > < )Copy Bunny into your signature to help him on his way to world domination.
    lol no ear
     
< not leached ge! | drop party commands! >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site