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

Npc

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

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:
Solution
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

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



function...
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"
these are my 2 scripts pleas
i think is better u make it
Lua:
npcHandler:say('Be greeted |PLAYERNAME| I can smell the scent of a phoenix on you!}', cid)
change to:
Lua:
npcHandler:say('Be greeted |PLAYERNAME| I can smell the scent of a {phoenix} on you!', cid)
 
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

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())
Alright, try this.
Lua:
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 greet(cid)
    talkState[cid] = 0
    return true
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, "phoenix") or msgcontains(msg, "bless") then
        if getPlayerBlessing(cid, 2) then
            selfSay("You already have the Spark of the Phoenix blessing.", cid)
            talkState[talkUser] = 0
            return true
        end
        if getPlayerStorageValue(cid, 45001) == 1 then
            selfSay("You've already received my part of this blessing. Go see the great pyromancer to finish the blessing.", cid)
            talkState[talkUser] = 0
            return true
        end
        selfSay("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 of the Phoenix?", cid)
        talkState[talkUser] = 1
       
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
        setPlayerStorageValue(cid, 45001, 1)
        doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_BLUE)
        selfSay("So receive the blessing of the life-giving earth, pilgrim!", cid)
        talkState[talkUser] = 0   
       
    end
   
    return true   
end


npcHandler:setCallback(CALLBACK_GREET, greet)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Lua:
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 greet(cid)
    talkState[cid] = 0
    return true
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, "phoenix") or msgcontains(msg, "bless") then
        if getPlayerBlessing(cid, 2) then
            selfSay("You already have the Spark of the Phoenix blessing.", cid)
            talkState[talkUser] = 0
            return true
        end
        if getPlayerStorageValue(cid, 45001) ~= 1 then
            selfSay("You need to receive the first portion of the Spark of the Phoenix blessing from Kawill before I can finish the ritual.", cid)
            talkState[talkUser] = 0
            return true
        end
        selfSay("I can smell the scent of a phoenix on you! Do you wish to receive the final blessing of the Spark of the Phoenix for 10,000 gold?", cid)
        talkState[talkUser] = 1
       
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
        if getPlayerMoney(cid) < 10000 then
            selfSay("You do not have the required donation to receive this blessing. Please come back and ask for the blessing again when you do.", cid)
            talkState[talkUser] = 0
            return true
        end
        doPlayerRemoveMoney(cid, 10000)
        doPlayerAddBlessing(cid, 2)
        setPlayerStorageValue(cid, 45001, -1)
        doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_BLUE)
        selfSay("Congratulations. You've received the full Spark of the Phoenix blessing, pilgrim!", cid)
        talkState[talkUser] = 0   
       
    end
   
    return true   
end


npcHandler:setCallback(CALLBACK_GREET, greet)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Solution
Back
Top