Hello help me with this scripts, it does not work for me
Lua:
-- Memories
local shardIds = {36189, 36190, 36191}
local memoriesWords = {
"The Ambassador tells another dignitary: Rathleton must never be surpassed! I will procure that the Empire falters!",
"Through a dimensional gate you can see the Ambassador of Rathleton wearing a cloak with a black sphinx on it.",
"Through a dimensional gate you can see how the Ambassador of Rathleton is talking to Fafnar cultists in a quite familiar way. The proof is absolutely substantive. The Ambassador is a betrayer!"
}
local memoryShardsItemIdsBitmasks = {
[36189] = 1,
[36190] = 2,
[36191] = 4
}
local memoryShards = Action()
function memoryShards.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local memoryStorage = player:getStorageValue(Storage.Kilmaresh.Fifth.Memories)
local memoriesShardsStorage = player:getStorageValue(Storage.Kilmaresh.Fifth.MemoriesShards)
local hasUsedShard = testFlag(memoriesShardsStorage, memoryShardsItemIdsBitmasks[item:getId()])
if memoryStorage >= 1 and -- following the quest
not hasUsedShard and -- making sure we don't use the same shard twice
target.uid == 57507 -- is it the shrine?
then
player:say(memoriesWords[memoryStorage], TALKTYPE_MONSTER_SAY, false, player, toPosition)
player:setStorageValue(Storage.Kilmaresh.Fifth.Memories, memoryStorage + 1)
player:setStorageValue(Storage.Kilmaresh.Fifth.MemoriesShards, setFlag(memoriesShardsStorage, memoryShardsItemIdsBitmasks[item:getId()]))
toPosition:sendMagicEffect(CONST_ME_ENERGYAREA)
return true
end
return false
end
memoryShards:id(shardIds) -- Green, blue and purple memory shards
memoryShards:register()