Ir para conteúdo
Entre para seguir isso  
vsbb13

[N:Fácil] Desbugando os Addons do 8.0

Recommended Posts

vsbb13    0
vsbb13

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

entao ele estara agora vendendo addons direitinho! (obs: foi editado por o post estar bugado, adms gerais deem 1 olhada, e esse npc alterei, agora eh 1 npc só para os 2 sexos!)

 

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...

PRONTO ACABAMOS

 

 

NAO REMOVÃO OS CRÉDITOS... SÃO MEUS TOTALMENTE! wink.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites
Razor    1
Razor

Aprovado e movido.

 

esK~

Compartilhar este post


Link para o post
Compartilhar em outros sites
cnecjoao    0
cnecjoao

Parabéns, muita gente precisa disso, pena que na maioria dos ots agora nao sao mais assim os scrips de npc, sao umas coisas complicadas como por exemplo:

 

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

 

 

-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'entrar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer entrar na academia por 100gps?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 100, destination = {x=384, y=199, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

 

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'Academia de Treinamento com Weapons\' for just a small fee.'})

 

-- Makes sure the npc reacts when you say hi, bye etc.

npcHandler:addModule(FocusModule:new())[/b]

 

Obrigado, meu proximo ot sera evolutions, e arrumando uma coisa q vc fez de errado... o outfit 251 q vc pois no female eh de homem e o 252 q vc pois no male q eh de mulher. ^^, mais isso eh coisa simples.

 

Parabéns otimo topico.

Compartilhar este post


Link para o post
Compartilhar em outros sites
Reading    0
Reading

Ótimo tutorial, bem explicado e arrumado

 

Parabéns !!

 

rdnG ~

Compartilhar este post


Link para o post
Compartilhar em outros sites
vsbb13    0
vsbb13

tipo... no meu ot... o outfit d female eh o 251 e o d homem eh 252

mas dai vcs veem ai

 

flem bem ou mau... mas flem

e antes d fla mau m superem!

Compartilhar este post


Link para o post
Compartilhar em outros sites
DantexD    0
DantexD

parabens apesar de eu não enteder ***** nenhuma de script mais vleu pela iniciativa

 

 

 

 

ae gente to precisando de scripter quem quiser me add [email protected]

Compartilhar este post


Link para o post
Compartilhar em outros sites
Mindigo    0
Mindigo

lglzin,.

biggrin.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites
Azuth    0
Azuth

otimo tuto, parabéns mermu, aprovado

Compartilhar este post


Link para o post
Compartilhar em outros sites
vsbb13    0
vsbb13

vlw aew gent!

mas tipo...isso não foi tão difícil de fazer...

pq tipo... no evolutions eh fácil de mexer!

e peguei 1 tuto em base...mas nele fazia de 1 em 1 como no tiia normal...dai dei 1 UPGRADE nele ^^

mas obrigado por postarem

 

mas os créditos contiuam meus pq eu que montei e testei o npc!

Compartilhar este post


Link para o post
Compartilhar em outros sites
Night Wolf    11
Night Wolf

Muito bom

nunca pensei nisso;;

ninguém trouxe para cá muito bom e Obrigado..

Compartilhar este post


Link para o post
Compartilhar em outros sites
_RIBEIRO_    0
_RIBEIRO_

Muito bom cara meu npc dos addons tava nugado + agora eu arrumei com o seu tutorial vlw mesmo ! =)

Compartilhar este post


Link para o post
Compartilhar em outros sites
vsbb13    0
vsbb13

q bom q vcs gostaram...

fiz 1 tópico sobre mana rune... mas fexaram... isso q era o + completo ¬¬

colokei os devidos créditos etc... é so vcs olharem no avaliação de tutoriais

Compartilhar este post


Link para o post
Compartilhar em outros sites
Griloh    0
Griloh

Pra mim não foi um bom tutorial não..

Ele simplesmente te "manda" fazer e nem explica o suposto bug que tinha..

Nos próximos tutoriais tente explicar o que você está fazendo, você sabe mas tem gente que não.. ;]

Compartilhar este post


Link para o post
Compartilhar em outros sites
vsbb13    0
vsbb13

então irei explicar Griloh

 

na part

doPlayerAddAddon(cid, 136, 2)[/b]

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...

 

satisfeito?

Compartilhar este post


Link para o post
Compartilhar em outros sites
vsbb13    0
vsbb13

qlqr outra duvida...é só falar!

Compartilhar este post


Link para o post
Compartilhar em outros sites
Liniker    0
Liniker

apesar de eu n tar jogando ots com map global ou Yurots mas ta bom :)

Compartilhar este post


Link para o post
Compartilhar em outros sites
\\\kReXt///    0
\\\kReXt///

oW vLW aEw!

:style:

Compartilhar este post


Link para o post
Compartilhar em outros sites
diegotozzeti    0
diegotozzeti

aee MATADOR tipo os meus addons estão bugados assim :

o MALE FIKA FEMALE

o FEMALE FIKA MALE

 

estão invertidos voce sabe arrumar?

vlew!

Compartilhar este post


Link para o post
Compartilhar em outros sites
Smitt    0
Smitt

NPC SUMIU Oo pq ¹° ela n vendia as addons agora fiz isso ela sumiu Lol~

Compartilhar este post


Link para o post
Compartilhar em outros sites
Smitt    0
Smitt

tipo o meu ta bugado assim:ela n vendia nd tipo vc komprava pagava dim e n recebia as addons

Compartilhar este post


Link para o post
Compartilhar em outros sites

Faça login para comentar

Você vai ser capaz de deixar um comentário após fazer o login



Entrar Agora
Entre para seguir isso  

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×