foulla
Member
- Joined
- Jun 26, 2016
- Messages
- 78
- Solutions
- 1
- Reaction score
- 6
Hi otland
have 3 Erorr in creaturescripts TFS 0.4
1
2
3
have 3 Erorr in creaturescripts TFS 0.4
1
Code:
[Error - CreatureScript Interface]
[14:34:00.724] data/creaturescripts/scripts/killexp.lua:onKill
[14:34:00.724] Description:
[14:34:00.724] data/creaturescripts/scripts/killexp.lua:11: attempt to call global 'getDamageRatio' (a nil value)
[14:34:00.724] stack traceback:
[14:34:00.739] data/creaturescripts/scripts/killexp.lua:11: in function 'DamageRatio'
[14:34:00.739] data/creaturescripts/scripts/killexp.lua:25: in function <data/creaturescripts/scripts/killexp.lua:20>
Storage: 2, MaxhourKillss:200
killexp.lua
Lua:
function getPerc(cid,target)
local perc = math.abs(((getPlayerLevel(cid) - getPlayerLevel(target)) / 100000) * 3.5)
if perc < 1 then
perc = 1
elseif perc > 24 then
perc = 24
end
return perc
end
function DamageRatio(cid,target)
if getDamageRatio(target,cid) < 0.40 then
return 0.40
end
return getDamageRatio(target,cid)
end
function round(num, idp)
return tonumber(string.format("%." .. (idp or 0) .. "f", num))
end
-- 430
function onKill(cid,target)
local double = 1 -- keep it 1 for normal exp, 2 for double,3 for triple
if isPlayer(cid) and isPlayer(target) then
if getPlayerLevel(cid) > getPlayerLevel(target) then
local exap = math.floor((145 - ((3 * getPlayerLevel(cid))/95000)-((55*(getPlayerLevel(cid)- getPlayerLevel(target)))/95000))) * double
exap = exap * DamageRatio(cid,target)
if(exap > 0) then
if exap >= 100000 then
exap = 100000
end
if getDamageRatio(target,cid) == 1 then
exap = exap + math.floor(exap * 0.20)
if getPlayerStorageValue(cid, 6760) > 0 then
exap = exap + math.floor(exap * 0.20)
end
doSendAnimatedText(getThingPos(cid),"-SOLO-" , 180)
doSendMagicEffect(getThingPos(cid) ,5)
for i = 1,5 do
addEvent(doSendDistanceShoot,i * 100,getThingPos(cid), getThingPos(target), 3)
end
end
if getDamageRatio(target,cid) ~= 1 then
doSendAnimatedText(getThingPos(cid), ""..math.ceil(math.abs(getExperienceForLevel(getPlayerLevel(cid) / 500))).."", COLOR_WHITE)
end
doPlayerAddLevel(cid, exap)
end
elseif getPlayerLevel(cid) < getPlayerLevel(target) then
local exap2 = math.floor(getPerc(cid,target) * (DamageRatio(cid,target) * (145 - ((3*getPlayerLevel(cid))/65000)+((55*(getPlayerLevel(target)-getPlayerLevel(cid)))/65000))));
if(exap2 > 0) then
if exap2 >= 100000 then
exap2 = 100000
end
if getDamageRatio(target,cid) == 1 then
exap2 = exap2 + math.floor(exap2 * 0.20)
if getPlayerStorageValue(cid, 6760) > 0 then
exap2 = exap2 + math.floor(exap2 * 0.20)
end
doSendAnimatedText(getThingPos(cid),"-SOLO-" , 180)
doSendMagicEffect(getThingPos(cid) ,5)
for i = 1,5 do
addEvent(doSendDistanceShoot,i * 100,getThingPos(cid), getThingPos(target), 3)
end
end
if getDamageRatio(target,cid) ~= 1 then
doSendAnimatedText(getThingPos(cid), ""..math.ceil(math.abs(getExperienceForLevel(getPlayerLevel(cid) / 500))).."", COLOR_WHITE)
end
doPlayerAddLevel(cid, exap2)
end
end
end
return true
end
2
Code:
[14:47:23.759] [Error - CreatureScript Interface]
[14:47:23.759] data/creaturescripts/scripts/kills/kills.lua:onKill
[14:47:23.775] Description:
[14:47:23.775] data/creaturescripts/scripts/kills/kills.lua:20: attempt to call global 'getDamageRatio' (a nil value)
[14:47:23.790] stack traceback:
[14:47:23.790] data/creaturescripts/scripts/kills/kills.lua:20: in function <data/creaturescripts/scripts/kills/kills.lua:10>
kills.lua
Lua:
local config = {
levelDiff = 0.92,
kill = 47820,
solokill = 47821,
assist = 47822,
}
function onKill(cid, target, damage, flags)
local global_storage_top200 = getGlobalStorageValue(50100)
if tonumber(getPlayerStorageValue(cid, config.solokill)) == nil then
setPlayerStorageValue(cid, config.solokill, 0)
return true
end
if isPlayer(cid) and isPlayer(target) then
if ((getPlayerLevel(target) >= getPlayerLevel(cid) * tonumber(config.levelDiff)) and getPlayerLevel(cid) > tonumber(global_storage_top200)) then
local dmg = getDamageRatio(target,cid)
print("A")
if dmg > 0 then
if dmg >= 1.0 then
if(getPlayerStorageValue(cid, config.solokill) ~= -1) then
setPlayerStorageValue(cid,tonumber(config.solokill),tonumber(getPlayerStorageValue(cid,config.solokill))+1)
else
setPlayerStorageValue(cid, config.solokill, 1)
end
--[[ elseif dmg >= 0.34 then
if(getPlayerStorageValue(cid,config.kill) ~= -1) then
if type(tonumber(getPlayerStorageValue(cid,config.kill))) == "number" then
local file = io.open("data/scores/STORAGEBUG1.txt", "a")
file:write("|BEFORE| ".. getCreatureName(cid) .." | " .. getPlayerStorageValue(cid,config.kill) .."")
setPlayerStorageValue(cid, tonumber(config.kill) , tonumber(getPlayerStorageValue(cid,config.kill))+1)
file:write(" |AFTER| ".. getCreatureName(cid) .." | " .. getPlayerStorageValue(cid,config.kill) .." |\n")
file:close()
end
end
]]
elseif dmg >= 0.25 then
if(getPlayerStorageValue(cid, config.assist) ~= -1) then
setPlayerStorageValue(cid, tonumber(config.assist), tonumber(getPlayerStorageValue(cid, config.assist))+1)
else
setPlayerStorageValue(cid, config.assist, 1)
end
end
doSendMagicEffect(getThingPos(cid), 10)
end
end
end
return true
end
3
Code:
[14:47:23.790] [Error - CreatureScript Interface]
[14:47:23.806] data/creaturescripts/scripts/killstreak/killstreak.lua:onKill
[14:47:23.806] Description:
[14:47:23.806] ...ta/creaturescripts/scripts/killstreak/killstreak.lua:43: attempt to call global 'getDamageRatio' (a nil value)
[14:47:23.806] stack traceback:
[14:47:23.806] ...ta/creaturescripts/scripts/killstreak/killstreak.lua:43: in function <...ta/creaturescripts/scripts/killstreak/killstreak.lua:30>
Storage: 30, MaxhourKillss:200
killstreak.lua
Lua:
local config = {
levelDiff = 0.90,
storage_kill = 47920,
storage_more_exp = 47921,
streak_reached_reward = {
[5] = {itemid = 2157, count = 25, Exp = 11, shield = 3},
[10] = {itemid = 2157, count = 25, Exp = 12, shield = 2},
[15] = {itemid = 6527, count = 1, Exp = 13, shield = 7},
[20] = {itemid = 6527, count = 1, Exp = 14, shield = 5},
[25] = {itemid = 6527, count = 1, Exp = 15, shield = 5},
[30] = {itemid = 6527, count = 1, Exp = 16, shield = 4},
[35] = {itemid = 6527, count = 1, Exp = 17, shield = 4},
[40] = {itemid = 6527, count = 2, Exp = 18, shield = 8},
[45] = {itemid = 6527, count = 3, Exp = 19, shield = 8},
[50] = {itemid = 6508, count = 1, Exp = 20, shield = 6},
[60] = {itemid = 6506, count = 1, Exp = 21, shield = 6},
[70] = {itemid = 6506, count = 1, Exp = 22, shield = 6},
[80] = {itemid = 6506, count = 1, Exp = 23, shield = 6},
[90] = {itemid = 6506, count = 1, Exp = 24, shield = 6},
[100] = {itemid = 6506, count = 1, Exp = 25, shield = 6},
[200] = {itemid = 6506, count = 1, Exp = 25, shield = 6},
}
}
function onKill(cid, target, damage, flags)
local global_storage_top100 = getGlobalStorageValue(50513)
if (isPlayer(cid) and isPlayer(target)) then
if isInArea(getThingPos(cid),{x=2371,y=831,z=7},{x=2388,y=838,z=7}) then
return true
end
local levelcid = getPlayerLevel(cid)
local leveltar = getPlayerLevel(target)
if (getPlayerLevel(cid) >= global_storage_top100 and (leveltar > config.levelDiff*levelcid)) then
if (getDamageRatio(target,cid) > 0.3) then
local killstreak = getPlayerStorageValue(cid,config.storage_kill)
if type(killstreak) == "number" then
setPlayerStorageValue(cid,config.storage_kill,killstreak+1)
doPlayerSendTextMessage(cid,20,"KILLSTREAK[".. killstreak+1 .."]")
if config.streak_reached_reward[killstreak+1] ~= nil then
doPlayerSendTextMessage(cid,20,"You reached ".. killstreak+1 .." kills in a row and gained ".. config.streak_reached_reward[killstreak+1].count .."X ".. getItemNameById(config.streak_reached_reward[killstreak+1].itemid) .."!\nYour PVP exp bonus also got boosted to: ".. ((config.streak_reached_reward[killstreak+1].Exp - 10)/10) * 100 .."% faster.")
doSendMagicEffect(getThingPos(cid),10)
doBroadcastMessage("[".. getCreatureName(cid) .."] has reached ".. killstreak+1 .." kills in a row! Kill him for bonus experience and reward!")
doPlayerAddItem(cid, config.streak_reached_reward[killstreak+1].itemid, config.streak_reached_reward[killstreak+1].count)
setPlayerStorageValue(cid,config.storage_more_exp,config.streak_reached_reward[killstreak+1].Exp)
doCreatureSetPartyShield(cid,config.streak_reached_reward[killstreak+1].shield)
end
end
end
end
end
return true
end