Broldosk
New Member
- Joined
- Aug 23, 2019
- Messages
- 31
- Reaction score
- 1
well I tried to make a script in many ways, many may say I'm noob, and I agree, the best I could do was check the storage and sell the bless,
but I could never fix it =/ i set up a half-mouth script (npc kawill, should you sell me "a permission to talk to the next npc) permission = storage
he should say "if you don't have the storage then get"
if you already have the storage "will talk to pydar"
Pydar = Npc bless kazordoon
pydar has to check storage + remove storage if have + sell bless
if haven't bless = first talk to kawill.
these are my 2 scripts please don't laugh =D
Kawill npc
npc pydar
but I could never fix it =/ i set up a half-mouth script (npc kawill, should you sell me "a permission to talk to the next npc) permission = storage
he should say "if you don't have the storage then get"
if you already have the storage "will talk to pydar"
Pydar = Npc bless kazordoon
pydar has to check storage + remove storage if have + sell bless
if haven't bless = first talk to kawill.
these are my 2 scripts please don't laugh =D
Kawill npc
Lua:
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
local storage = 8888888
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'hi') and getPlayerStorageValue(cid,storage) == -1 then
npcHandler:say('Welcome |PLAYERNAME|, May earth protect you!}', cid)
state = 1
elseif msgcontains(msg, 'phoenix') or msgcontains(msg, 'bless') and state == 1 then
npcHandler:say('The Spark of the Phoenix is given by name and by the great pyromancer in the nearby fire temple. Do you wish to receive my part of the Spark if the Phoenix?', cid)
state = 2
elseif msgcontains(msg, 'yes') and state == 2 then
npcHandler:say('So receive the blessing of the life-giving earth, pilgrim!')
doSendMagicEffect(getCreaturePos(cid), 12)
setPlayerStorageValue(cid,storage, 1)
end
if msgcontains(msg, 'bye') and state >= 1 then
npcHandler:say('Good Bye. |PLAYERNAME|!', cid)
state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
npc pydar
Lua:
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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'hi') and getPlayerStorageValue(cid,8888888) == 1 then
npcHandler:say('Be greeted |PLAYERNAME| I can smell the scent of a phoenix on you!}', cid)
state = 1
elseif msgcontains(msg, 'phoenix') and state == 1 then
npcHandler:say('The Spark of the Phoenix is given by name and by the great pyromancer in the nearby fire temple. Do you wish to receive my part of the Spark if the Phoenix for 10000 gold?', cid)
state = 2
elseif msgcontains(msg, 'yes') and state == 1 then
npcHandler:say('So receive the blessing of the life-giving earth, pilgrim!')
doSendMagicEffect(getCreaturePos(cid), 12)
setPlayerStorageValue(cid,8888888, -1)
doPlayerAddBlessing(cid, 2)
doPlayerRemoveMoney(cid, 10000)
end
if msgcontains(msg, 'bye') and state >= 1 then
npcHandler:say('Good Bye. |PLAYERNAME|!', cid)
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())
Last edited: