Author Topic: Adding Hp Prayer and Run Orbs  (Read 288 times)

Offline xGenesis R

  • Iron Member
  • *
  • Posts: 25
  • Rep 0
    • View Profile
Adding Hp Prayer and Run Orbs
« on: April 05, 2011, 03:13:24 am »
Someone asked me to make a tutorial on this awhile back.

Okay so here is what we're adding.



Go into your Client.java folder (Client Sided of couse or this guide wouldn't be in this section) and look for.

Code: [Select]
private void method146()
Either above or below this method (I put mine below), add this file.

Code: [Select]
public void drawRunOrb() {
if (!runClicked) {
if (super.mouseX > 710 && super.mouseX < 742 && super.mouseY > 88 && super.mouseY < 122) {
hoverorbrun.drawSprite(165, 85);
} else {
runorb.drawSprite(165, 85);

}
} else {
if (super.mouseX > 710 && super.mouseX < 742 && super.mouseY > 88 && super.mouseY < 122) {
hoverorbrun2.drawSprite(165, 85);
} else {
runClick.drawSprite(165, 85);
}
}
}
  public void drawHPOrb() {
int health;
String cHP = RSInterface.interfaceCache[4016].message;
int currentHP = Integer.parseInt(cHP);
String mHP = RSInterface.interfaceCache[4017].message;
int maxHP2 = Integer.parseInt(mHP);
health = (int)(((double)currentHP / (double)maxHP2) * 100D);
/* Draws empty orb */
emptyOrb.drawSprite(160, 13);
hitPointsFill.drawSprite(163, 16);
/* Draws current HP text */
if(health > 100) {
smallText.method382(65280, 176, cHP, 34, true);
}
if(health <= 100 && health >= 75) {
smallText.method382(65280, 176, cHP, 34, true);
}
else if(health <= 74 && health >= 50) {
smallText.method382(0xffff00, 176, cHP, 34, true);
}
else if(health <= 49 && health >= 25) {
smallText.method382(0xfca607, 176, cHP, 34, true);
}
else if(health <= 24 && health >= 0) {
smallText.method382(0xf50d0d, 176, cHP, 34, true);
}
/* Draws inside orb sprites */
}
  public void loadOrbs(){
drawHPOrb();
drawPrayerOrb();
drawRunOrb();
}
  public void drawPrayerOrb() {
int prayer;

String cP = RSInterface.interfaceCache[4012].message;
int currentPrayer = Integer.parseInt(cP);
String mP = RSInterface.interfaceCache[4013].message;
int maxPrayer = Integer.parseInt(mP);
prayer = (int)(((double)currentPrayer / (double)maxPrayer) * 100D);
/* Draws empty orb */
emptyOrb.drawSprite(171, 49);
prayerFill.drawSprite(174, 52);
/* Draws current HP text */
if(prayer <= 100 && prayer >= 75) {
smallText.method382(65280, 187, cP, 71, true);
}
else if(prayer <= 74 && prayer >= 50) {
smallText.method382(0xffff00, 187, cP, 71, true);
}
else if(prayer <= 49 && prayer >= 25) {
smallText.method382(0xfca607, 187, cP, 71, true);
}
else if(prayer <= 24 && prayer >= 0) {
smallText.method382(0xf50d0d, 187, cP, 71, true);
}
/* Draws inside orb sprites */
}

Now dere that wasn't so hard. ;o

Okay, now for declaring things.

Look for
Code: [Select]
/* Declare custom sprites */
And under mapArea, add this

Code: [Select]
private Sprite emptyOrb;
private Sprite hoverOrb;
private Sprite hoverorbrun;
private Sprite hoverorbrun2;
private Sprite runClick;
private Sprite runorb;
private Sprite hitPointsFill;
private Sprite prayerFill;
  public boolean runClicked = false;

Under
Code: [Select]
/* Custom sprite unpacking */
Add this. :)

Code: [Select]
emptyOrb = new Sprite("emptyorb");
hoverOrb = new Sprite("hoverorb");
hoverorbrun2 = new Sprite("hoverorbrun2");
hoverorbrun = new Sprite("hoverorbrun");
runClick = new Sprite("runclick");
runorb = new Sprite("runorb");
hitPointsFill = new Sprite("hitpointsfill");
prayerFill = new Sprite("prayerfill");
Now go to
Code: [Select]
private void drawMinimap()
And ALLLLLllllllllllllllllllll the way in the bottom of that void there's something similar to this this.

Code: [Select]
if(destX != 0) {
int j2 = (destX * 4 + 2) - myPlayer.x / 32;
int l4 = (destY * 4 + 2) - myPlayer.y / 32;
markMinimap(mapFlag, j2, l4);
}
DrawingArea.drawPixels(3, 78, 97, 0xffffff, 3);
mapBack.drawBackground(0, 0);
aRSImageProducer_1165.initDrawingArea();
}

Below the

Code: [Select]
mapBack.drawBackground(0, 0);

Add
Code: [Select]
loadOrbs();
Compile save and add this to your Sprites in your cache.

UppIT - Free File Sharing - Orbs.rar

 (Don't place the whole Orb Folder there. But remove the photos and put them in the main Sprites Folder.)

Credits to xGenesis R & Phat 4 U

Here is the other orbs that I will release in the future:



If you used please thank <3
« Last Edit: April 05, 2011, 03:23:56 am by xGenesis R »

Share on Bluesky Share on Facebook


Offline Ferp

  • Dragon Member
  • *
  • Posts: 238
  • Rep 10001
  • Making the impossible, possible.
  • Location: Canada
    • View Profile
Re: Adding Hp Prayer and Run Orbs
« Reply #1 on: April 05, 2011, 03:15:27 am »
I didn't know you had any coding experience. Impressive.


Offline xGenesis R

  • Iron Member
  • *
  • Posts: 25
  • Rep 0
    • View Profile
Re: Adding Hp Prayer and Run Orbs
« Reply #2 on: April 05, 2011, 03:27:35 am »
I didn't know you had any coding experience. Impressive.

I'm a pretty good Java coder now, contrary to what most people on RM's forums think. I've been Coding since October and made it a permanent hobby.

Finally got to adding music in game on an Insanity 317/377 Client and Server which a lot of people never seem to be able to do or understand. (on other developer forums that is).

Offline Chandlermaki

  • Rune Member
  • *
  • Posts: 129
  • Rep 6
  • You's trollin'.
  • Location: USA
    • View Profile
Re: Adding Hp Prayer and Run Orbs
« Reply #3 on: April 05, 2011, 01:27:01 pm »
Finally got to adding music in game on an Insanity 317/377 Client and Server which a lot of people never seem to be able to do or understand. (on other developer forums that is).

Yeah, it's not even remotely hard. You just have to know the music IDs, and you're good to go.
Insert clever signature here.

Offline RawK

  • Bronze Member
  • *
  • Posts: 14
  • Rep 0
    • View Profile
Re: Adding Hp Prayer and Run Orbs
« Reply #4 on: April 09, 2011, 01:41:04 am »
Can you post a ingame image of it? I see 2 images and the bubbles look different on both


Unless i say it is my work it isnt <3

Offline Koolaid

  • GFX Designer
  • Firecape Member
  • *
  • Posts: 251
  • Rep 3
  • ι ℓσνє νιcтσяια!
  • Location: Denver Colorado
    • View Profile
Re: Adding Hp Prayer and Run Orbs
« Reply #5 on: April 09, 2011, 01:44:44 am »
Nelson is crazy good at coding now ; D