Author Topic: [Delta] 'Gambling' [Delta]  (Read 190 times)

Offline The Unholy

  • Steel Member
  • *
  • Posts: 36
  • Rep 4
    • View Profile
[Delta] 'Gambling' [Delta]
« on: March 09, 2011, 06:51:23 pm »
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.java

First open up client.java, and search for (or something similar to)

Code: [Select]
if ((objectID == 5960)
You should find something similar to

Code: [Select]
if ((objectID == 5960) && (objectX == 2539) && (objectY == 4712)) {
triggerTele(3090, 3956, 0);
}

Under that add

Code: [Select]
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.java

Open up client.java and search for

Code: [Select]
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

Code: [Select]
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.




Share on Bluesky Share on Facebook


Offline AdotSells

  • Firecape Member
  • *
  • Posts: 300
  • Rep 4
    • View Profile
Re: [Delta] 'Gambling' [Delta]
« Reply #1 on: March 09, 2011, 07:20:38 pm »
Nice :)  May try and convert to emulous :)

Offline Moe505

  • Veteran
  • Firecape Member
  • *
  • Posts: 293
  • Rep 187
  • Location: Australia
    • View Profile
Re: [Delta] 'Gambling' [Delta]
« Reply #2 on: March 09, 2011, 09:29:33 pm »
Nice :)  May try and convert to emulous :)
Do it yourself.
Eclipse will spoon Feed you...
@ Topic
Good job.

Offline AdotSells

  • Firecape Member
  • *
  • Posts: 300
  • Rep 4
    • View Profile
Re: [Delta] 'Gambling' [Delta]
« Reply #3 on: March 09, 2011, 10:41:49 pm »
Nice :)  May try and convert to emulous :)
Do it yourself.
Eclipse will spoon Feed you...
@ Topic
Good job.

Mate i didant ask him to convert for me?? :/   I meant
I may try and convert*

Offline The Unholy

  • Steel Member
  • *
  • Posts: 36
  • Rep 4
    • View Profile
Re: [Delta] 'Gambling' [Delta]
« Reply #4 on: March 10, 2011, 05:08:08 pm »
Hey, hey. Chill ^^

@ S E L L S, I'd like to see a method like this used on Emulous, much more stable than Delta. I just prefer Delta^^

@Moe, thanks a lot. Quite basic, simple and quick to add mind.

Offline Scar

  • Steel Member
  • *
  • Posts: 34
  • Rep 1
    • View Profile
Re: [Delta] 'Gambling' [Delta]
« Reply #5 on: March 11, 2011, 09:29:16 am »
Looks good, i might convert that into PI if i want to,  :tf:.
Code: [Select]
   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 if(playerHasItem(995, 0)) {
addItem(995, misct.random(1000000));
sM("You have been rewarded some money, use that."); // sends a message
} else {
sM("We have given you some you jerk, you can't afford then GTFO");
}
}
:hurr:

Offline robgob

  • Adamant Member
  • *
  • Posts: 120
  • Rep 5
  • I swarm like locust
  • Location: Michigan
    • View Profile
Re: [Delta] 'Gambling' [Delta]
« Reply #6 on: March 12, 2011, 04:08:41 pm »
 :uj: