Extrodus
|| Blazera.net ||
So I have a weird issue with this script I am creating that gives a random reward to the player. I am trying to make it send a text message to the player with a statement letting them know what item they have received.
In one line it states the proper item id, but when I try to get the item's name with that ID; it returns the item ID of the random reward chest itself "11401" or "Tibiora's Box" - this is a sample of what it looks like when using the item in game.
14:39 You have found Tibiora's box
14:39 You have found 9019 <-- which is a soul stone, not tibioras box.
So what I see from the problem, its getting the itemID of the item I am "using" in game, not the rewards name.. which doesnt make sense if the ID it is grabbing is 9019.
This is the script itself.
Thanks to anyones eyes that spot the problem.
In one line it states the proper item id, but when I try to get the item's name with that ID; it returns the item ID of the random reward chest itself "11401" or "Tibiora's Box" - this is a sample of what it looks like when using the item in game.
14:39 You have found Tibiora's box
14:39 You have found 9019 <-- which is a soul stone, not tibioras box.
So what I see from the problem, its getting the itemID of the item I am "using" in game, not the rewards name.. which doesnt make sense if the ID it is grabbing is 9019.
This is the script itself.
Code:
local rewards = {
{ item = 9019, count = 1 },
{ item = 5809, count = 1 },
{ item = 8982, count = 1 }
}
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
local random = math.random(1, #rewards)
player:addItem(rewards[random].item, rewards[random].count)
player:sendTextMessage(36, 'You have found '.. item:getName(rewards[random].item) ..'')
player:sendTextMessage(36, 'You have found '.. rewards[random].item ..'')
return true
end
Thanks to anyones eyes that spot the problem.