Ir para conteúdo

[ Fechado ]


lukina

Posts Recomendados

Npc 1 : copie qualquer arquivo e renomeio para Rodolfo e cole isto:

 

vip city = {x=280, y=86, z=4}

ice island = {x=561, y=53, z=7}

 

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

 

function onThingMove(creature, thing, oldpos, oldstackpos, cid, item, frompos, item2, topos)

 

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('Hiho ' .. getCreatureName(cid) .. '! Eu posso te levar para Vip City,Ice Island. Lembrando que a viagem custa 50 gps.')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'vip city') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,vip city)

doSendMagicEffect(vip city,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

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

end

 

elseif msgcontains(msg, 'ice island') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,ice island)

doSendMagicEffect(ice island,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

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

end

 

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

selfSay('Adeus ' .. creatureGetName(cid) .. ', Volte Sempre.')

focus = 0

talk_start = 0

 

elseif msg ~= "" then

selfSay('Como? Eu não entendi!')

talk_state = 0

end

end

end

 

function onCreatureChangeOutfit(creature)

end

 

function onThink()

doNpcSetCreatureFocus(focus)

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

if focus > 0 then

selfSay('Proximo!!...')

end

focus = 0

talk_start = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good Bye')

focus = 0

talk_start = 0

end

end

end

 

em xml copie qualquer arquivo renomeio para Rodolfo e cole isto:

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Capitao Rodolfo" script="data/npc/scripts/Rodolfo.lua" walkinterval="2000" floorchange="0">

<health now="100" max="100"/>

<look type="132" head="20" body="39" legs="45" feet="7" addons="0"/>

<parameters>

<parameter key="module_keywords" value="1" />

<parameter key="keywords" value="hi" />

<parameter key="keyword_reply1" value="Hello!." />

</parameters>

</npc>

 

NPC 2: copie qualquer arquivo e renomeio para Andre e cole isto:

 

jungle = {x=132, y=175, z=7}

ilha perdida = {x=174, y=173, z=7}

 

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

 

function onThingMove(creature, thing, oldpos, oldstackpos, cid, item, frompos, item2, topos)

 

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('Hiho ' .. getCreatureName(cid) .. '! Eu posso te levar para Jungle City e Ilha perdida. Lembrando que a viagem custa 50 gps.')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'jungle') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,jungle)

doSendMagicEffect(jungle,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

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

end

 

elseif msgcontains(msg, 'ilha perdida') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,ilha perdida)

doSendMagicEffect(ilha perdida,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

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

end

 

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

selfSay('Adeus ' .. creatureGetName(cid) .. ', Volte Sempre.')

focus = 0

talk_start = 0

 

elseif msg ~= "" then

selfSay('Como? Eu não entendi!')

talk_state = 0

end

end

end

 

function onCreatureChangeOutfit(creature)

end

 

function onThink()

doNpcSetCreatureFocus(focus)

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

if focus > 0 then

selfSay('Proximo!!...')

end

focus = 0

talk_start = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good Bye')

focus = 0

talk_start = 0

end

end

end

 

em xml copie qualquer arquivo renomeio para Andre e cole isto:

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Capitao Andre" script="data/npc/scripts/Andre.lua" walkinterval="2000" floorchange="0">

<health now="100" max="100"/>

<look type="132" head="20" body="39" legs="45" feet="7" addons="0"/>

<parameters>

<parameter key="module_keywords" value="1" />

<parameter key="keywords" value="hi" />

<parameter key="keyword_reply1" value="Hello!." />

</parameters>

</npc>

Editado por lucasatak
Link para o comentário
Compartilhar em outros sites

esse de cima nao funcinou aqui

 

teste esse:

 

Capitao Frius.xml

<npc name="Capitao Frius" script="data/npc/scripts/boatfree.lua" floorchange="0" access="5" level="1" maglevel="1">

<health now="150" max="150"/>

<look type="151" head="114" body="15" legs="80" feet="115" addons="2" corpse="2212"/>

<parameters>

<parameter key="module_travel" value="1"/>

<parameter key="message_greet" value="Hello |PLAYERNAME|. Do you wanna meet my ship rotes? If you say {travel}, I'll can help you!" />

<parameter key="travel_destinations" value="jungle city,132,175,7,500;ilha perdida,174,173,7,500"/>

</parameters>

</npc>

 

npc\scrippts boatfree.lua

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

npcHandler:addModule(FocusModule:new())

 

Npc vip:

 

Capitao Vip.xml

<npc name="Capitao Vip" script="data/npc/scripts/slum.lua" floorchange="0" access="5" level="1" maglevel="1">

<health now="150" max="150"/>

<look type="151" head="114" body="15" legs="80" feet="115" addons="2" corpse="2212"/>

<parameters>

<parameter key="module_travel" value="1"/>

<parameter key="message_greet" value="Hello |PLAYERNAME|. Do you wanna meet my ship rotes? If you say {travel}, I'll can help you!" />

<parameter key="travel_destinations" value="vip City,280,86,4,500;ice Island,561,53,7,500"/>

</parameters>

</npc>

 

npc\scripts slum.lua

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

npcHandler:addModule(FocusModule:new())

 

flw

Editado por Nicekid
Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...