NPC Morpheu troca itens

weverton1559
em Scripts

weverton1559

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 10/10/11Posts: 43Char no Tibia: Kenay

Script do NPC Morpheu (que troca 100 Giant Spider Silk por 10 Spool of Yarn). +Rep pra quem passar ela sem bugs.

notle2012

uoʇן£
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 03/01/12Posts: 884Char no Tibia: Segredo

data\npc\nomedonpc.xml

<npc name="NOMEDONPC" script="data/npc/scripts/nomedoarquivo.lua" walkinterval="2000" floorchange="0">
   <health now="100" max="100"/>
   <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>
    <parameters>
		    <parameter key="message_greet" value="Yes." />
		    <parameter key="message_farewell" value="Tchau." />
		    <parameter key="message_walkaway" value="Tchau." />
    </parameters>
</npc>

data\npc\scripts\nomedoarquivo.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
npcHandler:setMessage(MESSAGE_GREET, "eu troco item pra vc? me diz (yes)")   -- muda a frase   só yes q não muda
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local h = 2160 -- ID do item que vai troca
local j = 2200 -- ID que vai ganhar
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'yes')) then
if doPlayerRemoveItem(cid,h,100) then
doPlayerAddItem(cid,j,10)
selfSay('Obrigado por troca cmg.',cid)   -- muda a frase
talkState[talkUser] = 1
else
selfSay('vc não tem item que eu quero..',cid)   -- muda a frase
talkState[talkUser] = 1
end
return TRUE
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Por Favor quando for fazer pedidos faz o pedido com mais clareza e com os mínimos detalhes
GOSTO DOS MEUS SCRIPT CLICK EM CURTIR :D

 

sistema de fome

TROCA TROCA

sistema coliseum by notle v1

new sistema [KILLER-UP]

 

 

jcLmJPT.png

SkyLigh

User X
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 23/07/12Posts: 2183Char no Tibia: Kissy

Script do NPC Morpheu (que troca 100 Giant Spider Silk por 10 Spool of Yarn). +Rep pra quem passar ela sem bugs.

 

Título irregular

reportado

Att,
Kissy

Subwat

GAUCHO MACHO
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 27/07/09Posts: 1516Char no Tibia: Gean Riot

o título está "npc morpheu" por mim está dentro das regras amigo.

Entrem Server online desde o dia 22/02/2013 Monster 24HORAS dedicado!

IP: monster24h.com

PROTOCOL:8.60

PORT:7171

 

RATES:

Exp: 9999x~10x

Skills:800x

Magic:200x

Loot:2x

Pvp-e Advanced: 1.1x Ao matar players de level semelhante.

 

Accounts Pelo Account Manager!

1579091

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 06/11/11Posts: 1088Char no Tibia: Stroked

data/npc/scripts crie um arquivo chamado Morpheu.xml

 

coloque isso dentro:

 

 

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Morpheu" script="data/npc/scripts/morheu.lua" walkinterval="0" floorchange="0">

<health now="100" max="100"/>

<look type="160" head="192" body="29" legs="40" feet="27" addons="0"/>

<parameters>

<parameter key="module_shop" value="1" />

<parameter key="module_keywords" value="1" />

<parameter key="keywords" value="exchange;" />

<parameter key="keyword_reply1" value="I can exchange {giant spider silk} for a Spool Of Yarn, are you interested? "/>

<parameter key="shop_buyable" value="blessed wooden stake,5942,1000;obsidian knife,5908,5000;" />

<parameter key="message_greet" value="Oh, Welcome |PLAYERNAME|, say {exchange} !" />

<parameter key="message_sendtrade" value="Here is my offer, also ask me for {exchange} if you want to get some special items!" />

<parameter key="message_farewall" value="Good bye!"/>

<parameter key="message_walkaway" value="Good bye then!"/>

</parameters>

</npc>

 

 

dps em scripts crie um script chamado morpheu.lua coloque isso dentro:

 

 

 

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

 

item = 'You do not have the required items.'

done = 'Here you are.'

 

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

if msgcontains(msg, 'giant spider silk') then

if getPlayerItemCount(cid,5879) >= 1 then

selfSay('Did you bring me the Giant spider Silk?', cid)

talk_state = 1

else

selfSay('I need a {giant spider silk}, to give you the Spool of Yarn. Come back when you have them.', cid)

talk_state = 0

end

 

elseif msgcontains(msg, 'yes') and talk_state == 1 then

talk_state = 0

if getPlayerItemCount(cid,5879) >= 1 then

if doPlayerRemoveItem(cid,5879, 10) == TRUE then

selfSay(done, cid)

doPlayerAddItem(cid, 5886, 1)

end

else

selfSay(item, cid)

end

 

elseif msgcontains(msg, 'dfdfdfh') then

if getPlayerItemCount(cid,5911) >= 1 then

selfSay('Did you bring me the red piece of cloth?', cid)

talk_state = 2

else

selfSay('I need a {red piece of cloth}, to give you the Dragon Throne. Come back when you have it.', cid)

talk_state = 0

end

elseif msgcontains(msg, 'yes') and talk_state == 2 then

talk_state = 0

if getPlayerItemCount(cid,5911) >= 1 then

if doPlayerRemoveItem(cid,5911,1) == TRUE then

selfSay(done, cid)

doPlayerAddItem(cid,11199,1)

end

else

selfSay(item, cid)

end

 

elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then

selfSay('So Leave, LEAVE ME NOW!')

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())

 

 

Basta falar com ele e sabera o que dizer...

 

Lembrando que ja fiz tudo que tinha que fazer, o npc ja ta trocando certinho os itens...

weverton1559

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 10/10/11Posts: 43Char no Tibia: Kenay

@notle2012 - a script dar erro. mesmo assim obrigado.

 

@SkyLigh - o titulo estar correto, o nome do npc e esse não fui eu que criei tem em vários outros tópicos falando

 

mesmo nome mais a script que eu achei estar bugada.

 

@GuizitoG - na sua scripter ele troca por RED PIECES.

 

@nathan96 mim ajudou via pm por isso meu +rep vai pra ele. muito obrigado a todos que tentaram.

 

DUVIDA SANADA .