S
Shadow_
Guest
Hello guys,
i was trying to know whats lagging my OT i found it that this script is doing lags and crashes :S
Lib file
and the lagging file is this one creaturescripts file :
can anybody help me in this ?
you may know how to stop this script to make lags so i tagged you @WibbenZ @Vulcan_
the script is working 100% but it crashes the ot 100% too
i was trying to know whats lagging my OT i found it that this script is doing lags and crashes :S
Lib file
LUA:
task_monsters = {
[1] = {name = "ogres", mons_list = {"ogre brute", "ogre savage"}, storage = 34234, amount = 3000, exp = 2325000000, pointsTask = {15, 15}, items = {{id = 11259, count = 1}, {id = 2160, count = 3}}},
[2] = {name = "crystal golem", mons_list = {"crystal golem", "Crystal Golem"}, storage = 55434, amount = 2500, exp = 1121250000, pointsTask = {12, 12}, items = {{id = 11259, count = 1}, {id = 2160, count = 5}}},
[3] = {name = "raging mage", mons_list = {"raging mage", "Raging Mage"}, storage = 41234, amount = 2250, exp = 867500000, pointsTask = {8, 8}, items = {{id = 11259, count = 1}, {id = 2160, count = 8}}},
[4] = {name = "metal gargoyle", mons_list = {"metal gargoyle", "Metal Gargoyle"}, storage = 43653, amount = 2750, exp = 667500000, pointsTask = {5, 5}, items = {{id = 11259, count = 1}, {id = 2160, count = 10}}}
}
task_daily = {
[1] = {name = "draptor", mons_list = {"draptor", "draptor"}, storage = 65346, amount = 150, exp = 30000000, pointsTask = {1, 1}, items = {{id = 2157, count = 1}, {id = 2160, count = 3}}},
[2] = {name = "kongra", mons_list = {"kongra", "kongra"}, storage = 21343, amount = 200, exp = 80000000, pointsTask = {2, 2}, items = {{id = 10521, count = 1}, {id = 2160, count = 5}}},
[3] = {name = "lizard chosen", mons_list = {"lizard chosen", "lizard chosen"}, storage = 52454, amount = 250, exp = 153750000, pointsTask = {3, 3}, items = {{id = 2195, count = 1}, {id = 2160, count = 8}}},
[4] = {name = "crystal golem", mons_list = {"crystal golem", "crystal golem"}, storage = 65234, amount = 300, exp = 373750000, pointsTask = {4, 4}, items = {{id = 2520, count = 1}, {id = 2160, count = 10}}},
[5] = {name = "ogres", mons_list = {"ogre brute", "ogre savage"}, storage = 12314, amount = 400, exp = 775000000, pointsTask = {5, 5}, items = {{id = 2520, count = 1}, {id = 2160, count = 10}}}
}
task_storage = 43070 -- storage que verifica se está fazendo alguma task e ver qual task é - task normal
task_points = 43071 -- storage que retorna a quantidade de pontos task que o player tem.
task_sto_time = 43072 -- storage de delay para não poder fazer a task novamente caso ela for abandonada.
task_time = 12 -- tempo em horas em que o player ficará sem fazer a task como punição
task_rank = 43073 -- storage do rank task
taskd_storage = 43074 -- storage que verifica se está fazendo alguma task e ver qual task é - task daily
time_daySto = 43075 -- storage do tempo da task daily, no caso para verificar e add 24 horas para fazer novamente a task daily
local ranks_task = {
[{1, 20}] = "Newbie",
[{21, 50}] = "Elite",
[{51, 100}] = "Master",
[{101, 200}] = "Destroyer",
[{201, math.huge}] = "Juggernaut"
}
local RankSequence = {
["Newbie"] = 1,
["Elite"] = 2,
["Master"] = 3,
["Destroyer"] = 4,
["Juggernaut"] = 5,
}
function rankIsEqualOrHigher(myRank, RankCheck)
local ret_1 = RankSequence[myRank]
local ret_2 = RankSequence[RankCheck]
return ret_1 >= ret_2
end
function getTaskInfos(player)
local player = Player(player)
return task_monsters[player:getStorageValue(task_storage)] or false
end
function getTaskDailyInfo(player)
local player = Player(player)
return task_daily[player:getStorageValue(taskd_storage)] or false
end
function taskPoints_get(player)
local player = Player(player)
if player:getStorageValue(task_points) == -1 then
return 0
end
return player:getStorageValue(task_points)
end
function taskPoints_add(player, count)
local player = Player(player)
return player:setStorageValue(task_points, taskPoints_get(player) + count)
end
function taskPoints_remove(player, count)
local player = Player(player)
return player:setStorageValue(task_points, taskPoints_get(player) - count)
end
function taskRank_get(player)
local player = Player(player)
if player:getStorageValue(task_rank) == -1 then
return 1
end
return player:getStorageValue(task_rank)
end
function taskRank_add(player, count)
local player = Player(player)
return player:setStorageValue(task_rank, taskRank_get(player) + count)
end
function getRankTask(player)
local pontos = taskRank_get(player)
local ret
for _, z in pairs(ranks_task) do
if pontos >= _[1] and pontos <= _[2] then
ret = z
end
end
return ret
end
function getItemsFromTable(itemtable)
local text = ""
for v = 1, #itemtable do
count, info = itemtable[v].count, ItemType(itemtable[v].id)
local ret = ", "
if v == 1 then
ret = ""
elseif v == #itemtable then
ret = " - "
end
text = text .. ret
text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
end
return text
end
and the lagging file is this one creaturescripts file :
LUA:
function onKill(player, target)
if target:isPlayer() or target:getMaster() then
return true
end
local mon_name = target:getName():lower()
local ret_t = getTaskInfos(player)
if ret_t then
if mon_name == ret_t.name or isInArray(ret_t.mons_list, mon_name) then
local sto_value = player:getStorageValue(ret_t.storage)
if sto_value < ret_t.amount then
sto_value = sto_value + 1
player:setStorageValue(ret_t.storage, sto_value)
if sto_value < ret_t.amount then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System] Killed ['..(sto_value)..'/'..ret_t.amount..'] '..mon_name..'.')
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System] Killed You finished your task.')
end
end
end
end
local ret_td = getTaskDailyInfo(player)
if ret_td then
if mon_name == ret_td.name or isInArray(ret_td.mons_list, mon_name) then
local sto_value = player:getStorageValue(ret_td.storage)
if sto_value < ret_td.amount then
sto_value = sto_value + 1
player:setStorageValue(ret_td.storage, sto_value)
if sto_value < ret_td.amount then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System Daily] Killed ['..(sto_value)..'/'..ret_td.amount..'] '..mon_name..'.')
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System Daily] Killed You finished your task.')
end
end
end
end
return true
end
you may know how to stop this script to make lags so i tagged you @WibbenZ @Vulcan_
the script is working 100% but it crashes the ot 100% too
Last edited by a moderator: