Jump to content

Question

Posted

Hi, 
I came up with a concept which allows the cooldown reset of a certain skill when someone kills a player in pvp.
Here is what I tried so far but it doesn't seem to do anything at all:
 



//Reset skill cooldown on pvp 
for (Skill skill : getAllSkills())
{
   if (skill.getId() == 821) //Currently Shadow Step 
   {
	enableSkill(skill);
   }
}

P.S I added it inside IncreasePvpKills() method in L2PcInstance class.
Any suggestions to make it functional?
Thank you.

9 answers to this question

Recommended Posts

  • 0
Posted (edited)
if (getSkill(821) != null)

You can add this check but anyway, you will enable all skills. :P Also you have to send SkillCoolTime packet, to update the icon.

sendPacket(new SkillCoolTime(this));
Edited by SweeTs
  • 0
Posted

Oh yes forgot about the packet , thanks for the info :)
Is there a way to reset cd on a specific skill instead of reseting everything?
By the way there is not any getSkill() method on L2PcInstance or L2Character so I won't be able to use this check :P 

  • 0
Posted

SweeTs probably meant getKnownSkill(821) != null, besides i don't see why your enableSkill(skill) would enable every skill.

  • 0
Posted

Nevermind fixed it :D
Here is the code if someone wants it :
 

//Reset skill cooldown on pvp 
Skill skill = SkillData.getInstance().getSkill(821, 1); //Currently Shadow Step			
			
if (skill != null)  
{
	enableSkill(skill);				
	sendPacket(new SkillCoolTime(this));
}		

Simple and works like a charm for l2jserver high five.

  • 0
Posted

You don't really need the SkillData

//Reset skill cooldown on pvp 
Skill skill = getKnownSkill(821); //Currently Shadow Step			
			
if (skill != null)  
{
    enableSkill(skill);				
    sendPacket(new SkillCoolTime(this));
}		
  • 0
Posted

Oh yes that works too and it also seems like a more flexible way since it enables all levels of the skill in contrary to SkillData  which requires its lvl too.
Thanks for that man!

  • 0
Posted

getKnownSkill verify player's skills, while SkillData is simply the skill template. So SkillData approach is plain wrong, you would send a refresh packet no matter the player class.

 

Versus' approach is the only one.

Guest
This topic is now closed to further replies.


×
×
  • Create New...