Venn
Member
- Joined
- Aug 16, 2009
- Messages
- 547
- Reaction score
- 20
hello.
i want make from 2 scripts one, but i don't know how to do it. if anyone can helmp me please.
first:
second:
its scripts from oldrak one to paradox tower quest second to demon oak i think.
and i want another npc Zoltan.
first:
second:
please make a 1 script eacha for npc please.
i want make from 2 scripts one, but i don't know how to do it. if anyone can helmp me please.
first:
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 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(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, 'hugo') then
selfSay('Ah, the bane of the Plains of Havoc, the hidden beast, the unbeatable foe. I live here for years and I am sure it\'s only a myth.')
talk_state = 1
elseif msgcontains(msg, 'myth') and talk_state == 1 then
selfSay('There are many tales about the fearsome Hugo. It\'s said it is an abomination, accidentally created by Yenny the Gentle. It\'s halve demon, halve something else and people say it\'s still alive after dozens of years.')
talk_state = 2
elseif msgcontains(msg, 'yenny the gentle') and talk_state == 2 then
selfSay('Yenny, known as the Gentle, was one of most powerfull magicwielders in ancient times and known throughout the world for her mercy and kindness.')
setPlayerStorageValue(cid,6664,1)
talk_state = 3
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
selfSay('Good Bye. |PLAYERNAME|!')
talk_state = 0
end
-- 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.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
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
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, 'hallowed axe') then
npcHandler:say('Do you want to buy a Hallowed Axe from me?', cid)
talk_state = 1
elseif msgcontains(msg, 'yes') and talk_state == 1 then
local price = 1000
if getPlayerItemCount(cid, 2386) >= 1 and getPlayerMoney(cid) >= price then
if doPlayerRemoveMoney(cid, price) == true then
npcHandler:say('Here you are. You can now defeat the demon oak with this axe.', cid)
doPlayerRemoveItem(cid, 2386, 1)
doPlayerAddItem(cid, 8293, 1)
talk_state = 0
end
else
npcHandler:say('I need an axe and ' .. price .. ' gold coins to make you a {hallowed axe}.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'demon oak') then
npcHandler:say('Did you defeat the demon oak?', cid)
talk_state = 2
elseif msgcontains(msg, 'yes') and talk_state == 2 then
if getPlayerStorageValue(cid, 35700) == 1 then
npcHandler:say('Good job!', cid)
doPlayerSetStorageValue(cid, 35700, 2)
talk_state = 0
else
npcHandler:say('Go defeat the demon oak first.', cid)
talk_state = 0
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
npcHandler:say('Ok thanks.', cid)
talk_state = 0
end
-- 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.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
its scripts from oldrak one to paradox tower quest second to demon oak i think.
and i want another npc Zoltan.
first:
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 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(npcHandler.focus ~= cid) then
return false
end
local queststate = getPlayerStorageValue(cid,6664)
if msgcontains(msg, 'yenny the gentle') and queststate == 1 then
selfSay('Ah, Yenny the Gentle was one of the founders of the druid order called Crunors Caress, that has been originated in her hometown Carlin.')
talk_state = 1
elseif msgcontains(msg, 'crunors caress') and talk_state == 1 then
selfSay('A quite undruidic order of druids they were, as far as we know. I have no more enlightening knowledge about them though.')
setPlayerStorageValue(cid,6665,1)
talk_state = 2
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 2) then
selfSay('Good Bye. |PLAYERNAME|!')
talk_state = 0
end
-- 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.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'yenny the gentle') and queststate == 1 then
selfSay('Ah, Yenny the Gentle was one of the founders of the druid order called Crunors Caress, that has been originated in her hometown Carlin.')
talk_state = 1
elseif msgcontains(msg, 'crunors caress') and talk_state == 1 then
selfSay('A quite undruidic order of druids they were, as far as we know. I have no more enlightening knowledge about them though.')
setPlayerStorageValue(cid,6665,1)
talk_state = 2
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 2) then
selfSay('Good Bye. |PLAYERNAME|!')
talk_state = 0
end
-- 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.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
please make a 1 script eacha for npc please.