Lineage 2 Tower Forum

Full Version: una ayudita por favor con esta script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
    LUA Programming
ShowToClient("SYS","Script OOP Heal Melody Started");
CharNameToHeal = ""; --here write name of your Main to be heal
HPWhenHeal = 70; -- HP%
HealInRange = 750;
HealSkillId = 11755; -- Radiant Heal
ResSkillId = 11784; -- Blessed Resurrection
----------------------------------------------------------------
WhoToHeal = nil;
HealSkill = GetSkills():FindById(HealSkillId);
ResSkill = GetSkills():FindById(ResSkillId);
repeat
-----------
if(GetUserByName(CharNameToHeal) == nil)then
ShowToClient("SYS","Your main char is out of range, w8ing on him");
repeat
Sleep(1000);
until (GetUserByName(CharNameToHeal) ~= nil);
ShowToClient("SYS","Your main char is in range");
WhoToHeal = GetUserByName(CharNameToHeal);
elseif(GetUserByName(CharNameToHeal) ~= nil)then
WhoToHeal = GetUserByName(CharNameToHeal);
end;
----------
if(WhoToHeal:GetHpPercent() < HPWhenHeal) and
(GetMe():GetRangeTo(WhoToHeal) < HealInRange) and
(HealSkill ~= nil) and (HealSkill:CanBeUsed())then
Target(WhoToHeal);
Sleep(200);
UseSkill(HealSkillId); -- Healing Melody
ClearTargets();
end;
--------------
if(GetUserByName(CharNameToHeal):IsAlikeDeath() == true) and
(GetMe():GetRangeTo(WhoToHeal) < HealInRange) and
(ResSkill ~= nil) and
(ResSkill:CanBeUsed()) then
Target(WhoToHeal);
Sleep(300);
UseSkillRaw(11784, false, false); -- Angel's Resurrection
end;
Sleep(500);
until false;




se para a cada rato, colocando este mensaje:
script error: Lua error (script no valid) - [string "show toclient (sys", "script OOP Heal Melody st.."]:33: attemp to index a nill value.

agradesco la ayuda.
Hay varios factores que pueden hacerte colgar el script ya que no tiene verificaciones en caso de errores.

Ahora simplemente te equivocaste en el nombre del personaje (lo cual lo hace nil) en la configuracion del Script y/o estas forzando cada medio segundo GetUserByName(CharNameToHeal) lo cual puede dar error con el tiempo.
gracias compadre
Reference URL's