Author Topic: [DELTA] Adding food & bones! (Useful if you've added customs ashes & rocktails)  (Read 84 times)

Offline The Unholy

  • Steel Member
  • *
  • Posts: 36
  • Rep 4
    • View Profile
Difficulty: 1/10
Files edited: Potions.Java
Credits: The Unholy

In this tutorial you will learn how to make items do things by simply clicking on them! (Provided they have a fourth option (Instead of the standard three: Use, Drop and Examine), such as 'Eat', 'Drink', 'Wear', 'Bury'.

This tutorial is based on two parts, Food and Bones.

FOOD

Search for:
Code: [Select]
case 385:
You should see the method for eating Shark (Case = ID. Shark ID = 385):
Code: [Select]
case 1891:
          if (System.currentTimeMillis() - c.foodDelay < 2000) //Delay between eating cakes (2 Game ticks)
  return;
  c.foodDelay = System.currentTimeMillis();
  c.setAnimation(0x33D); //Animation when consumed
  //c.playSound(317, 000, 020);
  c.sM("You eat the shark."); // Message sent when consumed
  if(c.currentHealth < c.playerLevel[c.playerHitpoints]){
  c.sM("It heals some health."); //If not at full HP, you'll get this message when consumed.
  }
  c.deleteItem(385, slot, 1); //Removes cake from your inventory
  if(c.currentHealth < c.playerLevel[c.playerHitpoints] + 16){
  c.currentHealth += 20; //Heals you by the set amount. (20 in this case).
  if (c.currentHealth > c.playerLevel[c.playerHitpoints])
  c.currentHealth = c.playerLevel[c.playerHitpoints];
  }
  c.sendQuest("" + c.currentHealth + "", 4016);
  break;

For example, if you'd like a player to be able to eat cakes, each piece healing 4).

Code: [Select]
if (System.currentTimeMillis() - c.foodDelay < 2000) //Delay between eating sharks (2 Game ticks)
return;
c.foodDelay = System.currentTimeMillis();
c.setAnimation(0x33D); //Animation when consumed
//c.playSound(317, 000, 020);
c.sM("You eat the shark."); // Message sent when consumed
if(c.currentHealth < c.playerLevel[c.playerHitpoints]){
c.sM("It heals some health."); //If not at full HP, you'll get this message when consumed.
}
c.deleteItem(1891, slot, 1); //Removes cake from your inventory
                                c.addItem(1893, slot, 1); //Adds cake 2/3
if(c.currentHealth < c.playerLevel[c.playerHitpoints] + 16){
c.currentHealth += 4; //Heals you by the set amount. (4 in this case).
if (c.currentHealth > c.playerLevel[c.playerHitpoints])
c.currentHealth = c.playerLevel[c.playerHitpoints];
}
c.sendQuest("" + c.currentHealth + "", 4016);
break;
For the 2/3 cake to go to a 1/3, change case 1891 to 1893. And addItem 1893 to 1895. For eating the slice, change case 1893 to 1895, and remove the addItem.

BONES

Search for:
Code: [Select]
Case 536:
You should see:
Code: [Select]
case 536:
  if (System.currentTimeMillis() - c.foodDelay < 2000) //Delay between burying (2 game ticks)
  return;
  c.foodDelay = System.currentTimeMillis();
  c.prayerMessage(72,536); // Gets the Item name and the Experience gain for the sM (message)
    break;

Let's say you wanted to add Dagannoth bones!
Code: [Select]
case 6729:
  if (System.currentTimeMillis() - c.foodDelay < 2000) //Delay between burying (2 game ticks)
  return;
  c.foodDelay = System.currentTimeMillis();
  c.prayerMessage(130,6729); // Gets the Item name and the Experience gain for the sM (message)
    break;

This will bury dagannoth bones and give you 130 prayer experience. NOTE: This will not affect using bones on an altar, that is Item on Object which is not covered here.

Save and compile, and enjoy your infernal ashes! And dare I say it, eating your tacos -.- :fp:
 




« Last Edit: March 29, 2011, 06:53:51 pm by The Unholy »

Share on Bluesky Share on Facebook


Offline AdotSells

  • Firecape Member
  • *
  • Posts: 300
  • Rep 4
    • View Profile
I like it (;  <3

Offline Holy

  • Adamant Member
  • *
  • Posts: 98
  • Rep 0
  • The Next Lionel Messi.
  • Location: Written in the stars,Million miles away...
    • View Profile
Pretty fast guide writing there mate :)
-Holy

Offline The Unholy

  • Steel Member
  • *
  • Posts: 36
  • Rep 4
    • View Profile
Mmm, not really, Considering the Code was C&Ped from my source, all I did was explain it and explain how to use it to add your own food/bone burying ^^

Offline Sajon

  • Rune Member
  • *
  • Posts: 166
  • Rep -1
  • Never Back down
  • Location: United Kingdom
    • View Profile
nice can you make one about adding items like d claws and chaotic

Offline The Unholy

  • Steel Member
  • *
  • Posts: 36
  • Rep 4
    • View Profile
They're custom items, done client sided via models and class8.java, I can show you have to give them bonuses, special attacks, etc, but that's it.

Offline Tampon Abuse

  • Dragon Member
  • *
  • Posts: 193
  • Rep 1
  • All vote for Rune-Kingdom!
  • Location: Oklahoma, Oklahoma City
    • View Profile
Goodjob, im sure some of the members of rune-k will find this particularly useful!

Everyone Vote For RUNE-KINGDOM at http://www.mmorpgtop200.com/in.php?site=6792