• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Compact npc

bomba

Member
Joined
Feb 26, 2008
Messages
635
Reaction score
7
Location
Brazil
I need to compact this script:
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
 
function onThink()                npcHandler:onThink()                end
 
  local config =
{
  name1 = "amazon",
  place1 = {x=7725, y=7264, z=7},
  stor1 = 96609765112,
 
  name2 = "cyclops",
  place2 = {x=7931, y=7282, z=7},
  stor2 = 96609765113,
 
  name3 = "dragon",
  place3 = {x=7787, y=7181, z=7},
  stor3 = 96609765114,
 
  name4 = "goblin",
  place4 = {x=7787, y=7181, z=7},
  stor4 = 96609765114,
 
  name5 = "minotaur",
  place5 = {x=7787, y=7181, z=7},
  stor5 = 96609765114,
 
  name6 = "orc",
  place6 = {x=7787, y=7181, z=7},
  stor6 = 96609765114,
}
 
function ve1(cid, message, keywords, parameters, node)
    if getPlayerStorageValue(cid, config.stor1) <= 0 then
          setPlayerStorageValue(cid, config.stor1, 1)
          selfSay("Now you have to go back alone.", cid)
          doTeleportThing(cid, config.place1, 1)
          doSendMagicEffect(config.place1, CONST_ME_TELEPORT)
    else
      selfSay("You may go only once for ".. config.name1 ..".", cid)
    end
  return true
end
 
keywordHandler:addKeyword({'hunt'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can take you to {".. config.name1 .."}, {".. config.name2 .."}, {".. config.name3 .."}."})
 
local node1 = keywordHandler:addKeyword({'vila dos elfos'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You want to go to ".. config.name1 .."?"})
    node1:addChildKeyword({'yes'}, ve1, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ok.", reset = true})
 
local node2 = keywordHandler:addKeyword({'lar dos dragoes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You want to go to ".. config.name2 .."?"})
    node2:addChildKeyword({'yes'}, ve2, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ok.", reset = true})
   
local node3 = keywordHandler:addKeyword({'poh'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You want to go to ".. config.name3 .."?"})
    node3:addChildKeyword({'yes'}, ve3, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ok.", reset = true})
 
npcHandler:addModule(FocusModule:new())
npcHandler:setMessage(MESSAGE_GREET, "Hello, I can guide you to {hunt}?")

I want the config like this:
Code:
[1] = {"amazon", {x=7725, y=7264, z=7}, 96609765112}
 
Back
Top