Desnecessario 59 Postado Fevereiro 3, 2013 Share Postado Fevereiro 3, 2013 (editado) Ai galera preciso de um script que quando falar sim no npc mude acesso , exemplo : Hi você quer virar tutor ? Ai a pessoa fala sim e ganha acess 1 Script de base : focus = 0 talk_start = 0 target = 0 following = false 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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then if getPlayerStorageValue(cid,853) < 1 then selfSay('Hello ' .. creatureGetName(cid) .. 'Se Voce Deseja Virar Tutor diga "sim".') focus = cid talk_start = os.clock() else selfSay('Hey! Leave out of there!') focus = 0 talk_start = 0 end elseif string.find(msg, '(%a*)hi(%a*)') 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, 'sim') and focus == cid then talk_start = os.clock() end if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then selfSay('Good bye, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 end end function onCreatureChangeOutfit(creature) end function onThink() if focus > 0 then x, y, z = creatureGetPosition(focus) myx, myy, myz = selfGetPosition() if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then selfTurn(0) end if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then selfTurn(2) end if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then selfTurn(1) end if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then selfTurn(3) end if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(1) end if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(3) end if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(2) end if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(0) end if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(1) end if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(3) end if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(2) end if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(0) end if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(1) end if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(3) end if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(2) end if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(0) end end if focus == 0 then randmove = math.random(1,50) if randmove == 1 then selfMove(0) end if randmove == 2 then selfMove(1) end if randmove == 3 then selfMove(2) end if randmove == 4 then selfMove(3) end end 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) > 3 then selfSay('Good bye then.') focus = 0 end end end end Galera essa é a terceira vez que posto isso eu preciso muito gente.. motivos propios Quem ajudar dou rep todos os dias que eu entrar pfvrrrrrrrrrrrrrr ( se funcionar é claro ) Não custa nada para vocês que são scripters devem ser bem facil ( Server é 7.81 ) Editado Fevereiro 3, 2013 por Desnecessario Link para o comentário https://xtibia.com/forum/topic/206434-pedido-script-basico/ Compartilhar em outros sites More sharing options...
0 caotic 393 Postado Fevereiro 3, 2013 Share Postado Fevereiro 3, 2013 Claro que não conseguira ajuda. Você postou em área incorreta. Estarei movendo mais espero que leia as regras. Link para o comentário https://xtibia.com/forum/topic/206434-pedido-script-basico/#findComment-1458762 Compartilhar em outros sites More sharing options...
0 joadson 3 Postado Fevereiro 3, 2013 Share Postado Fevereiro 3, 2013 Tente com esse aqui. Vá em data/npc e crie um arquivo chamado equipe.xml e cole isso dentro <?xml version="1.0" encoding="UTF-8"?> <npc name="Equipe" script="data/npc/scripts/equipe.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> </npc> e depois vá em data/npc/script e crie outro arquivo chamado equipe.lua e coloque o codigo abaixo nele. 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('Adeus.') 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('Ola ' .. getCreatureName(cid) .. 'Você quer virar Tutor?.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! Aguarde, estou ocupado..') elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if getPlayerAccess(cid) >= 1 then selfSay('Desculpe, você já é um Tutor') talk_state = 0 elseif getPlayerLevel(cid) < 50 then selfSay('Voce precisa ter no minimo level 50...') talk_state = 0 end elseif talk_state == 1 then if getPlayerAccess(cid) >= 1 then selfSay('Parabens! Você acabou de virar Tutor.') setPlayerGroupId(cid, 2) end talk_state = 0 end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Next...') end focus = 0 talk_start = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Adeus') focus = 0 talk_start = 0 end end end end OBS: Estou começando a scriptar agora, então pode haver erros. Mas o que vale é a intenção Link para o comentário https://xtibia.com/forum/topic/206434-pedido-script-basico/#findComment-1458791 Compartilhar em outros sites More sharing options...
0 Desnecessario 59 Postado Fevereiro 3, 2013 Autor Share Postado Fevereiro 3, 2013 Bom ao contrario do nosso amigo caotic pelo menos você tentou ajudar.. então toma meu rep , porém não funcionou Link para o comentário https://xtibia.com/forum/topic/206434-pedido-script-basico/#findComment-1458892 Compartilhar em outros sites More sharing options...
0 caotic 393 Postado Fevereiro 3, 2013 Share Postado Fevereiro 3, 2013 Bom ao contrario do nosso amigo caotic pelo menos você tentou ajudar.. então toma meu rep , porém não funcionou Se você pelo menos tivesse a vontade de ler as regras e pelo postar o tópico em área correta Eu poderia te ajudar ao invez de mover seu tópico. Link para o comentário https://xtibia.com/forum/topic/206434-pedido-script-basico/#findComment-1458982 Compartilhar em outros sites More sharing options...
0 murilo103 42 Postado Fevereiro 18, 2013 Share Postado Fevereiro 18, 2013 focus = 0 talk_start = 0 target = 0 following = false 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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then if getPlayerStorageValue(cid,853) < 1 then selfSay('Hello ' .. creatureGetName(cid) .. 'Se Voce Deseja Virar Tutor diga "sim".') focus = cid talk_start = os.clock() else selfSay('Hey! Leave out of there!') focus = 0 talk_start = 0 end elseif string.find(msg, '(%a*)hi(%a*)') 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, 'sim') and focus == cid then setPlayerGroupId(cid, 2) selfSay('Parabens! Você acabou de virar Tutor.') talk_start = os.clock() end if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then selfSay('Good bye, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 end end function onCreatureChangeOutfit(creature) end function onThink() if focus > 0 then x, y, z = creatureGetPosition(focus) myx, myy, myz = selfGetPosition() if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then selfTurn(0) end if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then selfTurn(2) end if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then selfTurn(1) end if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then selfTurn(3) end if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(1) end if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(3) end if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(2) end if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(0) end if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(1) end if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(3) end if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(2) end if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(0) end if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(1) end if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(3) end if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(2) end if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(0) end end if focus == 0 then randmove = math.random(1,50) if randmove == 1 then selfMove(0) end if randmove == 2 then selfMove(1) end if randmove == 3 then selfMove(2) end if randmove == 4 then selfMove(3) end end 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) > 3 then selfSay('Good bye then.') focus = 0 end end end end Ainda não testei, pois nçao tenho nada de 7.81 aqui, Mas caso sua dúvida já foi sanada, por favor peça para que a mova! Link para o comentário https://xtibia.com/forum/topic/206434-pedido-script-basico/#findComment-1471981 Compartilhar em outros sites More sharing options...
0 Desnecessario 59 Postado Fevereiro 18, 2013 Autor Share Postado Fevereiro 18, 2013 Resolvi de outro jeito porém obrigado por tentar ajudar.. Link para o comentário https://xtibia.com/forum/topic/206434-pedido-script-basico/#findComment-1472226 Compartilhar em outros sites More sharing options...
0 murilo103 42 Postado Fevereiro 18, 2013 Share Postado Fevereiro 18, 2013 Resolvi de outro jeito porém obrigado por tentar ajudar.. Por favor, mostre a sua solução se possivel, pois outros podem ter a msm dúvida pedido para que mavam Link para o comentário https://xtibia.com/forum/topic/206434-pedido-script-basico/#findComment-1472284 Compartilhar em outros sites More sharing options...
0 Demonbholder 420 Postado Fevereiro 18, 2013 Share Postado Fevereiro 18, 2013 Tópico movido para a seção de dúvidas e pedidos resolvidos. Link para o comentário https://xtibia.com/forum/topic/206434-pedido-script-basico/#findComment-1472297 Compartilhar em outros sites More sharing options...
Pergunta
Desnecessario 59
Ai galera preciso de um script que quando falar sim no npc mude acesso , exemplo :
Hi você quer virar tutor ?
Ai a pessoa fala sim e ganha acess 1
Script de base :
focus = 0
talk_start = 0
target = 0
following = false
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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then
if getPlayerStorageValue(cid,853) < 1 then
selfSay('Hello ' .. creatureGetName(cid) .. 'Se Voce Deseja Virar Tutor diga "sim".')
focus = cid
talk_start = os.clock()
else
selfSay('Hey! Leave out of there!')
focus = 0
talk_start = 0
end
elseif string.find(msg, '(%a*)hi(%a*)') 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, 'sim') and focus == cid then
talk_start = os.clock()
end
if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if focus > 0 then
x, y, z = creatureGetPosition(focus)
myx, myy, myz = selfGetPosition()
if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
selfTurn(0)
end
if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
selfTurn(2)
end
if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
selfTurn(1)
end
if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
selfTurn(3)
end
if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(1)
end
if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(3)
end
if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(2)
end
if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(0)
end
if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(1)
end
if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(3)
end
if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(2)
end
if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(0)
end
if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(1)
end
if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(3)
end
if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(2)
end
if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(0)
end
end
if focus == 0 then
randmove = math.random(1,50)
if randmove == 1 then
selfMove(0)
end
if randmove == 2 then
selfMove(1)
end
if randmove == 3 then
selfMove(2)
end
if randmove == 4 then
selfMove(3)
end
end
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) > 3 then
selfSay('Good bye then.')
focus = 0
end
end
end
end
Galera essa é a terceira vez que posto isso eu preciso muito gente.. motivos propios
Quem ajudar dou rep todos os dias que eu entrar pfvrrrrrrrrrrrrrr ( se funcionar é claro )
Não custa nada para vocês que são scripters devem ser bem facil
( Server é 7.81 )
Editado por DesnecessarioLink para o comentário
https://xtibia.com/forum/topic/206434-pedido-script-basico/Compartilhar em outros sites
8 respostass a esta questão
Posts Recomendados