darkmu
Well-Known Member
Could someone help me with this solution?
Currently when I pick up the item it comes with only one charge, I would like to change it in a way that comes 1500 loads or the load I define.
Using OTG 1.3 Version Premium, 12.40
Error:
Currently when I pick up the item it comes with only one charge, I would like to change it in a way that comes 1500 loads or the load I define.
Using OTG 1.3 Version Premium, 12.40
Lua:
local mounts = {
[1] = {name = "1500x Veteran Exercise Bow", ID = 39582},
[2] = {name = "1500x Veteran Exercise Rod", ID = 39583},
[3] = {name = "1500x Veteran Exercise Wand", ID = 39584},
[4] = {name = "1500x Veteran Exercise Sword", ID = 39585},
[5] = {name = "1500x Veteran Exercise Axe", ID = 39586},
[6] = {name = "1500x Veteran Exercise Club", ID = 39587}
}
function onModalWindow(player, modalWindowId, buttonId, choiceId)
player:unregisterEvent("modalExercise")
if modalWindowId == 1001 then
if buttonId == 100 then
if player:getItemCount(39999) == 0 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "")
return false
end
if choiceId == 0 then
return false
end
local pot = player:addItem(mounts[choiceId].ID)
local charge = 1500
setItemName(pot, getItemNameById(mounts[choiceId].ID)..' x'..charge)
player:removeItem(39999, 1)
player:getPosition():sendMagicEffect(CONST_ME_GREENSMOKE)
end
end
end
Error:
XML:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/modalExercise.lua:onModalWindow
data/creaturescripts/scripts/modalExercise.lua:29: attempt to call global 'getItemNameById' (a nil value)
stack traceback:
[C]: in function 'getItemNameById'
data/creaturescripts/scripts/modalExercise.lua:29: in function <data/creaturescripts/scripts/modalExercise.lua:10>