Ir para conteúdo

Scrip De Npc Forger Com Defeito


pvjf

Posts Recomendados

Bom eu axei um toturial intereçante sobre sistema de blacksmith mas na hr de mandar ver n esta funcionando (tambem naum sei mexer muito com scripts =P) bom se auguem puder axar o erro e corrigir pra mim agradeço desdeja;

 

[11/09/2011 18:29:30] [Error - LuaScriptInterface::loadFile] data/npc/scripts/blacksmith.lua:91: '<eof>' expected near 'end'

[11/09/2011 18:29:30] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/blacksmith.lua

[11/09/2011 18:29:30] data/npc/scripts/blacksmith.lua:91: '<eof>' expected near 'end'

 

 

local focus = 0

local 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('Hello! I can teach you how to be a forger.')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'forger') then

selfSay('Eu posso lhe garantir o direito de Forjar armas por 2 crystal coin. Diga yes para aceitar')

talk_state = 1

queststatus1 = getPlayerStorageValue(cid,21735)

queststatus2 = getPlayerStorageValue(cid,21737)

queststatus3 = getPlayerStorageValue(cid,21739)

queststatus4 = getPlayerStorageValue(cid,21740)

queststatus5 = getPlayerStorageValue(cid,21734)

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

voc = getPlayerVocation(cid)

itemstatus = doPlayerRemoveItem(cid,2160,2)

queststatus = getPlayerStorageValue(cid,21737)

if queststatus1 == -1 or queststatus1 == 0 and queststatus3 == -1 or queststatus3 == 0 and queststatus4 == -1 or queststatus4 == 0 and queststatus5 == -1 or queststatus5 == 0 then

if itemstatus == 1 then

if queststatus == - 1 or queststatus == 0 then

setPlayerStorageValue(cid,21737,1)

selfSay('You can forge equipments at the blacksmiths room. Good job!')

else

selfSay('You are already a blacksmith. Humph ...')

end

else

selfSay('Back here when you have the money.')

end

else

selfSay('Only Blacksmith can be a Blacksmith forger.')

end

else

selfSay('You only can have 1 profession.')

end

talk_state = 0

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

elseif talk_state == 1 then

selfSay('Ok, see you later.')

focus = 0

 

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye!')

focus = 0

talk_start = 0

end

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

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...