Desbugando Os Addons Do 8.0

Vini13
Por Vini13
em Actions e Talkactions

Vini13

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 18/09/07Posts: 4Char no Tibia: Tio Coelho

1º que não sao os addons q estão bugados... mas sim o npc Varkhal

 

abra a pasta data\npc\script e abra o arkivo addon

ele estará assim:

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 ' .. creatureGetName(cid) .. '! I sell the first addon for 5k and the second addon for 10k.')

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, 'first addon') then

selfSay('Do you want to buy the first addon for 5k?')

talk_state = 1

 

elseif msgcontains(msg, 'second addon') then

selfSay('Do you want to buy the second addon for 10k?')

talk_state = 2

 

elseif talk_state == 1 then

if msgcontains(msg, 'yes') then

if pay(cid,5000) then

addon(cid, 1)

else

selfSay('Sorry, you don\'t have enough money.')

end

end

talk_state = 0

 

elseif talk_state == 2 then

if msgcontains(msg, 'yes') then

if pay(cid,10000) then

addon(cid, 2)

else

selfSay('Sorry, you don\'t have enough money.')

end

end

talk_state = 0

 

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

selfSay('Good bye, ' .. creatureGetName(cid) .. '!')

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

Entao substitua td que esta nesse arkivo por isso:

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 ' .. creatureGetName(cid) .. '! I sell the first addon for 5k and the second addon for 10k.')

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, 'first addon') then

selfSay('Do you want to buy the first addon for 5k?')

talk_state = 1

 

elseif msgcontains(msg, 'second addon') then

selfSay('Do you want to buy the second addon for 10k?')

talk_state = 2

 

elseif talk_state == 1 then

if msgcontains(msg, 'yes') then

if pay(cid,5000) then

doPlayerAddAddon(cid, 128, 1)

doPlayerAddAddon(cid, 129, 1)

doPlayerAddAddon(cid, 130, 1)

doPlayerAddAddon(cid, 131, 1)

doPlayerAddAddon(cid, 132, 1)

doPlayerAddAddon(cid, 133, 1)

doPlayerAddAddon(cid, 134, 1)

doPlayerAddAddon(cid, 143, 1)

doPlayerAddAddon(cid, 144, 1)

doPlayerAddAddon(cid, 145, 1)

doPlayerAddAddon(cid, 146, 1)

doPlayerAddAddon(cid, 151, 1)

doPlayerAddAddon(cid, 152, 1)

doPlayerAddAddon(cid, 153, 1)

doPlayerAddAddon(cid, 154, 1)

doPlayerAddAddon(cid, 251, 1)

doPlayerAddAddon(cid, 136, 1)

doPlayerAddAddon(cid, 137, 1)

doPlayerAddAddon(cid, 138, 1)

doPlayerAddAddon(cid, 139, 1)

doPlayerAddAddon(cid, 140, 1)

doPlayerAddAddon(cid, 141, 1)

doPlayerAddAddon(cid, 142, 1)

doPlayerAddAddon(cid, 147, 1)

doPlayerAddAddon(cid, 148, 1)

doPlayerAddAddon(cid, 149, 1)

doPlayerAddAddon(cid, 150, 1)

doPlayerAddAddon(cid, 155, 1)

doPlayerAddAddon(cid, 156, 1)

doPlayerAddAddon(cid, 157, 1)

doPlayerAddAddon(cid, 158, 1)

doPlayerAddAddon(cid, 252, 1)

else

selfSay('Sorry, you don\'t have enough money.')

end

end

talk_state = 0

 

elseif talk_state == 2 then

if msgcontains(msg, 'yes') then

if pay(cid,10000) then

doPlayerAddAddon(cid, 128, 2)

doPlayerAddAddon(cid, 129, 2)

doPlayerAddAddon(cid, 130, 2)

doPlayerAddAddon(cid, 131, 2)

doPlayerAddAddon(cid, 132, 2)

doPlayerAddAddon(cid, 133, 2)

doPlayerAddAddon(cid, 134, 2)

doPlayerAddAddon(cid, 143, 2)

doPlayerAddAddon(cid, 144, 2)

doPlayerAddAddon(cid, 145, 2)

doPlayerAddAddon(cid, 146, 2)

doPlayerAddAddon(cid, 151, 2)

doPlayerAddAddon(cid, 152, 2)

doPlayerAddAddon(cid, 153, 2)

doPlayerAddAddon(cid, 154, 2)

doPlayerAddAddon(cid, 251, 2)

doPlayerAddAddon(cid, 136, 2)

doPlayerAddAddon(cid, 137, 2)

doPlayerAddAddon(cid, 138, 2)

doPlayerAddAddon(cid, 139, 2)

doPlayerAddAddon(cid, 140, 2)

doPlayerAddAddon(cid, 141, 2)

doPlayerAddAddon(cid, 142, 2)

doPlayerAddAddon(cid, 147, 2)

doPlayerAddAddon(cid, 148, 2)

doPlayerAddAddon(cid, 149, 2)

doPlayerAddAddon(cid, 150, 2)

doPlayerAddAddon(cid, 155, 2)

doPlayerAddAddon(cid, 156, 2)

doPlayerAddAddon(cid, 157, 2)

doPlayerAddAddon(cid, 158, 2)

doPlayerAddAddon(cid, 252, 2)

else

selfSay('Sorry, you don\'t have enough money.')

end

end

talk_state = 0

 

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

selfSay('Good bye, ' .. creatureGetName(cid) .. '!')

focus = 0

talk_start = 0

end

end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

 

if (os.clock() - talk_start) > 15 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 2 then

selfSay('Good bye then.')

focus = 0

end

end

end

explicando:

na part

doPlayerAddAddon(cid, 136, 2)

por exemplo...

o 136 quem dizer o outfit... o 2 quem dizer q vai adicionar o outfit 2

antes só havia:

doPlayerAddAddon(cid, 2)[/b]

não havia outfit...

 

FIM DO TUTORIAL

__________________
O Matador


Scripter: 100%
Mapper: 100%
NPC Maker: 90%
Spell Maker: 100% no 7.6 e 75% no 7.8+
ACTION Maker: 50%
Web Desingner: 20%



Server Online:
mortaltibia.servegame.com
24horas



Ja possuo Site:
Tibia Mortal

Meus Tutoriais:
Faça seu próprio restarter
NPC Andam

me falem sobre BUG/ERROS/CRÍTICAS dos meus tutos
ANTES DE RECLAMAR... ME SUPERE

xDdoluiz

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 29/03/07Posts: 40

PUXA

Muito muito obrigado cara

O meu DEvland nem tinha addon

:/

Status - fazendo map novo - 100%


Esquilinho ROX!

Ferrys

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 10/10/07Posts: 110Char no Tibia: Ferrys

uma ideia muito inteligente ;)

meus addons tinha bugado tbm

mas dai baxei outra versão pra

pega um npc a cada addon

muito bom

 

:smile_positivo:

i love otserv (?)