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

Voolcano Island

Angelika1993

New Member
Joined
Oct 6, 2014
Messages
46
Reaction score
2
Hello i serach script for quest when we give npc 50 demonic essence we can every day fly on island.

When we have items :


Player : Hi
NPC: How can I help you?
Player : voolcano
NPC : Did you bring me 50 essenceto can every day fly on voolcano island?
Player : yes
NPC : Here you go.

When we do not have items :


Player : Hi
NPC: How can I help you?
Player : voolcano
NPC : Did you bring me 50 essence to can every day fly on voolcano island?
Player : yes
NPC : Sorry, you don't have these items.

When we have quest done :
Player : Hi
NPC: How can I help you?
Player : voolcano
NPC: Are you sure to leave this place and fly to voolcano island?
Player : yes
NPC : Here you go...

Thanks.
 
Can you post an Lua script from one of your npcs? One with msges (Like runes.lua from Eryn if your datapack has that) so I know what kind of npcsystem your server is using.
 
Big thanks for help its a Malak (runes)

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
-- OTServ event handling functions end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'light wand', 'lightwand'}, 2163, 500, 'magic light wand')

shopModule:addBuyableItem({'manapotion', 'manapotion'}, 7620, 100, 'mana potion')
shopModule:addBuyableItem({'healthpotion', 'healthpotion'}, 7618, 100, 'health potion')
shopModule:addBuyableItem({'strong mana potion', 'strong mana potion'}, 7589, 300, 'strong mana potion')
shopModule:addBuyableItem({'strong health potion', 'strong health potion'}, 7588, 300, 'strong health potion')
shopModule:addBuyableItem({'great mana potion', 'great mana potion'}, 7590, 500, 'great mana potion')
shopModule:addBuyableItem({'great health potion', 'great health potion'}, 7591, 500, 'great health potion')


shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 3000, 100, 'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball', 'gfb'}, 2304, 1500, 100, 'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'}, 2313, 2500, 100, 'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 2273, 4000, 100, 'ultimate healing rune')
shopModule:addBuyableItem({'terra wall', 'terra'}, 2269, 4000, 100, 'terra wall rune')
shopModule:addBuyableItem({'magic wall', 'mw'}, 2293, 4000, 100, 'magic wall rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 2268, 8000, 100, 'sudden death rune')
shopModule:addBuyableItem({'manarune', 'mr'}, 2270, 20000, 'manarune')


shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 15000, 'wand of inferno')
shopModule:addBuyableItem({'wand of decay', 'decay'}, 2188, 5000, 'wand of decay')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 10000, 'explosion rune')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 500, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 1000, 'wand of dragonbreath')

shopModule:addBuyableItem({'terra rod', 'terra'}, 2181, 10000, 'terra rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 500, 'snakebite rod')
shopModule:addBuyableItem({'hailstorm rod', 'hailstorm'}, 2183, 15000, 'hailstorm rod')
shopModule:addBuyableItem({'necrotic rod', 'necrotic'}, 2185, 3000, 'necrotic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 500, 'moonlight rod')

npcHandler:addModule(FocusModule:new())


and this is Captain :

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
-- OTServ event handling functions end


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'center'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want back to Center City? Its not free you must give me 10 crystal coins!'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 150, cost = 100000, destination = {x=958, y=480, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Okay....'})





-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
 
I mean with messages from the npc and the player, like: if msgcontains(msg, "yes") then etc.
i found this on a 8.10 I dont know if they work tho xd

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
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


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'mystic island'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Mystic Island for 50 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 50, cost = 50, destination = {x=1447, y=1504, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'Mystic Island\' for just a small fee.'})

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
edit: another one

Code:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
      if focus == cid then
          selfSay('Good bye then.')
          focus = 0
          talk_start = 0
      end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
      return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
      msg = string.lower(msg)

      if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
          selfSay('Hello ' .. creatureGetName(cid) .. '! I sell the first addon for 5k and the second addon for 10k.')
          focus = cid
          talk_start = os.clock()

      elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

    elseif focus == cid then
        talk_start = os.clock()

        if msgcontains(msg, 'first addon') then
            selfSay('Do you want to buy the first addon for 5k?')
            talk_state = 1

        elseif msgcontains(msg, 'second addon') then
            selfSay('Do you want to buy the second addon for 10k?')
            talk_state = 2   
       
        elseif talk_state == 1 then
            if msgcontains(msg, 'yes') then
                if pay(cid,5000) then
                    addon(cid, 1)
                else
                    selfSay('Sorry, you don\'t have enough money.')
                end
             end
            talk_state = 0

        elseif talk_state == 2 then
            if msgcontains(msg, 'yes') then
                if pay(cid,10000) then
                    addon(cid, 2)
                else
                    selfSay('Sorry, you don\'t have enough money.')
                end
             end
            talk_state = 0
           
        elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
            selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
            focus = 0
            talk_start = 0
        end
    end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
    doNpcSetCreatureFocus(focus)
    if (os.clock() - talk_start) > 30 then
          if focus > 0 then
              selfSay('Next Please...')
          end
              focus = 0
      end
     if focus ~= 0 then
         if getDistanceToCreature(focus) > 5 then
             selfSay('Good bye then.')
             focus = 0
         end
     end
end
 
Code:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local storage = 83454
local teleportpos = {x = 100, y = 100, z = 7}

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
     if focus == cid then
         selfSay('Good bye then.')
         focus = 0
         talk_start = 0
     end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
     return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
     msg = string.lower(msg)

     if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
         selfSay('How can I help you?')
         focus = cid
         talk_start = os.clock()

     elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
         selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

     elseif focus == cid then
         talk_start = os.clock()

         if msgcontains(msg, 'voolcano') then
             if getPlayerStorageValue(cid, storage) ~= 1 then
                 selfSay('Did you bring me 50 essenceto can every day fly on voolcano island?')
                 talk_state = 1
             else
                 selfSay('Are you sure to leave this place and fly to voolcano island?')
                 talk_state = 2
             end
         elseif talk_state == 1 then
             if msgcontains(msg, 'yes') then
                 if getPlayerStorageValue(cid, storage) ~= 1 then
                     if getPlayerItemCount(cid, 6500) >= 50 then
                         selfSay('Here you go.')
                         doPlayerRemoveItem(cid, 6500, 50)
                         doTeleportThing(cid, teleportpos, FALSE)
                         setPlayerStorageValue(cid, storage, 1)
                     else
                         selfSay('Sorry, you don\'t have 50 essenceto.')
                     end
                 end
             end
             talk_state = 0
         elseif talk_state == 2 then
             if msgcontains(msg, 'yes') then
                 selfSay('Here you go!')
                 doTeleportThing(cid, teleportpos, FALSE)
             end
             talk_state = 0
         elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
             selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
             focus = 0
             talk_start = 0
         end
     end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
     doNpcSetCreatureFocus(focus)
     if (os.clock() - talk_start) > 30 then
         if focus > 0 then
             selfSay('Next Please...')
         end
         focus = 0
     end
     if focus ~= 0 then
         if getDistanceToCreature(focus) > 5 then
             selfSay('Good bye then.')
             focus = 0
         end
     end
end

Not tested, if I made type mistakes, post the errors.
 
Big Thanks!!! In machiny any error but, npc do not teleport.
When i give him 50 essence he do not teleport and :

17:43 [GM]Angelika [1000]: hi
17:43 Manny: How can I help you?
17:43 [GM]Angelika [1000]: voolcano
17:43 Manny: Did you bring me 50 essenceto can every day fly on voolcano island?
17:43 [GM]Angelika [1000]: yes
17:43 Manny: Here you go.
17:43 [GM]Angelika [1000]: voolcano
17:43 Manny: Did you bring me 50 essenceto can every day fly on voolcano island?
17:43 [GM]Angelika [1000]: yes
17:43 Manny: Sorry, you don't have 50 essenceto.

But great thanks!
 
Try without false
Code:
doTeleportThing(cid, teleportpos)

Also make sure the teleportpos is a valid walkable position.
If you have errors in your console, post them.
 
doTeleportThing(cid, teleportpos, FALSE)
local teleportpos = {x = 1000, y = 1000, z = 7}
Oh yes is error when i say
18:35 [GM]Angelika [1000]: voolcano
18:35 Manny: Did you bring me 50 essenceto can every day fly on voolcano island?
18:35 [GM]Angelika [1000]: yes
18:35 Manny: Here you go.

Lua Script Error: [Npc interface]
data/npc/scripts/boat_voolcano.lua:OnCreatureSay
attempt to index a number value
 
No line or function?
You can remove or quote the teleport and storage line, to see if you still get that error after that.

Btw, do you have the source of your server? So I can look in the source which functions your server is using.
 
I mean the .cpp/.h files, so from your .exe file.
If you don't have the source files, do you have a download link of your server (where you downloaded it)?

I can also help with teamviewer if you want.
 
Back
Top