So I'm creating this simple quest script but I have run into a slight problem. I am trying to add items to be inside the bag when they use the chest but it only adds the first item in the list "8849".
(Current script gives reward regardless of storage, so feel free to test) -- this is done on purpose since I was trying to figure out why it isnt adding the way I want it to.
The error I get says theres a nil value, but I dont see it.
[Error]
If someone with more than half a brain can help us lesser beings out, that would be wonderful!
(Current script gives reward regardless of storage, so feel free to test) -- this is done on purpose since I was trying to figure out why it isnt adding the way I want it to.
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item:getActionId(2600) and player:getStorageValue(2600) == 2 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have already chosen your reward.")
elseif player:getStorageValue(2600) <= 2 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a green bag containing: a modified cross bow, a royal spear, a dragon shield and 1 crystal coin!")
player:addItem(1991, 1):addItem(8849, 1):addItem(7378, 1):addItem(2516, 1):addItem(2160, 1)
player:setStorageValue(2600, 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "Something went wrong.")
end
return true
end
The error I get says theres a nil value, but I dont see it.
[Error]
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/aragon/quests/reward room/act i/paladin.lua:onUse
...ions/scripts/aragon/quests/reward room/act i/paladin.lua:6: attempt to call m
ethod 'addItem' (a nil value)
stack traceback:
[C]: in function 'addItem'
...ions/scripts/aragon/quests/reward room/act i/paladin.lua:6: in functi
on <...ions/scripts/aragon/quests/reward room/act i/paladin.lua:1>
If someone with more than half a brain can help us lesser beings out, that would be wonderful!
Last edited: