• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC here is my script of npc for demon oak

Joined
May 18, 2008
Messages
370
Reaction score
0
Location
Monterrey, México
here is my npc for demon oak i tested it on the forgotten server beta 2 and it
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 onSay(cid, words, param)
        if doPlayerRemoveItem(cid,2386,1) and doPlayerRemoveMoney(cid, 1000) == TRUE then
					doPlayerAddItem(cid,8293,1)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'with this axe go en defeat the demon oak if you do this task tell me i beat the demon oak or i killed the demon oak!')
        else
            doPlayerSendCancel(cid, "you need 1k for the enchantment!")
        end  
    return 1
end

function Beat(cid, message, keywords, parameters, node) 
            if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Excellent... go visit the tomb of my father to get your prices for clearing this task.')
                                        setPlayerStorageValue(cid,20004,1)
else
            doPlayerSendCancel(cid, "please go and defeat the demon oak!")
end
    return 1
end

 node1 = keywordHandler:addKeyword({'demon oak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'the {demon oak} is an evil tree thats plagin this island ask me for an {hallowed axe} to do this quest for me.'})
 node2 = keywordHandler:addKeyword({'hallowed axe'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'so you want a hallowed axe did you bring me an {axe} and {1000 gold coins}?'}) 
    node2:addChildKeyword({'yes'}, onSay, {}) 
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got enought money.', reset = true}) 
 node3 = keywordHandler:addKeyword({'i beat the demon oak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'did you really killed the demon oak???'}) 
    node3:addChildKeyword({'yes'}, Beat, {}) 
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you kill the demon oak.', reset = true})
 node4 = keywordHandler:addKeyword({'i killed the demon oak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'did you really killed the demon oak???'}) 
    node4:addChildKeyword({'yes'}, Beat, {}) 
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you kill the demon oak.', reset = true}) 
 node5 = keywordHandler:addKeyword({'killed'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'did you really killed the demon oak???'}) 
    node5:addChildKeyword({'yes'}, Beat, {}) 
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you kill the demon oak.', reset = true}) 

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Erm, did you realise that your NPC is nothing for guys without scripts for hallowed axe and gravestone? And it's using storage values that can be other in the rest of scripts.

Sorry.

But I will use this in other way. I change it a bit to be my quest NPC for other thing than demon oak :D

Thanks!

Regards,
Hermes
 
Erm, did you realise that your NPC is nothing for guys without scripts for hallowed axe and gravestone? And it's using storage values that can be other in the rest of scripts.

Sorry.

But I will use this in other way. I change it a bit to be my quest NPC for other thing than demon oak :D

Thanks!

Regards,
Hermes

it ok i am only giving the base to operate this npc that stoped working in beta 2.
 
Back
Top