Jump to content
  • 0
Sign in to follow this  
chrischris567

ItemConstants Help

Question

So I'm making it required to have 200m agility experience to equip this item. I put the following code into ItemConstants.java:

[CODE]}else if (item.getId() == 29929) {
if (player.getSkills().getXPForLevel(16) < 199999999) {
player.getPackets().sendGameMessage("You need to have 200m total experience in agility to wear this cape.");
return false;
}[/CODE]

(16 is Agility's skill ID)

And I get no errors, but I can still wear it no matter what. Any ideas? Thanks.

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0
[quote name='chrischris567']So I'm making it required to have 200m agility experience to equip this item. I put the following code into ItemConstants.java:

[CODE]}else if (item.getId() == 29929) {
if (player.getSkills().getXPForLevel(16) < 199999999) {
player.getPackets().sendGameMessage("You need to have 200m total experience in agility to wear this cape.");
return false;
}[/CODE]

(16 is Agility's skill ID)

And I get no errors, but I can still wear it no matter what. Any ideas? Thanks.[/QUOTE]


il add you on skype. Edited by Danielxx

Share this post


Link to post
Share on other sites
  • 0
[quote name='chrischris567']

[CODE]
if ([COLOR="#FF0000"]player.getSkills().getXPForLevel(16) < 199999999[/COLOR]) {[/code]
[/QUOTE]

You do realise that line only gets the experience for that level, not for that skill, for example; If you were level 16 (In any skill), it will find the experience for level 16, not for the skill that has the id 16.

Share this post


Link to post
Share on other sites
  • 0
[quote name='Format']You do realise that line only gets the experience for that level, not for that skill, for example; If you were level 16 (In any skill), it will find the experience for level 16, not for the skill that has the id 16.[/QUOTE]

So I should change .getXPForLevel, to .getXP?

Share this post


Link to post
Share on other sites
  • 0
[quote name='chrischris567']So I should change .getXPForLevel, to .getXP?[/QUOTE]

Well, if that is the case, then I am assuming the getXP method returns the player's total amount of xp. I suggest searching through your skills class for a method or create one, that finds the total xp of a skill.

[code]

public int getXpForSkill(int id) {
switch (id) {
case 16:
return player.getAgilityXp();
default:
return 0;
}
}
[/code]

Don't take that piece of code literally, it is just an example.

Share this post


Link to post
Share on other sites
  • 0
[quote name='Format']Well, if that is the case, then I am assuming the getXP method returns the player's total amount of xp. I suggest searching through your skills class for a method or create one, that finds the total xp of a skill.

[code]

public int getXpForSkill(int id) {
switch (id) {
case 16:
return player.getAgilityXp();
default:
return 0;
}
}
[/code]

Don't take that piece of code literally, it is just an example.[/QUOTE]

I don't have a getAgilityXp() method. If I did, I wouldn't even have this problem. Lol.

I changed it to this:
[code]}else if (item.getId() == 29929) {
if (player.getSkills().getXp(Skills.AGILITY) <= 199999999) {
player.getPackets().sendGameMessage("You need to have 200m total experience in agility to wear this cape.");
return false;
}[/code]

And it still doesn't work. Edited by chrischris567

Share this post


Link to post
Share on other sites
  • 0
[quote name='chrischris567']I don't have a getAgilityXp() method. If I did, I wouldn't even have this problem. Lol.
[/QUOTE]
.........
[quote name='Format']
[COLOR="#FF0000"]Don't take that piece of code literally, it is just an example.[/COLOR][/QUOTE]

Share this post


Link to post
Share on other sites
  • 0
[quote name='Format'].........[/QUOTE]


I didn't take it literal, I was saying that what you told me can't help me in any way because I don't have that method.

Share this post


Link to post
Share on other sites
  • 0
[quote name='chrischris567']I didn't take it literal, I was saying that what you told me can't help me in any way because I don't have that method.[/QUOTE]

That is why I stated;

[quote name='Format'] I suggest [COLOR="#FF0000"]searching through your skills class for a method[/COLOR] or [COLOR="#FF0000"]create one[/COLOR], that finds the total xp of a skill.
[/QUOTE]

Share this post


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

×