Ir para conteúdo

[Arquivado]Trem Fantasma


Andre Miles

Posts Recomendados

Eae gente? Desenvolvi um script bem legal. Ele pega no Aries 0.4.0 (pelo menos foi a versão que eu testei) e funciona perfeitamente.

 

Envolvemos Npc, Monstros e Movements. Vou explicar como funciona:

 

Você chega lá, na entrada do trem fanstama, tem o nosso npc que toma conta. Diga para ele Hi, logo após Trem, Yes. Você será teletrasportado para dentro da pista com Looktype do carrinho. Mais e o Movements? Serve para virar o carrinho deacordo com as pistas.

 

NPC

Kasray.xml

 

<?xml version="1.0"?>

<npc name="Kasray" script="data/npc/scripts/trem.lua" access="3" lookdir="2">
<mana now="800000" max="80000"/>
<health now="200" max="200"/>
<look type="134" head="1" body="78" legs="97" feet="95"/>
</npc>

 

trem.lua

 

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) < 3 then
selfSay('Oi ' .. creatureGetName(cid) .. '!  Tah afim de dar uma voltinha com o medo? Diga Trem')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 3 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! Jah falo com vc em um minutinhu.')

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

if msgcontains(msg, 'trem') then
selfSay('Quer ir mesmo?')
talk_state = 1

elseif msgcontains(msg, 'sair') then
selfSay('Quer sair daqui?')
talk_state = 2 

elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
if pay(cid,0) then
[color="#0000FF"]travel(cid, 1122, 875, 6)[/color]
[color="#FF0000"]doSetSwimEffect(cid, "Carrinho2", 31536000000)[/color]
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_SOUND_WHITE)
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,0) then
[color="#2E8B57"]travel(cid, 998, 1080, 6)[/color]
[color="#FF0000"]doSetSwimEffect(cid, "Citizen", 10000)[/color]
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_SOUND_WHITE)
doPlayerSendTextMessage(cid,22,"Redefina seu outfit.")
else
selfSay('Sorry, you don\'t have enough money.')
end
end
talk_state = 0

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 3 then
selfSay('Tchau, ' .. 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('Afk man...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 3 then
selfSay('Tchau Tchau amigo.')
focus = 0
end
end
end

 

Em verde é a Saida do player, no meu eu coloquei pra ser teleportado devolta para o templo.

Em azul é a Entrada do player, ou seja, na pista.

Em vermelho é o nome do Monster que ele se transformará, não se precupe muito com isso, apenas mude o nome dele, se for apenas carrinho ele vai estar para cima, se for carrinho2 será virado para o lado

 

Monsters

 

Carrinho.xml

<?xml version="1.0"?>
 <monster name="Carrinho" race="undead" speed="0">
 <health now="150" max="150"/>
 <look typeex="7132"/>

 <flags>
 <flag pushable="0"/>
 <flag attackable="0"/>
 </flags>

 <attacks>
 <attack name="poison spit" speed="1000" chance="100" min="-100" max="-100"/>
 </attacks>

 </monster>

 

Carrinho2.xml

<?xml version="1.0"?>
 <monster name="Carrinho2" race="undead" speed="0">
 <health now="150" max="150"/>
 <look typeex="7131"/>

 <flags>
 <flag pushable="0"/>
 <flag attackable="0"/>
 </flags>

 <attacks>
 <attack name="poison spit" speed="1000" chance="100" min="-100" max="-100"/>
 </attacks>

 </monster>

 

Monsters.xml - Adicione isso

 

	<monster name="Carrinho" file="Carrinho.xml"/>
<monster name="Carrinho2" file="Carrinho2.xml"/>

 

Movements

 

trem_right.lua

function onStepIn(cid, item, position, fromPosition)
doSetSwimEffect(cid, "Carrinho2", 31536000000)

end

 

trem_up.lua

function onStepIn(cid, item, position, fromPosition)
doSetSwimEffect(cid, "Carrinho", 31536000000)

end

 

Movements.xml - Adicione isso

 

<movevent event="StepIn" itemid="7121" script="trem_up.lua"/>
<movevent event="StepIn" itemid="7122" script="trem_right.lua"/>

 

Bom, é isso! Espero que tenham gostado, comentem e me enviem PM se tiverem dúvidas.

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

  • Respostas 33
  • Created
  • Última resposta

Top Posters In This Topic

não intendi mto bem

tem quee por esse npc?

quando eu tento bota ele

aparece que nao consegue ler o trem.lua

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

Visitante
Este tópico está impedido de receber novos posts.

×
×
  • Criar Novo...