• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Sandra -- ReaL Tibia

FabianoBN

l|¬¬"|l
Joined
Jan 23, 2009
Messages
745
Reaction score
22
Location
Goias - Brazil
I'm here to put an NPC that many who have the Global Map Server and does not move much with the script for the NPC trading Sandra Vial for Ticket through that one ticket can ganahr winning ticket system.

Version: 8.54 TFS 0.3.6

So here we go:
data/npc/ Create a file. xml with the name Sandra.
And put it:
PHP:
<?xml version="1.0"?>
<npc name="Sandra" script="data/npc/scripts/sandra.lua" walkinterval="2000">
  <health now="200" max="200" />
<look type="137" head="115" body="120" legs="121" feet="19" addons="0"/>
  <parameters>
    <parameter key="message_greet" value="Hello |PLAYERNAME|" />
    
    <parameter key="shop_buyable" value="great spirit potion,8472,120;great mana potion,7590,120;great health potion,7591,190;strong health potion,7588,100;strong mana potion,7589,80;health potion,7618,45;mana potion,7620,50;ultimate health potion,8473,310" />
    <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>

Now in data/npc/scripts/ put it:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
-- OTServ event handling functions end

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('Congratulations! Here, from now on you can wear our lovely potion belt as accessory.', 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
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Talk to NPC:
Code:
hi
vial
yes
ticket
deposit

Credits:
To Me!!
And Frankfarmer the base of the vial npc!!

That's it. Sorry my english ^^.

Please Rep++ :p
 

Attachments

Last edited:
I'm here to put an NPC that many who have the Global Map Server and does not move much with the script for the NPC trading Sandra Vial for Ticket through that one ticket can ganahr winning ticket system.

Version: 8.54 TFS 0.3.6

So here we go:
data/npc/ Create a file. xml with the name Sandra.
And put it:
PHP:
<?xml version="1.0"?>
<npc name="Sandra" script="data/npc/scripts/sandra.lua" walkinterval="2000">
  <health now="200" max="200" />
<look type="137" head="115" body="120" legs="121" feet="19" addons="0"/>
  <parameters>
    <parameter key="message_greet" value="Hello |PLAYERNAME|" />
    
    <parameter key="shop_buyable" value="great spirit potion,8472,120;great mana potion,7590,120;great health potion,7591,190;strong health potion,7588,100;strong mana potion,7589,80;health potion,7618,45;mana potion,7620,50;ultimate health potion,8473,310" />
    <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>

Now in data/npc/scripts/ put it:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
-- OTServ event handling functions end

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) >= 1 then
                    npcHandler:say('Congratulations! Here, from now on you can wear our lovely potion belt as accessory.', cid)
                    doPlayerRemoveItem(cid, 7636,1)
                    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

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

Talk to NPC:
Code:
hi
vial
yes
ticket
deposit

Credits:
To Me!!
And Frankfarmer the base of the vial npc!!

That's it. Sorry my english ^^.

What exactly does it do? I see no "taking" the 5 bp of vials XD and giving a ticket
 
Soon here friend:

PHP:
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('Congratulations! Here, from now on you can wear our lovely potion belt as accessory.', 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
 
sandra addons

works perfect gratzz.

would have to include the addons like these
PHP:
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


-- Storage IDs --

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

newaddon    = 'Ah, right! The barbarian axe! Here you go.'
noitems        = 'You do not have all the required items.'
noitems2    = 'You do not have all the required items or you do not have the outfit, which by the way, is a requirement for this addon.'
already        = 'It seems you already have this addon, don\'t you try to mock me son!'
nomale        = 'It seems you are female isnt there you get that part of this addon!'
nofemale      = 'It seems you are male isnt there you get that part of this addon!'

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 getPlayerSex(cid) == 1 then
	   selfSay(nofemale)
	   elseif getPlayerSex(cid) == 0 then
       if getPlayerItemCount(cid,5903) >= 1 then
       if doPlayerRemoveItem(cid,5903,1) then
            npcHandler:say('Ah, right! The mage fluid belt! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
			setPlayerStorageValue(cid,fmage,1)
			 
            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 getPlayerSex(cid) == 1 then
	   selfSay(nofemale)
	   elseif getPlayerSex(cid) == 1 then 
       if getPlayerItemCount(cid,5903) >= 1 then
        if doPlayerRemoveItem(cid,5903,1) then
            npcHandler:say('Ah, right! The summoner fluid belt! Here you go.')
            doSendMagicEffect(getCreaturePosition(cid), 13)
			setPlayerStorageValue(cid,fsummoner,1)			
            doPlayerAddOutfit(cid, 133, 1)		
        end    
        end
        else
            selfSay(noitems)
        end
    else
        selfSay(already)
    end
    end

end




node1 = keywordHandler:addKeyword({'mage fluid belt'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get mage fluid belt you need give me 50 Vampire Dust. Do you have them 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})

node2 = keywordHandler:addKeyword({'summoner fluid belt'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get summoner fluid belt you need give me 50 Vampire Dust. Do you have them 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})



npcHandler:addModule(FocusModule:new())


would be perfect
 
@Nacke

You are using mine NPC Packet ... ^_^
I will release soon the newest Addons packet but to you here will go.:

sandra.lua

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
-- OTServ event handling functions end

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('Congratulations! Here, from now on you can wear our lovely potion belt as accessory.', 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
		
		
		elseif msgcontains(msg, 'mage fluid belt') then
		npcHandler:say('To get mage fluid belt you need give me winning lottery ticket. Do you have it with you?', cid)
		talk_state = 2
		elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerStorageValue(cid,22005) == -1 then
		if isPremium(cid) then
	    if getPlayerSex(cid) == 1 then
	    npcHandler:say('It seems you are male isnt there you get that part of this addon!')
	    elseif getPlayerSex(cid) == 0 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,22005,1)			 
            doPlayerAddOutfit(cid, 138, 1)
            talk_state = 0 			
        end    
        end
        else
            npcHandler:say('You do not have all the required items.')
        end
        else
        npcHandler:say('It seems you already have this addon, don\'t you try to mock me son!')
        end


		elseif msgcontains(msg, 'summoner fluid belt') then
		npcHandler:say('To get summoner fluid belt you need give me winning lottery ticket. Do you have it with you?', cid)
		talk_state = 3
		elseif msgcontains(msg, 'yes') and talk_state == 3 and getPlayerStorageValue(cid,22011) == -1 then
		if isPremium(cid) then
	    if getPlayerSex(cid) == 0 then
	    npcHandler:say('It seems you are female isnt there you get that part of this addon!')
	    elseif getPlayerSex(cid) == 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,22011,1)			 
            doPlayerAddOutfit(cid, 133, 1)
            talk_state = 0 			
        end    
        end
        else
            npcHandler:say('You do not have all the required items.')
        end
        else
        npcHandler:say('It seems you already have this addon, don\'t you try to mock me son!')
        end		
		
        return TRUE
end
end


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

If i help you REP++ me
 
Hello

hello, if it's true I use your npc are perfect work very well you work well congratulations.
 
yeye but i can't vials 2006
i add doPlayerRemoveItem(cid, 2006,100) but i can chnge vial of fluid .. and empty
how to add only empty :/?
 
Back
Top