Lava Titan
Developer
Hey guys, I'm nowhere close to understand how NPC syntax works so I'm trying to find a script for TFS 1.3 (8.6 downgrade by Nekiro) thats basicaly a NPC that sells items but not only for money, it can sell items in normal NPC trade window for different type of currencies, like event coins, task coins, normal gold, etc xD
Some items should require X level or X storage or both for the player to be able to buy them or just none at all, level and storage should be optional
idk if NPC's have configs like actions and other scripts, but this is how I would picture it if helps
Some items should require X level or X storage or both for the player to be able to buy them or just none at all, level and storage should be optional
idk if NPC's have configs like actions and other scripts, but this is how I would picture it if helps
Lua:
local config {
[itemId] = {requireStorage = 1, storage = 12345, requireLevel = 1, level = 200, currencyId = 2145, currencyAmount = 5},
[itemId] = {requireLevel = 1, level = 200, currencyId = 2151, currencyAmount = 5},
[itemId] = {requireStorage = 1, storage = 12345, gold = 10000},
[itemId] = {currencyId = 2145, currencyAmount = 5}
}
local item = Item(cid)
local player = Player(cid)
local shopItem = config[item:getId()]
if shopItem.requireStorage == 0 and shopItem.requireLevel == 0 then
npc:canSellItem(shopItem)
elseif shopItem.requireStorage == 1 and shopItem.requireLevel == 0 then
if player:getStorageValue(shopItem.storage) then
npc:canSellItem(shopItem)
else
npc:say("You don't have permission to buy this item.") -- in case player has enought currency to buy the item but doesnt have permission or level
end
elseif shopItem.requireStorage == 0 and shopItem.requireLevel == 1 then
if player:getLevel() == shopItem.level then
npc:canSellItem(shopItem)
else
npc:say("You need XXXX level to buy this item.") -- in case player has enought currency to buy the item but doesnt have permission or level
end
elseif shopItem.requireStorage == 1 and shopItem.requireLevel == 1 then
if player:getStorageValue(shopItem.storage) then
if player:getLevel() == shopItem.level then
npc:canSellItem(shopItem)
else
npc:say("You need XXXX level to buy this item.")
end
else
npc:say("You don't have permission to buy this item.") -- in case player has enought currency to buy the item but doesnt have permission or level
end
end