• 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!

Lua Vial Of Blood

promoots

New Member
Joined
Apr 13, 2014
Messages
1
Reaction score
0
Welcome. I have another problem vial of blood itd.

Added npc:

Sandra.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Sandra" script="data/npc/scripts/Sandra.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="140" head="115" body="95" legs="127" feet="76" addons="1"/>
<voices>
<voice text="Great spirit potions as well as health and mana potions in different sizes!" interval2="100" margin="1" yell="no"/>
<voice text="If you need alchemical fluids like slime and blood, get them here." interval2="120" margin="1" yell="no"/>
</voices>
<parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|, welcome to the fluid and potion shop of Edron."/>
        <parameter key="message_farewell" value="Good bye, |PLAYERNAME|, please come back soon."/>
        <parameter key="message_walkaway" value="Good bye, |PLAYERNAME|, please come back soon." />
        <parameter key="message_sendtrade" value="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}." />
</parameters>
</npc>

scripts/sandra.lua

Code:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if (not npcHandler:isFocused(cid)) then
        return false
    end

        if msgcontains(msg, 'vial') then
                npcHandler:say('We have a special offer right now for depositing vials. Are you interested in hearing it?', cid)
                talk_state = 1
      elseif msgcontains(msg, 'yes') and talk_state == 1 then
             npcHandler:say('Great! I\'ve signed you up for our bonus for lottery {ticket}. From now on, you will have the chance to win the potion belt addon!', cid)
             talk_state = 0
      elseif msgcontains(msg, 'ticket') then
             npcHandler:say('Would you like to get a lottery ticket instead of the {deposit} for your vials.', cid)
             talk_state = 1
      elseif msgcontains(msg, 'deposit') and talk_state == 1 then        
            if getPlayerItemCount(cid, 7636) >= 100 or getPlayerItemCount(cid, 7635) >= 100 or getPlayerItemCount(cid, 7634) >= 100 then
                    npcHandler:say('Here, take this lottery ticket and let\'s hope you got some luck', cid)
            if doPlayerRemoveItem(cid, 7636,100) or doPlayerRemoveItem(cid, 7635,100) or doPlayerRemoveItem(cid, 7634,100) then
                    doPlayerAddItem(cid, 5957, 1)
                    talk_state = 0
            else
                npcHandler:say('Sorry you need 100 empty vials to you from the lottery ticket', cid)
                talkState[talkUser] = 0
                end
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
            npcHandler:say('Ok thanks.', cid)
            talk_state = 0
        end
        return TRUE
end
end
-- Storage IDs --

fmage        = 22005  
smage        = 22006
fsummoner    = 22011
ssummoner    = 22012

newaddon    = 'Ah, right! The fluid belt! Here you go.'
noitems        = 'You do not have it!.'
noitems2    = 'You do not have all the required items.'
already        = 'It seems you already have this addon, don\'t you try to mock me!'


function MageFirst(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,fmage)
    if addon == -1 then
       if getPlayerItemCount(cid,5958) >= 1 then
        if doPlayerRemoveItem(cid,5958,1) then
            npcHandler:say('Ah, right! The mage fluid belt! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
            setPlayerStorageValue(cid,fmage,1)
            if getPlayerSex(cid) == 1 then
            doPlayerAddOutfit(cid, 133, 1)
            elseif getPlayerSex(cid) == 0 then
            doPlayerAddOutfit(cid, 138, 1)     
        end  
        end
        else
            selfSay(noitems)
        end
    else
        selfSay(already)
    end
    end

end

function SummonerFirst(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,fsummoner)
    if addon == -1 then
       if getPlayerItemCount(cid,5958) >= 1 then
        if doPlayerRemoveItem(cid,5958,1) then
            npcHandler:say('Ah, right! The summoner fluid belt! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
            setPlayerStorageValue(cid,fsummoner,1)
                if getPlayerSex(cid) == 1 then
            doPlayerAddOutfit(cid, 133, 1)
            elseif getPlayerSex(cid) == 0 then
            doPlayerAddOutfit(cid, 138, 1)     
        end  
        end
        else
            selfSay(noitems)
        end
    else
        selfSay(already)
    end
    end

end
-------------------------------------------------SHOP---------------------------------------------------------
shopModule:addBuyableItem({'health potion'}, 7618, 45, 1, 'health potion')
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
shopModule:addBuyableItem({'strong health'}, 7588, 100, 1, 'strong health potion')
shopModule:addBuyableItem({'vial of oil'}, 2006, 1, 11, 'vial of oil')
shopModule:addBuyableItem({'vial of blood'}, 2006, 1, 2, 'vial of blood')
shopModule:addBuyableItem({'vial of water'}, 2006, 1, 9, 'vial of water')
shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1, 'strong mana potion')
shopModule:addBuyableItem({'great health'}, 7591, 190, 1, 'great health potion')
shopModule:addBuyableItem({'great mana'}, 7590, 120, 1, 'great mana potion')
shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1, 'great spirit potion')
shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1, 'ultimate health potion')

shopModule:addSellableItem({'normal potion flask', 'normal flask'}, 7636, 5, 'empty small potion flask')
shopModule:addSellableItem({'strong potion flask', 'strong flask'}, 7634, 10, 'empty strong potion flask')
shopModule:addSellableItem({'great potion flask', 'great flask'}, 7635, 15, 'empty great potion flask')

--------



node1 = keywordHandler:addKeyword({'mage fluid belt'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get mage fluid belt you need give me the winning lottery ticket. Do you have it with you?'})
node1:addChildKeyword({'yes'}, MageFirst, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node4 = keywordHandler:addKeyword({'mage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get mage fluid belt you need give me the winning lottery ticket. Do you have it with you?'})
node4:addChildKeyword({'yes'}, MageFirst, {})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node2 = keywordHandler:addKeyword({'summoner fluid belt'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get summoner fluid belt you need give me the winning lottery ticket. Do you have it with you?'})
node2:addChildKeyword({'yes'}, SummonerFirst, {})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node3 = keywordHandler:addKeyword({'summoner'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get summoner fluid belt you need give me the winning lottery ticket. Do you have it with you?'})
node3:addChildKeyword({'yes'}, SummonerFirst, {})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

However, does not work

GwYR8pA.jpg


You can not buy blood, oil and water, error:

Lkj7Hbv.jpg


ID blood, oil and water : doc/liquids

Code:
[ LIQUIDS
    Project Name
        The Forgotten Server

    Version
        0.4.0_DEV

    Codenamed
        Crying Damson

    License
        GNU GPLv3

    Forum
        http://otland.net/
]

[ FLUIDTYPE        NAME            COLOR
    2    blood            RED
    10    lifefluid        RED
    26    lava            RED

    3    beer            BROWN
    11    oil            BROWN
    19    mud            BROWN
    27    rum            BROWN
    35    tea            BROWN
    43    mead            BROWN

    4    slime            GREEN
    28    swamp            GREEN

    5    lemonade        YELLOW
    13    urine            YELLOW
    21    fruit juice        YELLOW

    6    milk            WHITE
    14    coconut milk        WHITE

    7    manafluid        PURPLE
    15    wine            PURPLE

    1    water            BLUE
]
 
Last edited:
Code:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if (not npcHandler:isFocused(cid)) then
        return false
    end

        if msgcontains(msg, 'vial') then
                npcHandler:say('We have a special offer right now for depositing vials. Are you interested in hearing it?', cid)
                talk_state = 1
      elseif msgcontains(msg, 'yes') and talk_state == 1 then
             npcHandler:say('Great! I\'ve signed you up for our bonus for lottery {ticket}. From now on, you will have the chance to win the potion belt addon!', cid)
             talk_state = 0
      elseif msgcontains(msg, 'ticket') then
             npcHandler:say('Would you like to get a lottery ticket instead of the {deposit} for your vials.', cid)
             talk_state = 1
      elseif msgcontains(msg, 'deposit') and talk_state == 1 then        
            if getPlayerItemCount(cid, 7636) >= 100 or getPlayerItemCount(cid, 7635) >= 100 or getPlayerItemCount(cid, 7634) >= 100 then
                    npcHandler:say('Here, take this lottery ticket and let\'s hope you got some luck', cid)
            if doPlayerRemoveItem(cid, 7636,100) or doPlayerRemoveItem(cid, 7635,100) or doPlayerRemoveItem(cid, 7634,100) then
                    doPlayerAddItem(cid, 5957, 1)
                    talk_state = 0
            else
                npcHandler:say('Sorry you need 100 empty vials to you from the lottery ticket', cid)
                talkState[talkUser] = 0
                end
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
            npcHandler:say('Ok thanks.', cid)
            talk_state = 0
        end
        return TRUE
end
end
-- Storage IDs --

fmage        = 22005  
smage        = 22006
fsummoner    = 22011
ssummoner    = 22012

newaddon    = 'Ah, right! The fluid belt! Here you go.'
noitems        = 'You do not have it!.'
noitems2    = 'You do not have all the required items.'
already        = 'It seems you already have this addon, don\'t you try to mock me!'


function MageFirst(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,fmage)
    if addon == -1 then
       if getPlayerItemCount(cid,5958) >= 1 then
        if doPlayerRemoveItem(cid,5958,1) then
            npcHandler:say('Ah, right! The mage fluid belt! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
            setPlayerStorageValue(cid,fmage,1)
            if getPlayerSex(cid) == 1 then
            doPlayerAddOutfit(cid, 133, 1)
            elseif getPlayerSex(cid) == 0 then
            doPlayerAddOutfit(cid, 138, 1)    
        end  
        end
        else
            selfSay(noitems)
        end
    else
        selfSay(already)
    end
    end

end

function SummonerFirst(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,fsummoner)
    if addon == -1 then
       if getPlayerItemCount(cid,5958) >= 1 then
        if doPlayerRemoveItem(cid,5958,1) then
            npcHandler:say('Ah, right! The summoner fluid belt! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
            setPlayerStorageValue(cid,fsummoner,1)
                if getPlayerSex(cid) == 1 then
            doPlayerAddOutfit(cid, 133, 1)
            elseif getPlayerSex(cid) == 0 then
            doPlayerAddOutfit(cid, 138, 1)    
        end  
        end
        else
            selfSay(noitems)
        end
    else
        selfSay(already)
    end
    end

end
-------------------------------------------------SHOP---------------------------------------------------------
shopModule:addBuyableItem({'health potion'}, 7618, 45, 1, 'health potion')
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
shopModule:addBuyableItem({'strong health'}, 7588, 100, 1, 'strong health potion')
shopModule:addBuyableItem({'vial of oil'}, 2006, 15, 11, 'vial of oil')
shopModule:addBuyableItem({'vial of water'}, 2006, 15, 1, 'vial of water')
shopModule:addBuyableItem({'vial of blood'}, 2006, 15, 2, 'vial of blood')
shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1, 'strong mana potion')
shopModule:addBuyableItem({'great health'}, 7591, 190, 1, 'great health potion')
shopModule:addBuyableItem({'great mana'}, 7590, 120, 1, 'great mana potion')
shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1, 'great spirit potion')
shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1, 'ultimate health potion')

shopModule:addSellableItem({'normal potion flask', 'normal flask'}, 7636, 5, 'empty small potion flask')
shopModule:addSellableItem({'strong potion flask', 'strong flask'}, 7634, 10, 'empty strong potion flask')
shopModule:addSellableItem({'great potion flask', 'great flask'}, 7635, 15, 'empty great potion flask')

--------



node1 = keywordHandler:addKeyword({'mage fluid belt'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get mage fluid belt you need give me the winning lottery ticket. Do you have it with you?'})
node1:addChildKeyword({'yes'}, MageFirst, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node4 = keywordHandler:addKeyword({'mage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get mage fluid belt you need give me the winning lottery ticket. Do you have it with you?'})
node4:addChildKeyword({'yes'}, MageFirst, {})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node2 = keywordHandler:addKeyword({'summoner fluid belt'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get summoner fluid belt you need give me the winning lottery ticket. Do you have it with you?'})
node2:addChildKeyword({'yes'}, SummonerFirst, {})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

node3 = keywordHandler:addKeyword({'summoner'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get summoner fluid belt you need give me the winning lottery ticket. Do you have it with you?'})
node3:addChildKeyword({'yes'}, SummonerFirst, {})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Try that one, mine has a third parameter, 15.
 
Back
Top