- Joined
- Jan 15, 2014
- Messages
- 1,317
- Solutions
- 35
- Reaction score
- 434
Hey Guys,
Is it possible to do something like this?
action script:
What I'm trying to ask is:
Is it possible to use Item(item.uid) in a creaturescript if I store the item's unique ID in the database through the action script and then call the same unique id in the creaturescript. So far it seem as though it's not possible (per my own tests), however maybe someone with more knowledge and experience knows better.
Thanks for your time and help.
p.s.
If I was unclear of what I'm trying to accomplish just please let me know and I'll try to clarify what my end goal is.
Is it possible to do something like this?
action script:
Code:
function onUse(player, item, fromPosition, itemEx, toPosition)
--> Run a DB Query to store the Item's Unique ID
db.query("UPDATE `players` SET `uniqueItem` = "..itemEx.uid.." WHERE `id` = "..player:getGuid()..";")
return true
end
Code:
function onLogin(player)
local item = 0
local result_plr = db.storeQuery("SELECT `uniqueItem` FROM `players` WHERE `id` = "..player:getGuid()..";")
if(result_plr ~= false) then
item = Item(result.getDataInt(result_plr, "uniqueItem"))
result.free(result_plr)
end
Item(item):getPosition():sendMagicEffect(CONST_ME_FIREWORK_RED)
end
What I'm trying to ask is:
Is it possible to use Item(item.uid) in a creaturescript if I store the item's unique ID in the database through the action script and then call the same unique id in the creaturescript. So far it seem as though it's not possible (per my own tests), however maybe someone with more knowledge and experience knows better.
Thanks for your time and help.
p.s.
If I was unclear of what I'm trying to accomplish just please let me know and I'll try to clarify what my end goal is.