Cloow
Active Member
- Joined
- May 10, 2010
- Messages
- 1,086
- Reaction score
- 35
Hello, I am once again asking for your Lua scripting support
I'm trying to figure out whats wrong with this script for the HoTa instruments part and im using TFS 1.3 Nekiro downgrade 8.6.
You need to use the musical instruments in a certain order to get access through the door and if you use an instrument in wrong order it will reset and you receive damage.
The Ancient Tombs Quest, Vashresamun - TibiaWiki
The script loads fine with no errors, and I got no errors while calling its functions either.
This part seems to work fine:
Heres the part that I suspect smth wrong:
especially this, if I have storage "config[item.itemid]" and "config[item.itemid]" < 4 ?? I don't know how this is even supposed to work but somehow I need to call the storage values for each itemid and thats what im stuck on and can't figure out how.
As you can see in this gif it's like the script just jumps over the part I mentioned above
I'm trying to figure out whats wrong with this script for the HoTa instruments part and im using TFS 1.3 Nekiro downgrade 8.6.
You need to use the musical instruments in a certain order to get access through the door and if you use an instrument in wrong order it will reset and you receive damage.
The Ancient Tombs Quest, Vashresamun - TibiaWiki
The script loads fine with no errors, and I got no errors while calling its functions either.
Lua:
local config = {
[2367] = 1,
[2373] = 2,
[2370] = 3,
[2372] = 4,
[2369] = 5,
[1241] = 5
}
local storage = 12109
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local targetTable = config[item.itemid]
if not targetTable then
player:setStorageValue(storage, 0)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You played them wrong, now you must begin with first again!')
doTargetCombat(0, player, COMBAT_PHYSICALDAMAGE, -20, -500, CONST_ME_GROUNDSHAKER)
return true
end
if player:getStorageValue(storage) == targetTable and targetTable < 4 then
player:setStorageValue(storage, math.max(1, player:getStorageValue(storage)) + 1)
fromPosition:sendMagicEffect(CONST_ME_SOUND_BLUE)
else
player:setStorageValue(storage, 5)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You played them in correct order and got the access through door!')
end
if item.itemid == 1241 and player:getStorageValue(storage) == 5 then
player:teleportTo(toPosition, true)
item:transform(item.itemid + 1)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You first must play the instruments in correct order to get the access!")
end
return true
end
This part seems to work fine:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local targetTable = config[item.itemid]
if not targetTable then
player:setStorageValue(storage, 0)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You played them wrong, now you must begin with first again!')
doTargetCombat(0, player, COMBAT_PHYSICALDAMAGE, -20, -500, CONST_ME_GROUNDSHAKER)
return true
end
Heres the part that I suspect smth wrong:
Lua:
if player:getStorageValue(storage) == targetTable and targetTable < 4 then
player:setStorageValue(storage, math.max(1, player:getStorageValue(storage)) + 1)
fromPosition:sendMagicEffect(CONST_ME_SOUND_BLUE)
else
player:setStorageValue(storage, 5)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You played them in correct order and got the access through door!')
end
especially this, if I have storage "config[item.itemid]" and "config[item.itemid]" < 4 ?? I don't know how this is even supposed to work but somehow I need to call the storage values for each itemid and thats what im stuck on and can't figure out how.
Lua:
if player:getStorageValue(storage) == targetTable and targetTable < 4 then
As you can see in this gif it's like the script just jumps over the part I mentioned above
Last edited: