Lineage 2 Tower Forum

Full Version: Нужен скрипт на выращивание мобов на ферме
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Не могу понять, что с этим скриптом не так, но он даже не запускается. Я в этих делах новичек, но хотелось бы понять.
Code:
SCONFIG = L2TConfig.GetConfig();
SCONFIG_FILE = GetDir() .. '\\scripts\\cdr.l2b';
L2TConfig.SaveConfig(SCONFIG_FILE);

babylist = {18873,18880,18887,18894};
younglist = {18874,18875,18881,18882,18888,18889,18895,18896};
adultlist = {18876,18877,18883,18884,18890,18891,18897,18898};
bl = true;

stage = 2; -- 0: not feed, 1: feed til young, 2:feed til adult, 3: feed til full grown

displayinfo = false; -- false: dont show info to client, true: show info to client

function getItemByName(name)
invList = GetInventory();
for item in invList.list do
if item.Name == name then
return item.displayId;
end;
end;
end;

function useAvailableFood()
cs = 15474;
gs = 15475;

if(cs ~= nil) then
UseItem(cs);

else UseItem(gs);
end;
end;

function isFoodAvailable()
cs = 15474;
gs = 15475;

if ( cs == nil and gs == nil) then
return false;
end;

return true;
end;

function feed(stage)

local bb = GetTarget():GetNpcId();
local wb = 2000; -- тут пауза между кормлениями одного пета, я просто хз сколько нужно ждать до того, как корм можно использовать еще раз

if(stage >= 1) then
for k,w in pairs(babylist) do
if GetTarget():GetNpcId() == w then
if(displayinfo) then ShowToClient(">>>Info", "Feeding " .. GetTarget():GetName()); end;

repeat
useAvailableFood();
Sleep(wb);
until bb ~= GetTarget():GetNpcId();

return;
end;
end;
end;

if(stage >= 2) then
for k,w in pairs(younglist) do
if GetTarget():GetNpcId() == w then
if(displayinfo) then ShowToClient(">>>Info", "Feeding " .. GetTarget():GetName()); end;
repeat
useAvailableFood();
Sleep(wb);
until bb ~= GetTarget():GetNpcId();
return;
end;
end;
end;

if(stage == 3) then
for k,w in pairs(adultlist) do
if GetTarget():GetNpcId() == w then
if(displayinfo) then ShowToClient(">>>Info", "Feeding " .. GetTarget():GetName()); end;
repeat
useAvailableFood();
Sleep(wb);
until bb ~= GetTarget():GetNpcId();
return;
end;
end;
end;
end;


while bl do
Sleep(2000);

if ( not isFoodAvailable()) then
ShowToClient(">>>Info", "Food is over");
bl = false;
end

if(GetTarget() ~= nil) then
feed(stage);
end;
end;
L2TConfig.LoadConfig(SCONFIG_FILE);

Заранее спасибо.
Reference URL's