Pessoal antes de começar eu gostaria de falar q esse NPC eu q fiz .. passei a madrugada toda fazendo ele .. se forem copiar colokem creditos :smile_positivo:
Começando:
* Eu tenho um OTserv , que se faz os addons separados ai precisa do Piece of Royal steel .. essas coisas ai precisava de um NPC assim ^_^
Vc dá <-> Ele Troka
Crown Armor <-> Piece of royal steel
Boots Of Haste <-> Enchanted chicken wings
2 Royal Helmet <-> Fighting spirit
4 warrior helmet <-> warrior's sweat
10 Giant Spider Silks <-> spool of yarn
Giant sword <-> Crude Iron
Devil Helmet <-> Piece of hell steel
Dragon Shield <-> Piece of draconian steel
Como vc percebeu eu add outras coisas a mais ..
caso vc keira add mais eh so ir colokando (caso naum saiba me manda uma mp q eu ajudo)
la em data\npc copie e cole umnovo arquivo.lua e renomeie de A Sweaty Cyclops.lua e cole esse script :
<?xml version="1.0"?>
<npc name="A Sweaty Cyclops" autowalk="3" script="data/npc/scripts/cyc.lua" access="3" lookdir="3">
<health now="1000" max="1000"/>
<look type="22" head="20" body="30" legs="40" feet="50" />
</npc>
la em data\npc\scripts copie e cole umnovo arquivo.lua e renomeie de cyc.lua e cole esse script :
local focus = 0local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Olá ' .. creatureGetName(cid) .. '! Eu sou um ferreiro .. Tem algo para mim??')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'crown armor') or msgcontains(msg,'piece of royal steel') then
selfSay('Você quer trocar a Crown Armor pela Piece of royal steel ?')
talk_state = 1
elseif msgcontains(msg, 'boh') or msgcontains(msg,'enchanted chicken wings') then
selfSay('Você quer trocar a Boh pela Enchanted chicken wings ??')
talk_state = 2
elseif msgcontains(msg, 'fighting spirit') or msgcontains(msg, 'royal helmet') then
selfSay('Você quer trocar 2 Royal Helmet por Fighting spirit ??')
talk_state = 3
elseif msgcontains(msg, 'warriors sweat') or msgcontains(msg,'warrior helmet') then
selfSay('Você quer trocar 4 warrior helmet por warriors sweat ??')
talk_state = 4
elseif msgcontains(msg, 'spool of yarn') or msgcontains(msg,'giant spider silk') then
selfSay('Você quer trocar 10 giant spider silk por Spool of yarn ??')
talk_state = 5
elseif msgcontains(msg, 'crude iron') or msgcontains(msg,'giant sword') then
selfSay('Você quer trocar uma giant sword por um crude iron ??')
talk_state = 6
elseif msgcontains(msg, 'devil helmet') or msgcontains(msg,'piece of hell steel') then
selfSay('Você quer trocar um devil helmet por um piece of hell steel ??')
talk_state = 7
elseif msgcontains(msg, 'dragon shield') or msgcontains(msg,'piece of draconian steel') then
selfSay('Você quer trocar um dragon shield por um piece of draconian steel ??')
talk_state = 8
elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
itemstatus = doPlayerRemoveItem(cid,2487,1)
if itemstatus == 0 then
selfSay('Sorry, you not have items.')
else
doPlayerAddItem(cid,5887,1)
selfSay('Obrigado !!')
end
end
talk_state = 0
elseif talk_state == 2 then
if msgcontains(msg, 'yes') then
itemstatus = doPlayerRemoveItem(cid,2195,1)
if itemstatus == 0 then
selfSay('Sorry, you not have items.')
else
doPlayerAddItem(cid,5891,1)
selfSay('Thanks for items.')
end
end
talk_state = 0
elseif talk_state == 3 then
if msgcontains(msg, 'yes') then
itemstatus = doPlayerRemoveItem(cid,2498,2)
if itemstatus == 0 then
selfSay('Sorry, you not have items.')
else
doPlayerAddItem(cid,5884,1)
selfSay('Thanks for items.')
end
end
talk_state = 0
elseif talk_state == 4 then
if msgcontains(msg, 'yes') then
itemstatus = doPlayerRemoveItem(cid,2475,4)
if itemstatus == 0 then
selfSay('Sorry, you not have items.')
else
doPlayerAddItem(cid,5885,1)
selfSay('Thanks for items.')
end
end
talk_state = 0
elseif talk_state == 5 then
if msgcontains(msg, 'yes') then
itemstatus = doPlayerRemoveItem(cid,5879,10)
if itemstatus == 0 then
selfSay('Sorry, you not have items.')
else
doPlayerAddItem(cid,5886,1)
selfSay('Thanks for items.')
end
end
talk_state = 0
elseif talk_state == 6 then
if msgcontains(msg, 'yes') then
itemstatus = doPlayerRemoveItem(cid,2393,1)
if itemstatus == 0 then
selfSay('Sorry, you not have items.')
else
doPlayerAddItem(cid,5892,1)
selfSay('Thanks for items.')
end
end
talk_state = 0
elseif talk_state == 7 then
if msgcontains(msg, 'yes') then
itemstatus = doPlayerRemoveItem(cid,2462,1)
if itemstatus == 0 then
selfSay('Sorry, you not have items.')
else
doPlayerAddItem(cid,5888,1)
selfSay('Thanks for items.')
end
end
talk_state = 0
elseif talk_state == 8 then
if msgcontains(msg, 'yes') then
itemstatus = doPlayerRemoveItem(cid,2516,1)
if itemstatus == 0 then
selfSay('Sorry, you not have items.')
else
doPlayerAddItem(cid,5889,1)
selfSay('Thanks for items.')
end
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
end
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
So isto .. Por favor comentem =)
Creditos :
100% Kbral_jc