• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ potions with subid

Moody

Member
Joined
Feb 8, 2020
Messages
60
Reaction score
5
i use tfs 1.3 downgrade this one
can't buy potions with blood slim oil milk or anything
npc xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="potion" script="potion.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100" />
    <look type="140" head="115" body="95" legs="125" feet="57" addons="1" />
    <parameters>
        <parameter key="module_shop" value="1" />
        <parameter key="shop_buyable" value="

            empty potion flask,7636,20;
            empty potion flask,7635,30;
            vial of blood,2006,15,2;
            great health potion,7591,190;
            great mana potion,7590,120;
            great spirit potion,8472,190;
            health potion,7618,45;
            mana potion,7620,50;
            vial of oil,2006,20,11;
            vial of slime,2006,12,4;
            strong health potion,7588,100;
            strong mana potion,7589,80;
            ultimate health potion,8473,310;
            vial of urine,2006,10,13;
            vial of water,2006,8,1;" />
        <parameter key="shop_sellable" value="
            empty potion flask,7634,5;
            empty potion flask,7635,5;
            empty potion flask,7636,5;
            vial,2006,5;" />
    </parameters>
</npc>
npc lua
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)        npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()        npcHandler:onThink()        end

local voices = {
    { text = 'Great spirit potions as well as health and mana potions in different sizes!' },
    { text = 'If you need alchemical fluids like slime and blood, get them here.' }
}

npcHandler:addModule(VoiceModule:new(voices))

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if isInArray({"vial", "ticket", "bonus", "deposit"}, msg) then
        if player:getStorageValue(Storage.OutfitQuest.MageSummoner.AddonBelt) < 1 then
            npcHandler:say("You have "..player:getStorageValue(38412).." credits. We have a special offer right now for depositing vials. Are you interested in hearing it?", cid)
            npcHandler.topic[cid] = 1
        elseif player:getStorageValue(Storage.OutfitQuest.MageSummoner.AddonBelt) >= 1 then
            npcHandler:say("Would you like to get a lottery ticket instead of the deposit for your vials?", cid)
            npcHandler.topic[cid] = 3
        end
    elseif msgcontains(msg, "prize") then
        npcHandler:say("Are you here to claim a prize?", cid)
        npcHandler.topic[cid] = 4
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say({
                "The Edron academy has introduced a bonus system. Each time you deposit 100 vials without claiming the money for it, you will receive a lottery ticket. ...",
                "Some of these lottery tickets will grant you a special potion belt accessory, if you bring the ticket to me. ...",
                "If you join the bonus system now, I will ask you each time you are bringing back 100 or more vials to me whether you claim your deposit or rather want a lottery ticket. ...",
                "Of course, you can leave or join the bonus system at any time by just asking me for the 'bonus'. ...",
                "Would you like to join the bonus system now?"
            }, cid)
            npcHandler.topic[cid] = 2
        elseif npcHandler.topic[cid] == 2 then
            npcHandler:say("Great! I've signed you up for our bonus system. From now on, you will have the chance to win the potion belt addon!", cid)
            player:setStorageValue(Storage.OutfitQuest.MageSummoner.AddonBelt, 1)
            player:setStorageValue(Storage.OutfitQuest.DefaultStart, 1) --this for default start of Outfit and Addon Quests
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 3 then
            if player:getStorageValue(38412) >= 100 or player:removeItem(7634, 100) or player:removeItem(7635, 100) or player:removeItem(7636, 100) then
                npcHandler:say("Alright, thank you very much! Here is your lottery ticket, good luck. Would you like to deposit more vials that way?", cid)
                player:setStorageValue(38412, player:getStorageValue(38412)-100);
                player:addItem(5957, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Sorry, but you don't have 100 empty flasks or vials of the SAME kind and thus don't qualify for the lottery. Would you like to deposit the vials you have as usual and receive 5 gold per vial?", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 4 then
            if player:getStorageValue(Storage.OutfitQuest.MageSummoner.AddonBelt) == 1 and player:removeItem(5958, 1) then
                npcHandler:say("Congratulations! Here, from now on you can wear our lovely potion belt as accessory.", cid)
                player:setStorageValue(Storage.OutfitQuest.MageSummoner.AddonBelt, 2)
                player:addOutfitAddon(138, 1)
                player:addOutfitAddon(133, 1)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
            else
                npcHandler:say("Sorry, but you don't have your lottery ticket with you.", cid)
            end
            npcHandler.topic[cid] = 0
        end
        return true
    end
end

keywordHandler:addKeyword({'shop'}, StdModule.say, {npcHandler = npcHandler, text = 'I sell potions and fluids. If you\'d like to see my offers, ask me for a {trade}.'})

npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|, welcome to the fluid and potion {shop} of Edron.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye, |PLAYERNAME|, please come back soon.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye, |PLAYERNAME|, please come back soon.")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Of course, just browse through my wares. By the way, if you'd like to join our bonus system for depositing flasks and vial, you have to tell me about that {deposit}.")

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
npc modules
 
its source bug or script bug? anyone help

anyone can try helping?

i think 2 solved here but idon't know how

Well the server ran fine before I tried using custom dat/spr/items.otb. It could be the items.otb causing it or something. I know what the usual things to check are, that's why I am here because its something unusual at-least to me. The spr/dat file may not effect the server but the items.otb could but there is no error and I know its the correct items.otb version. So pretty much im looking for things to check, not things that it probably isnt.

bump

still need help, i tested in 10.98 forgotten official and it working but in the downgrade by nekiro it doesn't work
vial.jpg
its empty vial in list and empty when buying it too
i think its source problem cuz it worked with forgotten 10.98 with no edits to same npc script
Post automatically merged:

i got screenshot from here
but this is same look of trade and all like in my server
 
Back
Top