¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

NPC QUE VENDE MOUSTROS (7.6) BY DIEGO

Ir abajo

NPC QUE VENDE MOUSTROS (7.6) BY DIEGO Empty NPC QUE VENDE MOUSTROS (7.6) BY DIEGO

Mensaje por gmdiego5 Dom Mar 09, 2008 6:52 am

Jaja, weno, este fue un NPC que habia hecho para un OT 7.6, aunque creo que no hace falta modificarlo demasiado para que funcione sin bugs en versiones posteriores... ahi va:

data/npc/Dios.xml
Código:
<?xml version="1.0"?>
<npc name="Dios" script="data/npc/scripts/dios.lua" access="3">
<look type="128" head="4" body="114" legs="132" feet="115"/>
</npc>


data/npc/scripts/dios.lua
Código:
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
cname = ''

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Adios.')
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)
cname = creatureGetName(cid)
msg = string.lower(msg)

if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Hola ' .. creatureGetName(cid) .. '! Vendo dragones (100gp), heros (200gp), hydras (300gp) y demons (500gp) y orshabaals (1k).')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Lo siento, ' .. creatureGetName(cid) .. '! Te hablare en un momento.')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'dragon') then
level = getPlayerLevel(cname)

if level >= 15 then
if pay(cid,100) then
selfSay('/m dragon')
selfSay('Ahi tienes.')
else
selfSay('Lo siento, tu no tienes suficiente dinero.')
end
else
selfSay('Perdon, necesitas ser level 15 para que te de un dragon.')
talk_state = 0
end
elseif msgcontains(msg, 'hero') then
level = getPlayerLevel(cname)

if level >= 20 then
if pay(cid,200) then
selfSay('/m hero')
selfSay('Ahi tienes.')
else
selfSay('Lo siento, tu no tienes suficiente dinero.')
end
else
selfSay('Perdon, necesitas ser level 20 para que te de un hero.')
talk_state = 0
end
elseif msgcontains(msg, 'hydra') then
level = getPlayerLevel(cname)

if level >= 30 then
if pay(cid,300) then
selfSay('/m hydra')
selfSay('Ahi tienes.')
else
selfSay('Lo siento, tu no tienes suficiente dinero.')
end
else
selfSay('Perdon, necesitas ser level 30 para que te de un hydra.')
talk_state = 0
end
elseif msgcontains(msg, 'demon') then
level = getPlayerLevel(cname)

if level >= 40 then
if pay(cid,500) then
selfSay('/m demon')
selfSay('Ahi tienes.')
else
selfSay('Lo siento, tu no tienes suficiente dinero.')
end
else
selfSay('Perdon, necesitas ser level 40 para que te de un demon.')
talk_state = 0
end
elseif msgcontains(msg, 'orshabaal') then
level = getPlayerLevel(cname)

if level >= 50 then
if pay(cid,1000) then
selfSay('/m orshabaal')
selfSay('Ahi tienes.')
else
selfSay('Lo siento, tu no tienes suficiente dinero.')
end
else
selfSay('Perdon, necesitas ser level 50 para que te de un orshabaal.')
talk_state = 0
end

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Adios, ' .. 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('Siguiente por favor...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Adios.')
focus = 0
end
end
end



muy probable es que tengan problemas con las funciones que devuelven el lvl y por ahi los nmbres... no testee mi script en la 8.0... pero en la 7.6 andaba de maravilla ^^

salu2 ^^

BY:DIEGO
gmdiego5
gmdiego5
Posteador
Posteador

Masculino
Cantidad de envíos : 107
Edad : 29
Localización : Ciber
Humor : Muy happy :)
Fecha de inscripción : 09/03/2008

http://diegorap4.spaces.live.com/default.aspx?mkt=es-MX&partner=

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.