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

Hekan

New Member
Joined
Jun 14, 2008
Messages
94
Reaction score
0
Im sorry im bad in english but i want script for npc.
I want NPC Hjaern of real norseman addon. I need it please help me.
I make it but if i say frostheart shard for second addon NPC tell me the same message of first addon.

Please Help me


Oh if its not problem can someon make Plant system? i Mean new plants and seeds
 
Ok i made script but it not working:/ Can u fix it?

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

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
keywordHandler:addKeyword({'offers'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu compro/vendo Pearls, Gems e vendo jewelry.'})
keywordHandler:addKeyword({'pearls'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu compro/vendo Black Pearl (280gp/560gp) e White Pearl (160gp/320gp).'})
keywordHandler:addKeyword({'gems'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu compro/vendo Small Diamond (300gp/600gp), Small Sapphire (250gp/500gp), Small Ruby (250gp/500gp), Small Emerald (250gp/500gp) e Small Amethyst (200gp/400gp).'})
keywordHandler:addKeyword({'jewelry'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu vendo Wedding Ring (990gp), Golden Amulet (6600gp) e Ruby Necklace (3560gp).'})

function creatureSayCallback(cid, type, msg)

part = getPlayerStorageValue(cid, 7512)
addon = getPlayerStorageValue(cid, 7513)
sex = getPlayerSex(cid)
pos = getPlayerPosition(cid)

if msgcontains(msg, 'frostheart shard') then
    if getPlayerStorageValue(cid, 10000) < 1 then
        selfSay("Do you bring frostheart shards for our spell?")
        talkState = 1
end
elseif msgcontains(msg, 'frostheart shard') then
    if getPlayerStorageValue(cid, 10000) == 2 then
        selfSay("Do you bring frostheart shards for our spell?")
        talkState = 2
end

elseif msgcontains(msg, 'yes') and talkState == 1 then
     selfSay('Excellent, you collected 5 of them. If you have collected 5 or more, talk to me about your reward.')
     talk_state = 3
elseif msgcontains(msg, 'yes') and talkState == 2 then
     selfSay('Excellent, you collected 10 of them. If you have collected 10 or more, talk to me about your reward.')
     talk_state = 4

elseif talk_state == 3 then
if msgcontains(msg, 'reward') then
			IO = getPlayerItemCount(cid,7290)
			if IO >= 5 then
				selfSay('Take this. It might suit your Nordic outfit fine.')
				doPlayerRemoveItem(cid,7290,5)
                                setPlayerStorageValue(cid, 10000, 2)
				doSendMagicEffect(getPlayerPosition(cid), 14)
				doPlayerAddOutfit(cid, 252, 1)
				doPlayerAddOutfit(cid, 251, 1)
				talk_state = 0
			else
				selfSay('you don\'t have all the request items,')
			end
end
elseif talk_state == 4 then
if msgcontains(msg, 'reward') then
			IO = getPlayerItemCount(cid,7290)
			if IO >= 10 then
				selfSay('Take this. It might suit your Nordic outfit fine.')
				doPlayerRemoveItem(cid,7290,10)
                                setPlayerStorageValue(cid, 10000, 3)
				doSendMagicEffect(getPlayerPosition(cid), 14)
				doPlayerAddOutfit(cid, 252, 2)
				doPlayerAddOutfit(cid, 251, 2)
				talk_state = 0
			else
				selfSay('you don\'t have all the request items,')
			end
end

            talk_state = 0
			
  
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Ok.')
            talk_state = 0
        end

    return 1
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Please Help
 
Back
Top