Lineage 2 Tower Forum

Full Version: IsSkillAvailable() and CanBeUsed() question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need help with these features:

I understand that CanBeUsed() I check if I can use the skill on the target me, or monster

I understand that IsSkillAvailable() verify that "this" skill is available within my skills

Now my question is whether CanBeUsed() includes internally verify if the skill is available or necessary to use both functions to be sure?


What would be the best verification? or when required to do these checks?

CASE:1

Code:
if (Skill:IsSkillAvailable()) and (Skill:CanBeUsed()) then
UseSkillRaw(id,false,false)


CASE:2

Code:
if (Skill:CanBeUsed()) then
UseSkillRaw(id,false,false)
(08-17-2014 03:20 AM)rORUMI Wrote: [ -> ]I need help with these features:

I understand that CanBeUsed() I check if I can use the skill on the target me, or monster

I understand that IsSkillAvailable() verify that "this" skill is available within my skills

Now my question is whether CanBeUsed() includes internally verify if the skill is available or necessary to use both functions to be sure?


What would be the best verification? or when required to do these checks?

CASE:1

Code:
if (Skill:IsSkillAvailable()) and (Skill:CanBeUsed()) then
UseSkillRaw(id,false,false)


CASE:2

Code:
if (Skill:CanBeUsed()) then
UseSkillRaw(id,false,false)
if that will easy get erro ! Try this and change id + name

    LUA Programming
ShowToClient("Won","Skill ON");
----------------------------------------------------------------------------------CONFIG
SkillNameId = 1234 -- skill id set here
SkillName = GetSkills():FindById(SkillNameId); -- Find Skill By ID
 
----------------------------------------------------------------------------------
repeat
 
if (GetTarget() ~= nil) then
 if (GetTarget():IsMonster() == true) and (GetTarget():IsAlikeDeath() == false) 
 and (GetMe():IsAlikeDeath() == false) then
-------------------------------------------------------------------------Skills
 if (SkillName ~= nil) and (SkillName:CanBeUsed()) then
  Sleep(800);
 UseSkillRaw(SkillNameId,false,false);
 -- don't set id here look upside
 Sleep(1200);
 end;
 
 end;
end;
Sleep(1000);
until false;



+2 if helpful and next time use search frist Smile
avaiable is when skill is rdy to go no delay.

canbeuse is if something like debuff prevent you to cast.

so better use both, btw now 131 is out suggest to get it
(08-17-2014 05:16 AM)13dk13 Wrote: [ -> ]avaiable is when skill is rdy to go no delay.

canbeuse is if something like debuff prevent you to cast.

so better use both, btw now 131 is out suggest to get it

Thanks
I will check now the new version.131
CanBeUsed checks also IsSkillAvailable.
Also it checks for stuns, mp, hp, ...
You don't need to use both
(08-17-2014 09:30 AM)ClockMan Wrote: [ -> ]CanBeUsed checks also IsSkillAvailable.
Also it checks for stuns, mp, hp, ...

Ty ClockMan!
Reference URL's