Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ynpc = YNPC:new( npcHandler )
- ynpc:initialize()
- --Opções iniciais( quando o player começa a conversa com o npc ) de topicos
- ynpc:setDefaultTopics( { JOB, FURNITURE } )
- ynpc:addTopic( {
- id = DONTUNDERSTAND,
- words = {},
- answer = "I don't understand you. I'm a busy man, if you don't have anything important to talk let me alone. Or you have any wood for me?",
- next = { WOOD },
- default = { reset = true }
- } )
- ynpc:addTopic( {
- id = JOB,
- words = { "job", "work" },
- answer = "I work with {wood}. I can transform it in many useful things.",
- next = { WOOD },
- default = {topic = DONTUNDERSTAND}
- } )
- ynpc:addTopic( {
- id = FURNITURE,
- words = { "furniture" },
- answer = "I build a lot of furniture types. Besides, i need good {wood} for build any furniture.",
- next = { WOOD },
- condition = getCondition,
- conditionDefault = { reset = true },
- default = {topic = DONTUNDERSTAND}
- } )
- ynpc:addTopic( {
- id = WOOD,
- words = { "wood" },
- answer = "Yes, its very important to do my job. Can you give me some wood?",
- next = { WOODYES, WOODNO },
- default = {message = "I don't understand you."}
- } )
- local function getWoodFromPlayer( cid, next )
- local player = Player( cid )
- local amount = player:getItemCount( 5901 )
- if amount > 0 then
- player:removeItem( 5901, amount )
- npcHandler:say("Than you!", cid )
- else
- npcHandler:say("You don't have any wood.", cid )
- end
- return true
- end
- yesWoodTopic = ynpc:addTopic( {
- id = WOODYES,
- words = { "yes" },
- answer = getWoodFromPlayer,
- next = {}
- } )
- ynpc:addTopic( {
- id = WOODNO,
- words = { "no" },
- answer = "Ok. Come back when you have interest in giving me some wood.",
- next = { }
- } )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement