Thread: Object Cases

Results 1 to 10 of 10
  1. #1 Object Cases 
    s0cc3r
    Guest
    TELEPORTING Object Cases

    Here is a basic object case.

    Code:
    case ####:
    teleportToX = XXXX;
    teleportToY = YYYY;
    heightLevel = #;
    updateRequired = true; 
    appearanceUpdateRequired = true;
    break;
    Ok first thing to do is change the case ####:
    Just change the #### to the object ID you want to teleport you somewhere.
    Now change the XXXX and YYYY to the teleport coords that you want the object to teleport you to.
    Now change the "#" next to heightLevel = to which height you want to be teleported to.
    Example "0" is main floor.
    -1 is underground so like falador mine caves.
    1 is above ground so like upstairs in varrock bank.

    Code:
    updateRequired = true;
    appearanceUpdateRequired = true;
    Just put this at the end of a case like this please it might mess up your character like walking running eating or something like that won't work.

    Code:
    break;
    At the end of a case like a } ends the code.

    There is different ways to do this like you can make it so only a admin or mod can use the object.
    Or if you teleblocked you can't use the object or you have to have a certain skill lvl to use the object.
    I'll be showing you some examples.

    Code:
    case #### Cant tel3
    if(teleblock) 
    {
    sendMessage("You are currently teleblocked!");
    }
    else if (!teleblock)
    {
    sendMessage("ENTER A MESSAGE TO THE USER HERE!");
    teleportToX = XXXX
    teleportToY = YYYY
    heightLevel = #
    updateRequired = true; 
    appearanceUpdateRequired = true;
    }
    break;
    And here is for admin or mod only.

    Code:
     case ####
        if(playerRights >= 2 {
        sendMessage("You use the admin only object.");
        teleportToX = XXXX
        teleportToY = YYYY
        heightLevel = #
    updateRequired = true; 
    appearanceUpdateRequired = true;
    break;
    And here is for having a certain skill lvl to use the object.

    Code:
     case 0000:
        if(playerLevel[1] >= 20) {
        sendMessage("You use the object.");
        teleportToX = 0000;
        teleportToY = 0000;
    heightLevel = #
    updateRequired = true; 
    appearanceUpdateRequired = true;
    break;
    [TRAINING Object Cases
    *NOTE* - This part assumes that you have already got the new objects that you want players to train on

    I will post an easy example and break it down just like I did with the teleporting objects.

    Code:
    case XXXXX:
    sendMessage("ENTER A MESSAGE TO THE USER HERE!");
    addSkillXP((XP*playerLevel[S]), S);
    updateRequired = true; 
    appearanceUpdateRequired = true;
    break;
    Ok this is just a very simple object case that would give you experience when you click on the object. Again, replace the XXXX with the object Id # that will be giving the Xp.

    You already know what
    Code:
    sendMessage
    does, so we'll skip over that.

    So you want to adjust the Xp rate you say? Well pay attention to this part then, there are a couple of ways you can do it so if you dont feel comfortable with one way, try this way.
    Code:
    addSkillXP((XP*playerLevel[S], S);
    Now this doesn't look like it yet, but after we explain it, i'll give you a finished example.

    First off,
    Code:
    addSkillXP
    tells the server to give the person clicking the object Xp in a certain spot.

    Here are two different examples with addSkillXP:
    Code:
    addSkillXP(500, 5);
    This one will always add 500 Xp to Skill #5. I don't use this one much.

    This next example I basically use all the time, because depending on the players level, it gives more Xp to higher levels. So therefore, once a high level, it wont be the same old slow training as when you were a lower level.
    Code:
    addSkillXP((XP*playerLevel[S], S);
    Inside the parenthesis where it says "XP" change that to a number that you will want multiplied by the players current level.

    Inside the parenthesis where is says
    Code:
    playerLevel[S]
    change the S to the skill # of the skill that will be trained. Also, change that last "S" to the same number.
    We don't need to explain any of the last part, because if you read, it was explained in the Teleporting case/object.

    Now for a more complex design of the Training Object:
    Code:
    case XXXXX:
    if(actionTimer == 0) {
    setAnimation(AAA);
    sendMessage("ENTER A MESSAGE TO THE USER HERE!");
    actionTimer = 80;
    addSkillXP((XP*playerLevel[S]), S);
    updateRequired = true; 
    appearanceUpdateRequired = true;
    }
    break;
    This looks a little different than the other one doesn't it? Well, it's actually not too much more complex. Here is how it works:

    Code:
    if(actionTimer == 0) {
    This means that if the players Timer has reached 0, then they will be able to click the object again.
    You can choose how long the timer will be by placing
    Code:
    actionTimer = XX;
    anywhere in the case AFTER
    Code:
    if(actionTimer == 0) {
    Just change the XX's to how long you want the timer to be. 80 seems to be a good amount of time. It stops massing for the most part.

    Now for the last thing that was left unexplained:
    Code:
    setAnimation(AAA)
    All this does is, when you click on the object, it will do a certain emote. Replace the AAA's with random numbers until you find an animation that you want. Or you could ask someone for a pre-made emote list.

    Now to make it so it add items to your inventory.
    Code:
    case XXXX:
    setAnimation(AAA);
    addItem(IIII, 1);
    break;
    This is just another simple case, but you can work out many other things with it from what you have learned above.

    This new part:
    Code:
    addItem(IIII, 1);
    is how you add items to someones inventory. Change the IIII's to the Item Id # that would go into the persons inventory. If you want to add more than one item you would make it look like this:

    Code:
    case XXXX:
    setAnimation(AAA);
    addItem(IIII, 1);
    addItem(IIII, 1);
    addItem(IIII, 1);
    addItem(IIII, 1);
    break;
    You can also add random items from your Item.java, Item2.java, or Item3.java. You would do this by replacing
    Code:
    addItem(IIII, 1);
    with
    Code:
    Item.randomitem()
    or
    Code:
    Item2.randomitem()
    Then you would go into either your Item.java or Item2.java and add:
    Code:
    public static int items[] = {XXXX,XXXX,XXXX};
        public static int randomitem()
        {
        	return item[(int)(Math.random()*items.length)];
        }
    Replace the XXXX's with the items that it will randomly give. You can add more by putting in a comma, then adding more item id #'s.

    If you would like to set a certain level that the person will need, you can make the case look like this:
    Code:
    case XXXX:
    if(playerLevel[S] >= L) {
    sendMessage("You teled to.....");
    teleportToX = xxxx;
    teleportToY = yyyy;
    heightLevel = 0;
    updateRequired = true; 
    appearanceUpdateRequired = true;
    } else {
    sendMessage("You need x skill to do this.");
    }
    break;
    What you need to do is change this:
    Code:
    if(playerLevel[S] >= L)
    Change the "S" to the skill that will be needed, and change the "L" to the Level thats needed

    This concludes your learning of Object Cases. If I should add anything else feel free to tell me, and I will update this thread. I hope you learned!
     

  2. #2  
    Shawn101
    Guest
    wow, i didn't know it was possible to exspalin so much on something so easy to do
     

  3. #3  
    s0cc3r
    Guest
    It is.
    For some people it's not easy lel.
     

  4. #4  
    Registered Member

    Join Date
    Aug 2007
    Posts
    545
    Thanks given
    6
    Thanks received
    0
    Rep Power
    196
    The newbies may like this ... Gj
     

  5. #5  
    s0cc3r
    Guest
    Thanks I made it for begginners / newbies
     

  6. #6  
    Tiger
    Guest
    Thank you for this guide. I was wondering about the need certain level.
     

  7. #7  
    rukia
    Guest
    theres a problemw ith this, one thing you didnt metnion is that every object with the saem id will do the same action so if u wanted oh i dunno just the stairs in varrock castle to go to mage arena all the stairs with the saem id would do the same thing, so you need to add the object coords in the tut
     

  8. #8  
    Ant
    Guest
    I already posted something basicly exactly like this....
     

  9. #9  
    RSSJ
    Guest
    ehhh, Useing cases insted of
    else if (ObjectID == ####) { //object name here
    teleportToX = ####;
    teleportToY = ####;
    sendMessage("message here");
    addItem(995, 100);
    deleteItem(995, getItemSlot(995), 100);
    pEmote = ####;
    stillgfx(####, absX, absY);
    }
    is EXTREAMLY nooby, because alot of objects have the SAME ids of cases that are in the interface, or already clamed cases elsewere In the server, so it will be extreamly glitchy, or not do anything at all..
    also you could add this in (ObjectID == ####), not sure if this works but (ObjectID == #### && #### ####) (second and third ####'s are x and y)
     

  10. #10  
    K Owned
    Guest
    cases are over rated..
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Object cases
    By Rapidz in forum Requests
    Replies: 1
    Last Post: 12-20-2009, 12:45 AM
  2. [508] ALL woodcutting cases for object option 1!!!
    By tinosk in forum Configuration
    Replies: 2
    Last Post: 09-05-2009, 01:11 AM
  3. Object Cases
    By K0ownage in forum Tutorials
    Replies: 0
    Last Post: 10-24-2008, 06:24 PM
  4. Explaining Object Cases
    By 0087adam in forum Tutorials
    Replies: 5
    Last Post: 02-27-2008, 02:08 AM
  5. Explaining Object cases
    By Eternal Darknes in forum Tutorials
    Replies: 4
    Last Post: 09-15-2007, 04:57 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •