Jump to content
  • 0
Sign in to follow this  
Max Skarz

[667/711] How To Add Skill Requirements To Item on Item

Question

Was wondering how u add skill requirements on item on item.
[CODE]else if (itemUsed.getId() == 8947 && usedWith.getId() == 1511){
player.getInventory().deleteItem(1511, 1);
player.getInventory().addItem(960, 1);
player.getSkills().addXp(22, 10);
}
else if (itemUsed.getId() == 8947 && usedWith.getId() == 1521){
player.getInventory().deleteItem(1521, 1);
player.getInventory().addItem(8778, 1);
player.getSkills().getLevelForXp(22,15)
player.getSkills().addXp(22, 20);
}
else if (itemUsed.getId() == 8947 && usedWith.getId() == 6333){
player.getInventory().deleteItem(6333, 1);
player.getInventory().addItem(8780, 1);
player.getSkills().getLevelForXp(22,30)
player.getSkills().addXp(22, 30);
}
[/CODE]

Was wondering how u will add skill rquirements to the coding above

like u need 15 construction to make Planks and 25 to make oak planks.

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
[CODE]if (player.getSkills().getLevel(Skills.SKILLINCAPS) < Randomnumber) {

}[/CODE]

replace skillincaps with say CONSTRUCTION or DUNGEONEERING etc, replace Randomnumber with the skill level required for your instant it will be < 15) {

'<' means less than so you will do

[CODE]if (player.getSkills().getLevel(Skills.CONSTRUCTION) < 15) {
player.sm("You don't have the required level to do this.");
} else {
player.getInventory().deleteItem(1511, 1);
player.getInventory().addItem(960, 1);
player.getSkills().addXp(22, 10);
}[/CODE]

so something like this

[CODE]else if (itemUsed.getId() == 8947 && usedWith.getId() == 1521){
if (player.getSkills().getLevel(Skills.CONSTRUCTION) < 15) {
player.sm("You don't have the required level to do this.");
} else {
player.getInventory().deleteItem(1521, 1);
player.getInventory().addItem(8778, 1);
player.getSkills().getLevelForXp(22,15)
player.getSkills().addXp(22, 20);
}}[/CODE]

it can be done cleaner i just cbfed atm :D Edited by shadow fita

Share this post


Link to post
Share on other sites
Sign in to follow this  

×