Difficulty: 1/10
Files edited: Item.Java, Client.java
Credits: The Unholy
Explanation
This tutorial will help you understand how to add 'Gambling' into a Delta source by means of clicking chests (costing GP) to gain a random reward. Knowledge from this tutorial should also help you to understand basic uses of clicking an object to trigger an event such as sending a message (sM) or gaining skill experience (addSkillXP).
Client.javaFirst open up client.java, and search for (or something similar to)
if ((objectID == 5960)You should find something similar to
if ((objectID == 5960) && (objectX == 2539) && (objectY == 4712)) {
triggerTele(3090, 3956, 0);
}Under that add
if (objectID == 4121) { //object ID
if (playerHasItem(995, 50000)) { //50k GP needed or you can't gamble
addItem(Item.randomLowGamble(), 1); //Adds a random item from LowGamble (in item.java)
addItem(533, misc.random(8)); //Adds a random amount of big bones from 1-8
addItem(890, misc.random(15)); //Adds a random amount of adamant arrows from 1-15
deleteItem(995, 50000); //Removes 50k from your inventory
sM("You bet 50,000 coins and gain some random items"); //sends a message
} else {
sM("You do not have 50,000 coins to gamble with."); // sends a message
}
}What each line of code does is explained with '//' notes.
Item.javaOpen up client.java and search for
public static int shields[] = {You should find a long list of ID's.
Example: 1191,3096,3097,3098,3099,3100,3101, ending with '};'.
After the '};' indent the id's (push enter at the end of the code) and add
public static int LowGamble[] = {1, 2, 3, 4, 5};
}
public static int randomLowGamble()
{
return LowGamble[(int)(Math.random()*LowGamble.length)];
}
NOTE: If you already have methods such as public static int randomRUNES[] =, add LowGamble to the bottom.
Save and compile. Please note, if it's not obvious, you will have to add the chest yourself, using the makeGlobalObject method in client.java, easy stuff.