Wiec tak Zawartosc skrypta ( Byl Robiony pod 0.3.5pl1 ) chce zeby dzialal pod 0.3.6pl1
Oczywiscie wiem ze nie ma funkcji Itemup ale mam ja w fuctions
Error w consoli
Pomocne odpowiedzi Mile widziane 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
else
doTransformItem(item.uid, 1945)
end
local item1pos = getThingPos(56601 + ((item.actionid - 56600) * 2))
local item2pos = getThingPos(56602 + ((item.actionid - 56600) * 2))
local item1 = getThingfromPos({x=item1pos.x,y=item1pos.y,z=item1pos.z,stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
local item2 = getThingfromPos({x=item2pos.x,y=item2pos.y,z=item2pos.z,stackpos=STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
local cash = {}
local itemUp = {}
if item1.uid == (56601 + ((item.actionid - 56600) * 2)) or item2.uid == (56602 + ((item.actionid - 56600) * 2)) then
doSendMagicEffect(fromPosition, CONST_ME_POFF)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Poloz przedmiot do ulepszenia i crystal coin na stolach obok ciebie, a potem pociagnij za wajche.")
return TRUE
end
if item1.itemid ~= 2160 and item2.itemid ~= 2160 then
doSendMagicEffect(fromPosition, CONST_ME_POFF)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Poloz crystal coin na jednym z stolow obok ciebie, a potem pociagnij za wajche.")
return TRUE
elseif item1.itemid == 2160 then
cash = item1
itemUp = item2
elseif item2.itemid == 2160 then
cash = item2
itemUp = item1
end
local upgradable = 0
if getItemAttack(itemUp.uid) > 0 or getItemDefense(itemUp.uid) > 0 or getItemArmor(itemUp.uid) > 0 then
if getItemDefense(itemUp.uid) > 0 and item.actionid == 56600 then
upgradable = 1
elseif getItemDefense(itemUp.uid) > 0 and getItemAttack(itemUp.uid) > 0 and item.actionid == 56601 then
upgradable = 1
elseif getItemAttack(itemUp.uid) > 0 and (item.actionid == 56602 or item.actionid == 56603 or item.actionid == 56608) then
upgradable = 1
elseif getItemArmor(itemUp.uid) > 0 and (item.actionid == 56605 or item.actionid == 56606 or item.actionid == 56607) then
upgradable = 1
end
end
if upgradable ~= 1 then
doSendMagicEffect(fromPosition, CONST_ME_POFF)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Tego przedmiotu nie mozesz tu ulepszyc.")
return TRUE
end
doRemoveItem(cash.uid, 1)
local success = 0
local itemNormal = getThing(doCreateItemEx(itemUp.itemid))
if item.actionid == 56600 then
if math.random(0, 99) < 50 then
setItemDefense(itemUp.uid, getItemDefense(itemUp.uid)+1)
success = 1
else
setItemDefense(itemUp.uid, getItemDefense(itemNormal.uid))
end
elseif item.actionid == 56601 then
if math.random(0, 99) < 60 then
setItemExtraDefense(itemUp.uid, getItemExtraDefense(itemUp.uid)+1)
success = 1
else
setItemExtraDefense(itemUp.uid, getItemExtraDefense(itemNormal.uid))
end
elseif item.actionid == 56602 then
if math.random(0, 99) < 40 then
setItemAttack(itemUp.uid, getItemAttack(itemUp.uid)+1)
success = 1
else
setItemAttack(itemUp.uid, getItemAttack(itemNormal.uid))
end
elseif item.actionid == 56603 then
if math.random(0, 99) < 40 then
setItemExtraAttack(itemUp.uid, getItemExtraAttack(itemUp.uid)+1)
success = 1
else
setItemExtraAttack(itemUp.uid, getItemExtraAttack(itemNormal.uid))
end
elseif item.actionid == 56605 then
if math.random(0, 99) < 30 then
setItemArmor(itemUp.uid, getItemArmor(itemUp.uid)+1)
success = 1
else
setItemArmor(itemUp.uid, getItemArmor(itemNormal.uid))
end
elseif item.actionid == 56606 then
if math.random(0, 99) < 15 then
setItemHealthMaxPercent(itemUp.uid, getItemHealthMaxPercent(itemUp.uid)+1)
print(getItemHealthMaxPercent(itemUp.uid))
success = 1
else
setItemHealthMaxPercent(itemUp.uid, getItemHealthMaxPercent(itemNormal.uid))
end
elseif item.actionid == 56607 then
if math.random(0, 99) < 15 then
setItemManaMaxPercent(itemUp.uid, getItemManaMaxPercent(itemUp.uid)+1)
success = 1
else
setItemManaMaxPercent(itemUp.uid, getItemManaMaxPercent(itemNormal.uid))
end
elseif item.actionid == 56608 then
if (getItemAttackSpeed(itemUp.uid) == 0 and getItemAttack(itemUp.uid) > 0) then
setItemAttackSpeed(itemUp.uid, 1000-math.random(1,2)*10)
success = 1
elseif (getItemAttackSpeed(itemUp.uid) > 200 and getItemAttack(itemUp.uid) > 0 and math.random(0, 99) < 70) then
setItemAttackSpeed(itemUp.uid, getItemAttackSpeed(itemUp.uid)-math.random(1,3)*10)
success = 1
else
setItemAttackSpeed(itemUp.uid, 0)
end
end
if success == 1 then
doSendAnimatedText(fromPosition, ":]", TEXTCOLOR_LIGHTGREEN)
doSendMagicEffect(fromPosition, CONST_ME_YELLOW_RINGS)
actualizeItemName(itemUp.uid)
else
doSendAnimatedText(fromPosition, ":[", TEXTCOLOR_DARKRED)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Twoj przedmiot: " .. getItemNameById(itemUp.itemid))
return TRUE
end
Code:
function actualizeItemName(uid, returnname)
if uid > 0 then
local itemEx = getThing(doCreateItemEx(getThing(uid).itemid, getThing(uid).itemid))
local itemTXT = ''
local spearator = ''
if getItemArmor(uid) - getItemArmor(itemEx.uid) ~= 0 then
itemTXT = itemTXT .. spearator .. 'Arm: +'.. getItemArmor(uid) - getItemArmor(itemEx.uid)
spearator = ', '
end
if getItemAttack(uid) - getItemAttack(itemEx.uid) ~= 0 then
itemTXT = itemTXT .. spearator .. 'Atk: +'.. getItemAttack(uid) - getItemAttack(itemEx.uid)
spearator = ', '
end
if getItemExtraAttack(uid) - getItemExtraAttack(itemEx.uid) ~= 0 then
itemTXT = itemTXT .. spearator .. 'eAtk: +'.. getItemExtraAttack(uid) - getItemExtraAttack(itemEx.uid)
spearator = ', '
end
if getItemDefense(uid) - getItemDefense(itemEx.uid) ~= 0 then
itemTXT = itemTXT .. spearator .. 'Def: +'.. getItemDefense(uid) - getItemDefense(itemEx.uid)
spearator = ', '
end
if getItemExtraDefense(uid) - getItemExtraDefense(itemEx.uid) ~= 0 then
itemTXT = itemTXT .. spearator .. 'eDef: +'.. getItemExtraDefense(uid) - getItemExtraDefense(itemEx.uid)
spearator = ', '
end
if getItemAttackSpeed(uid) > 0 then
itemTXT = itemTXT .. spearator .. 'AtkT: -'.. (1000 - getItemAttackSpeed(uid)) / 10 .. '%'
spearator = ', '
end
if itemTXT ~= '' then
setItemName(uid, getItemNameById(itemEx.itemid) .. " [" .. itemTXT .. "] ")
return getItemNameById(itemEx.itemid) .. " [" .. itemTXT .. "] "
else
setItemName(uid, getItemNameById(itemEx.itemid))
return getItemNameById(itemEx.itemid)
end
end
return TRUE
end
Code:
[Error - Action Interface]
data/actions/scripts/quests/upgrader.lua:onUse
Description:
data/actions/scripts/quests/upgrader.lua:30: attempt to call global 'getItemAttack' (a nil value)
stack traceback:
data/actions/scripts/quests/upgrader.lua:30: in function <data/actions/scripts/quests/upgrader.lua:1>