Hello rune-server and welcome to my first RSPS tutorial
Difficulty 1/10
Basic java knowledge.. is needed if not i recommend [Only registered and activated users can see links. ]
Firstly, go in to your npc class
and search for this
Code:
public void drop() {
and underneath this
Code:
Drop[] drops = NPCDrops.getDrops(id);
if (drops == null) {
return;
}
Player killer = getMostDamageReceivedSourcePlayer();
Add this
Code:
if (this.getId() == xxxxx) {
killer.PLAYER.JAVA VARIABLE HERE += xxxxx;
killer.BossRating += xxxxx;
killer.sm("You now have "+ killer.(YOUR VARIABLE THAT YOU CREATED INPLAYER.JAVA HERE +" YOUR POINTS NAME HERE");
killer.sm("You now have a boss killing rating of "+ killer.BossRating +" ");
}
And you can keep adding this little bit of code underneath each other for how many bosses you would like to give points for killing them to
AND ON THE XXXXX bits of code you need to change the if (this.getId() == 'xxxxxx') { to the id of the npc you would like to obtain points from for killing them, and so forth
dont close the npc.java class just yet because you will need to edit the your variable here parts
Open up your player.java class and these with your other variables they should be easy to locate just scroll down a little bit from all the imports and look for code indentical to these variables
Code:
public int BossRating = 0;
public int ArmadylPoints = 0;
public int BandosPoints = 0;
public int SaradominPoints = 0;
public int NexPoints = 0;
public int ZamorakPoints = 0;
save, and then back to your npc.java class
Code:
killer.PLAYER.JAVA VARIABLE HERE
Edit the player.java variable here part with this for example
killer.ArmadylPoints += 1;
and edit all the xxxxx's parts in the npc.java class code i gave to you on step one to the amount of points/boss rating score you want your player to recieve per kill
If you would like to add a shop for this here is a basic dialogue for spending the points edit however you want to what items you want for rewards/the amount of points needed ect.ect.
Place this folder in src/com/rs/game/player/dialogues Save as ArmadylPoint.java
Code:
package com.rs.game.player.dialogues;
public class ArmadylPoint extends Dialogue {
int npcId;
@Override
public void start() {
npcId = (Integer) parameters[0];
sendNPCDialogue(npcId, 9827, "Spend your Armadyl points here." );
}
@Override
public void run(int interfaceId, int componentId) {
if (stage == -1) {
stage = 0;
sendOptionsDialogue("Armadyl point shop",
"Armadyl Staff (200)",
"Armadyl Range set (350)",
"Armadyl Hilt(500)",
"Armadyl Rune armour set(150)",
"Oracle Of Balance(250)");
} else if (stage == 0) {
if (componentId == OPTION_1) {
if (player.ArmadylPoints >= 200) {
player.getInventory().addItem(21777, 1);
player.ArmadylPoints -= 200;
player.sm("you have "+player.ArmadylPoints +" Armadyl points left");
} else {
player.sm("you need 200 Armadylpoints to purchase this");
}
end();
} else if (componentId == OPTION_2) {
if (player.ArmadylPoints >= 350) {
player.getInventory().addItem(11718, 1);
player.getInventory().addItem(11720, 1);
player.getInventory().addItem(11722, 1);
player.getInventory().addItem(25010, 1);
player.getInventory().addItem(25013, 1);
player.getInventory().addItem(25016, 1);
player.ArmadylPoints -= 350;
player.sm("you have "+player.ArmadylPoints +" points left");
} else {
player.sm("you need 350 Armadyl points to buy this");
}
end();
} else if (componentId == OPTION_3) {
if (player.ArmadylPoints >= 500) {
player.getInventory().addItem(11702, 1);
player.ArmadylPoints -= 500;
player.sm("you have "+player.ArmadylPoints +" points left");
} else {
player.sm("you need 500 Armadyl points to buy this.");
}
end();
} else if (componentId == OPTION_4) {
if (player.ArmadylPoints >= 150) {
player.getInventory().addItem(19413, 1);
player.getInventory().addItem(19416, 1);
player.getInventory().addItem(19419, 1);
player.getInventory().addItem(19422, 1);
player.getInventory().addItem(19425, 1);
player.ArmadylPoints -= 150;
player.sm("you have "+player.ArmadylPoints +" points left");
} else {
player.sm("you need 150 ArmadylPoints to buy this");
}
end();
} else if (componentId == OPTION_5) {
if (player.ArmadylPoints >= 250) {
player.getAppearence().setTitle(475);
player.ArmadylPoints -= 250;
player.sm("you have "+player.ArmadylPoints +" points left");
} else {
player.sm("you need 250 Armadyl points to buy this");
}
end();
}
}
}
@Override
public void finish() {
}
}
Thanks for reading my snippet/tutorial and no hate please as this is my first one, and it is very basic but should hopefully be understandable for the noobies at java programming
If anyone has any problems post here, if that still doesnt help you then yet again i recommend..... [Only registered and activated users can see links. ]
[Only registered and activated users can see links. ]
Don't eat at mcdonalds kids...its genocide on a plate but they don't want you to know that.....
"Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.” ― Albert Einstein
This has been posted many times before but I guess this would be more of a tutorial, also you can shorten the length of all the ints by declaring them like
Code:
public int BossRating, ArmadylPoints, etc;
instead of
Code:
public int BossRating = 0;
public int ArmadylPoints = 0;
This has been posted many times before but I guess this would be more of a tutorial, also you can shorten the length of all the ints by declaring them like
Code:
public int BossRating, ArmadylPoints, etc;
instead of
Code:
public int BossRating = 0;
public int ArmadylPoints = 0;
No it actually hasn't been posted before? because this is what i use for my server....but yeah thanks for the suggestion
[Only registered and activated users can see links. ]
Don't eat at mcdonalds kids...its genocide on a plate but they don't want you to know that.....
Not much to it, but good snippet. Thanks for the contribution.
"Programs aren’t just built in one go, like a bridge. They are talked about,
sketched out, prototyped, played with, refactored, tuned, tested, tweaked,
deleted, rewritten....
A program is not built; it is grown.
Because a program is always growing and always changing, it must be written
with change in mind."
Not much to it, but good snippet. Thanks for the contribution.
Yep, There'll probably be more to come in the future, i'm sticking with my 718 base, so i'll learn alot of new stuff, and share it with the community, because whats the point in knowledge if you cant share it?
[Only registered and activated users can see links. ]
Don't eat at mcdonalds kids...its genocide on a plate but they don't want you to know that.....
Yep, There'll probably be more to come in the future, i'm sticking with my 718 base, so i'll learn alot of new stuff, and share it with the community, because whats the point in knowledge if you cant share it?
Knowledge is freedom
We are anonymous
We are legion
We do not forgive
We do not forget
Expect us
That's great.
Don't start with that anonymous bullshit.
"Programs aren’t just built in one go, like a bridge. They are talked about,
sketched out, prototyped, played with, refactored, tuned, tested, tweaked,
deleted, rewritten....
A program is not built; it is grown.
Because a program is always growing and always changing, it must be written
with change in mind."