Broadcaster

tibiaa4e
em NPCs, monsters e raids

tibiaa4e

Ex amante de Tibia
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 18/12/05Posts: 912Gênero: MasculinoChar no Tibia: Kohzete

otro code no otfans

creditos: Alreth

é assim

vc conversa com o npc paga um valor e ele fala a frase q vc quiser

code ta ai

-- NPC Broadcaster by Alreth, v1.38, 2006-07-26 17:52 CET

-- Idea by souhlen (Anel)

-- Thanks to Qwerty| for helping fix the spambug

focus = 0

next_focus = 0

talk_start = 0

msgHi = 'Heylo! Would you like to broadcast anything?'

msgBye = 'See you another time!'

price = 2500

inConvo = 0

broadcast = ''

cast = ''

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(msgBye)

        distFocus = getDistanceToCreature(next_focus)

        if (distFocus ~= nil and distFocus < 4) then

            selfSay(msgHi)

            talk_start = os.clock()

            focus = next_focus

            next_focus = 0

            inConvo = 1

        else

            focus = 0

            talk_start = 0

            inConvo = 0

        end

    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)

    msg2 = msg

    msg = string.lower(msg)

    if (cast ~= '') then

        selfSay('does nothing')

    -- do nothing, wait until message has been broadcasted and npc has replied

    elseif (getDistanceToCreature(cid) >= 4 and focus == cid) then

        selfSay('Please come closer, '..creatureGetName(cid)..'. I can\'t hear what you are saying from over there.')

       

    elseif (type == 1) then

        if ((string.find(msg, '(%a*)hi(%a*)') or string.find(msg, '(%a*)hello(%a*)') or string.find(msg, '(%a*)heylo(%a*)') or string.find(msg, '(%a*)greetings(%a*)')) and (focus == 0) and getDistanceToCreature(cid) < 4) then

            selfSay(msgHi)

            focus = cid

            talk_start = os.clock()

            inConvo = 1

        elseif ((string.find(msg, '(%a*)hi(%a*)') or string.find(msg, '(%a*)hello(%a*)') or string.find(msg, '(%a*)heylo(%a*)') or string.find(msg, '(%a*)greetings(%a*)')) and (focus ~= cid) and getDistanceToCreature(cid) < 4)  then

            if (next_focus > 0 and getDistanceToCreature(next_focus) < 4) then

                selfSay('Take a nap while I help the ones before you, ' .. creatureGetName(cid) .. '.')

            else

                selfSay('I\'ll soon come to you, ' .. creatureGetName(cid) .. '.')

                next_focus = cid

            end

        elseif (focus == cid) then

            talk_start = os.clock()

            if ((msgcontains(msg, 'broadcast') or msgcontains(msg, 'say')) and inConvo == 0) then

                if (getPlayerLevel(creatureGetName(cid)) >= 30) then

                    selfSay('Do you want me to broadcast anything for you?')

                    inConvo = 1

                else

                    selfSay('Come back when you\'re older!')

                end

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

                selfSay('Tell me what you want me to broadcast.')

                inConvo = 2

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

                selfSay('Perhaps tomorrow then..')

                if (next_focus > 0 and getDistanceToCreature(next_focus) < 4) then

                    selfSay(msgHi)

                    talk_start = os.clock()

                    focus = next_focus

                    next_focus = 0

                    inConvo = 1

                else

                    focus = 0

                    talk_start = 0

                    inConvo = 0

                end

                broadcast = ''

            elseif (inConvo == 2 and (msg ~= 'stop')) then

                if (string.len(msg) > 90) then

                    selfSay('I am sorry, but your message can not be longer than 90 letters, including spaces and other characters. Say a new message or say STOP to end.')

                else

                    broadcast = msg2

                    selfSay('Do you want to pay '..price..' gold for me to broadcast this message? "'..broadcast..'"')

                    inConvo = 3

                end

            elseif (msgcontains(msg, 'yes') and inConvo == 3) then

                if (pay(cid, price)) then

                    selfSay('/B '..creatureGetName(cid)..' says: '..broadcast)

                    saycast = os.clock()

                    inConvo = 1

                   

                    io.output(io.open("broadcast.log", "a"))

                    io.write("["..os.date("%y.%m.%d %X").."] <"..creatureGetName(cid).."> "..broadcast.."\n")

                    io.close()

                    cast = broadcast

                else

                    selfSay('You can not afford this service. Please come back another time when you have more money!')

                    if (next_focus > 0) then

                        distFocus = getDistanceToCreature(next_focus)

                        if (distFocus ~= nil and distFocus < 4) then

                            selfSay(msgHi)

                            talk_start = os.clock()

                            focus = next_focus

                            next_focus = 0

                            inConvo = 1

                        else

                            focus = 0

                            talk_start = 0

                            inConvo = 0

                        end

                        broadcast = ''

                    end

                end

            elseif (msgcontains(msg, 'no') and inConvo == 3) then

                selfSay('Ok then.')

                inConvo = 0

                broadcast = ''

            elseif (string.find(msg, '(%a*)job(%a*)')) then

                selfSay('Oh, I am just sitting around here and gamble now and then.')

                inConvo = 0

            elseif (string.find(msg, '(%a*)bye(%a*)')) then

                selfSay(msgBye)

                if (next_focus > 0) then

                    distFocus = getDistanceToCreature(next_focus)

                    if (distFocus ~= nil and distFocus < 4) then

                        selfSay(msgHi)

                        talk_start = os.clock()

                        focus = next_focus

                        next_focus = 0

                        inConvo = 1

                    else

                        focus = 0

                        talk_start = 0

                        inConvo = 0

                    end

                    broadcast = ''

                end

            end

        end

    end

end

function onCreatureChangeOutfit(creature)

end

function onThink()

    if (cast ~= '' and (os.clock() - saycast) > 1) then

        selfSay('Do you want to broadcast anything else?')

        cast = ''

    elseif (os.clock() - talk_start) > 30 then

        if (focus > 0) then   

            selfSay(msgBye)

            if (next_focus > 0) then

                distFocus = getDistanceToCreature(next_focus)

                if (distFocus ~= nil and distFocus < 4) then

                    selfSay(msgHi)

                    talk_start = os.clock()

                    focus = next_focus

                    next_focus = 0

                    inConvo = 1

                else

                    focus = 0

                    talk_start = 0

                    inConvo = 0

                end

            else

                focus = 0

                talk_start = 0

                inConvo = 0

            end

            broadcast = ''

        end

    elseif (focus ~= 0) then

        distFocus = getDistanceToCreature(focus)

        if (distFocus ~= nil and distFocus > 5) then

            selfSay(msgBye)

            if (next_focus > 0) then

                distFocus = getDistanceToCreature(next_focus)

                if (distFocus ~= nil and distFocus < 4) then

                    selfSay(msgHi)

                    talk_start = os.clock()

                    focus = next_focus

                    next_focus = 0

                    inConvo = 1

                end

            else

                focus = 0

                talk_start = 0

                inConvo = 0

            end

            broadcast = ''

        end

    end

end

explicando:

em

price = 2500

vc muda o preço q o player vai pagar

se kiser mude as falas

o code é complexo

+ util

um exemplo de conversa:

21:52 Isaac Brewton: Heylo

21:52 Broadcaster: Heylo! Would you like to broadcast anything?

21:52 Isaac Brewton: Yes

21:52 Broadcaster: Tell me what you want me to broadcast.

21:52 Isaac Brewton: Hello there Rookira!

21:52 Broadcaster: Do you want to pay 2500 gold for me to broadcast this message? "Hello there Rookira!"

21:52 Isaac Brewton: Yes

21:52 Broadcaster: Isaac Brewton says: Hello there Rookira!

21:52 Broadcaster: Do you want to broadcast anything else?

21:52 Isaac Brewton: No thanks

21:52 Broadcaster: Perhaps tomorrow then..

isso

flws :bye:

Aposentado de OTserver e Tibia

Meus melhores tutoriais
Enciclopédia Pasta Data
Tutorial de quest

Rocksody

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/09/06Posts: 66

Testado e aprovado! Execelente npc! Valeu mesmo! Otimo tutor!

Abco,

Aizen

Retired de tibia nao do xtibia...
Jogando Hero Online,
abco!

Fo0u

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/06/06Posts: 32

copiasse isso daonde?

Hiami

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 09/01/06Posts: 15

Num gostei!!!!

se vc manda ele fazer comandos de gm ele feiz ¬¬

server q tem comando /giveexp os players fikariam la ganhando xp absurda.

ow entaum server q tem bicho de exp...

A afirmação abaixo é falsa!!!
A afirmação acima é verdadeira!!!

<a href="http://www.danasoft.com"><img src="http://www.danasoft.com/sig/paparepipopu.jpg" border="0"></a><div style="font-family:arial,sans-serif;font-size:11px;"><p>Sign by Dealighted - <a href="http://www.dealighted.com">Coupons and Deals</a></p></div>

PORTELINHA

Server de sucesso :)
5x xp
100x skills e ml

Sistema de vips
<a href="http://portelinha.servegame.com" target="_blank">http://portelinha.servegame.com</a> <<<< :)

Rocksody

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 23/09/06Posts: 66

simplismente arrume o acesso dele para 1 e tire os comandos desse acesso, deixe somente /B

abco

aizen

Retired de tibia nao do xtibia...
Jogando Hero Online,
abco!

Sky Hunter

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 03/10/06Posts: 227

Essa desgraça de npc não divulga o se manda ele falar, parece uma porta de tão mudo. =/

[Usuário banido por comportamento destrutivo]

juninhodd

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 29/05/06Posts: 7

Bom trabalho! :bigsmile:

Meu Fotolog
Orkut

"DESLIGUE SEU CAPS-LOCK AO POSTAR, ISSO DA NOS NERVOS"
"Naum fali com U nu finalzinhu das palavras, eh afeminadu dimais"
"Naum ixkrevah dexii jeituhh, faix cum quih a pexoa quih leiah penxi quih voxe eh retardaduh "
"Naum exagere ^^ nos smiles ;0 isso =X perturba xD a pessoa \o/ que ò.Ó ta =/ lendo x.x"
"N.E.N.A.M.G.N.S.O.Q.V.Q.D , Nao exagere na abreviação, muita gente nao sabe o que voce quer dizer"
"Cuidado con o anaufabetizmo, ce nun çabe ezcreve, vouta pra ezcola"



user posted image



[x]Aprendiz: 1 Post
[ ]Caçador: 150 Posts
[ ]Herói: 350 Posts
[ ]Nobre: 500 Posts
[ ]Sacerdote: 750 Posts
[ ]Aristocrata: 1000 Posts
[ ]Imperador: 2000 Posts

skynagerloas

Ex-Moderador
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 13/11/05Posts: 715Char no Tibia: Lord'Skyxt

Tópico contendo somente 1 NpC,

essa seção é para DataPacks com 3 ou mais Npcs,

~o{Tópico Movido}o~,

Abraços.

Atenciosamente, Sky - Lord'Skyxt;

 

Antes de postar, leia isso:



Regras.

[Lord'SkyXT] [FloGão]