Npc que troca Hitmonlee por Elite
5 participantes
Página 1 de 1
Npc que troca Hitmonlee por Elite
Esse Npc serve para fazer a troca de 1 Hitmonlee + 200k por 1 Elite hitmonlee, igualmente para o hitmonchan so que por Elite Hitmonchan.
Abra a pasta Data\Npc\Script crie 1 arquivo .LUA chamado elitenpc e coloquei isso dentro:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local talkState = {}
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye sir!')
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 sellPokemon(cid, name, price)
local pokename = name
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
local itemsball = getItemsInContainerById(bp.uid, 2222)
local itemsultra = getItemsInContainerById(bp.uid, 2220)
for _, pok in pairs(itemsball) do
if string.lower(getItemAttribute(pok, "poke"):sub(9, findLetter(getItemAttribute(pok, "poke"), "'")-1)) == pokename then
if(doPlayerRemoveMoney(cid, 20000000)) then
doRemoveItem(pok, 1)
local health = 7800 -- Health do poke
local maxhealth = 7800 -- Maximo de health do poke
local description = "Contains a Elite Hitmonlee."
local poke1 = "This is Elite Hitmonlee's pokeball. HP = ["..health.."/"..maxhealth.."]"
item = doCreateItemEx(2219)
doItemSetAttribute(item, "poke", poke1)
doItemSetAttribute(item, "nome", "Elite Hitmonlee")
doItemSetAttribute(item, "description", description)
doPlayerAddItemEx(cid, item, true)
doTransformItem(item, 2222)
selfSay('Thank You for letting me train him.')
return true
end
end
end
for _, pok in pairs(itemsultra) do
if string.lower(getItemAttribute(pok, "poke"):sub(9, findLetter(getItemAttribute(pok, "poke"), "'")-1)) == pokename then
if(doPlayerRemoveMoney(cid, 20000000)) then
doRemoveItem(pok, 1)
local health = 7800 -- Health do poke
local maxhealth = 7800 -- Maximo de health do poke
local description = "Contains a Elite Hitmonlee."
local poke1 = "This is Elite Hitmonlee's pokeball. HP = ["..health.."/"..maxhealth.."]"
item = doCreateItemEx(2219)
doItemSetAttribute(item, "poke", poke1)
doItemSetAttribute(item, "nome", "Elite Hitmonlee")
doItemSetAttribute(item, "description", description)
doPlayerAddItemEx(cid, item, true)
doTransformItem(item, 2220)
selfSay('Thank You for letting me train him.')
return true
end
end
end
selfSay('Hey, you do not have that pokemon or the amount of money we agreed!')
end
function sellPokemonn(cid, name, price)
local pokename = name
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
local itemsball = getItemsInContainerById(bp.uid, 2222)
local itemsultra = getItemsInContainerById(bp.uid, 2220)
for _, pok in pairs(itemsball) do
if string.lower(getItemAttribute(pok, "poke"):sub(9, findLetter(getItemAttribute(pok, "poke"), "'")-1)) == pokename then
if(doPlayerRemoveMoney(cid, 20000000)) then
doRemoveItem(pok, 1)
local health = 7800 -- Health do poke
local maxhealth = 7800 -- Maximo de health do poke
local description = "Contains a Elite Hitmonchan."
local poke1 = "This is Elite Hitmonchan's pokeball. HP = ["..health.."/"..maxhealth.."]"
item = doCreateItemEx(2219)
doItemSetAttribute(item, "poke", poke1)
doItemSetAttribute(item, "nome", "Elite Hitmonchan")
doItemSetAttribute(item, "description", description)
doPlayerAddItemEx(cid, item, true)
doTransformItem(item, 2222)
selfSay('Thank You for letting me train him.')
return true
end
end
end
for _, pok in pairs(itemsultra) do
if string.lower(getItemAttribute(pok, "poke"):sub(9, findLetter(getItemAttribute(pok, "poke"), "'")-1)) == pokename then
if(doPlayerRemoveMoney(cid, 20000000)) then
doRemoveItem(pok, 1)
local health = 7800 -- Health do poke
local maxhealth = 7800 -- Maximo de health do poke
local description = "Contains a Elite Hitmonchan."
local poke1 = "This is Elite Hitmonchan's pokeball. HP = ["..health.."/"..maxhealth.."]"
item = doCreateItemEx(2219)
doItemSetAttribute(item, "poke", poke1)
doItemSetAttribute(item, "nome", "Elite Hitmonchan")
doItemSetAttribute(item, "description", description)
doPlayerAddItemEx(cid, item, true)
doTransformItem(item, 2220)
selfSay('Thank You for letting me train him.')
return true
end
end
end
selfSay('Hey, you do not have that pokemon or the amount of money we agreed!')
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if (msgcontains(msg, 'bye') and focus == cid) then
selfSay('See you around then!')
focus = 0
elseif (msgcontains(msg, 'hi') and (focus == 0) and (focus ~= cid) and (getDistanceToCreature(cid) <= 4)) then selfSay('Welcome! I train pokemons fighters, you have a fighter pokemon?.') focus = cid talkState[talkUser] = 1 talk_start = os.clock() elseif (msgcontains(msg, 'machamp') and talkState[talkUser] == 1 and focus == cid) then selfSay('It is impossible to defend against punches and chops distributed by his four arms. It has a great fighting spirit.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] == 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'machoke') and talkState[talkUser] == 1 and focus == cid) then selfSay('It has a powerful body, uses a belt to power savings to regulate their movements.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] == 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'machop') and talkState[talkUser] == 1 and focus == cid) then selfSay('A very good pokemon for intense workouts, has a great facility to master all forms of martial arts.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] ~= 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'poliwrath') and talkState[talkUser] == 1 and focus == cid) then selfSay('Has developed muscles, the muscles used for quick attacks despite being in the water.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] == 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'primeape') and talkState[talkUser] == 1 and focus == cid) then selfSay('An angry pokemon. gets even more furious when he lost a fight.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] == 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'hitmonlee') and talkState[talkUser] == 1 and focus == cid) then selfSay('Interesting! Is a pokemon with legs fast and hard, has devastating kicks. Always wanted to train one of these, if you want I can train him for a sum of 200k. Accepted?') talkState[talkUser] = "hitmonlee" elseif (msgcontains(msg, 'yes') and talkState[talkUser] == "hitmonlee" and focus == cid) then sellPokemon(cid, "hitmonlee", 1) talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'hitmonchan') and talkState[talkUser] == 1 and focus == cid) then selfSay('Is a great boxer, a man who never gives up. I always wanted to train one of these. For an amount of 200k I can transform it into a great boxer. Accepted?') talkState[talkUser] = "hitmonchan" elseif (msgcontains(msg, 'yes') and talkState[talkUser] == "hitmonchan" and focus == cid) then sellPokemonn(cid, "hitmonchan", 1) talkState[talkUser] = 1 end end function onThink() if focus == 0 then selfTurn(1) else argx, argy, argz = selfGetPosition() dir = getDirectionTo({x=argx,y=argy,z=argz}, getThingPos(focus)) if dir == 7 then dir = 0 elseif dir == 6 then dir = 3 elseif dir == 5 then dir = 1 elseif dir == 4 then dir = 3 end selfTurn(dir) end if (os.clock() - talk_start) > 59 then
if focus ~= 0 then
selfSay('We have been talking for too much time!')
focus = 0
end
end
if focus ~= 0 then
a, b, c = selfGetPosition()
if c ~= getThingPos(focus).z then
focus = 0
end
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 4 then
selfSay('Come back to sell me pokemons!')
focus = 0
end
end
return true
end
Depois vá em Data/Npc crie 1 arquivo xml e adicione isso dentro:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Raviel" script="elitenpc.lua" walkinterval="350000" floorchange="0" speed="0">
<health now="150" max="150"/>
<look type="313"/>
<parameters>
<parameter key="message_greet" value="Welcome! I train pokemons fighters, you have a fighter pokemon?"/>
<parameter key="message_farewell" value="Bye."/>
<parameter key="message_idletimeout" value="Bye."/>
<parameter key="message_walkaway" value="Bye."/>
</parameters>
</npc>
Para trocar o preço ,basta voce abrir preucurar no script por (doPlayerRemoveMoney(cid, 20000000)) e mudar o 20000000 , para o seu preço.
E não esqueça de colocar o nome do arquivo .LUA que voce criou no Data\Npc\Script de elitenpc , se não ,não vai funcionar.
Ex: O npc ira perguntar se vc tem algum pokemon do tipo lutador.
Se falar Hitmonlee ow Hitmonchan ele dará uma breve descrição deles , e fala que sempre teve vontade de treinar 1 desses.
Ai eh só o player fala Yes com 1 desses 2 pokes na bag + 200k e pronto.
Com os outros pokes , ele soh irar falar sobre eles
Obs: Os scripts estão em Azul e não reparem se meu topico ficou desorganizado pois e meu primeiro topico espero que compreendão
Creditos: Otserver Mania 80% (por criar a script)
Eu:20% (por divulgar a script no forum)
Abra a pasta Data\Npc\Script crie 1 arquivo .LUA chamado elitenpc e coloquei isso dentro:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
local talkState = {}
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye sir!')
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 sellPokemon(cid, name, price)
local pokename = name
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
local itemsball = getItemsInContainerById(bp.uid, 2222)
local itemsultra = getItemsInContainerById(bp.uid, 2220)
for _, pok in pairs(itemsball) do
if string.lower(getItemAttribute(pok, "poke"):sub(9, findLetter(getItemAttribute(pok, "poke"), "'")-1)) == pokename then
if(doPlayerRemoveMoney(cid, 20000000)) then
doRemoveItem(pok, 1)
local health = 7800 -- Health do poke
local maxhealth = 7800 -- Maximo de health do poke
local description = "Contains a Elite Hitmonlee."
local poke1 = "This is Elite Hitmonlee's pokeball. HP = ["..health.."/"..maxhealth.."]"
item = doCreateItemEx(2219)
doItemSetAttribute(item, "poke", poke1)
doItemSetAttribute(item, "nome", "Elite Hitmonlee")
doItemSetAttribute(item, "description", description)
doPlayerAddItemEx(cid, item, true)
doTransformItem(item, 2222)
selfSay('Thank You for letting me train him.')
return true
end
end
end
for _, pok in pairs(itemsultra) do
if string.lower(getItemAttribute(pok, "poke"):sub(9, findLetter(getItemAttribute(pok, "poke"), "'")-1)) == pokename then
if(doPlayerRemoveMoney(cid, 20000000)) then
doRemoveItem(pok, 1)
local health = 7800 -- Health do poke
local maxhealth = 7800 -- Maximo de health do poke
local description = "Contains a Elite Hitmonlee."
local poke1 = "This is Elite Hitmonlee's pokeball. HP = ["..health.."/"..maxhealth.."]"
item = doCreateItemEx(2219)
doItemSetAttribute(item, "poke", poke1)
doItemSetAttribute(item, "nome", "Elite Hitmonlee")
doItemSetAttribute(item, "description", description)
doPlayerAddItemEx(cid, item, true)
doTransformItem(item, 2220)
selfSay('Thank You for letting me train him.')
return true
end
end
end
selfSay('Hey, you do not have that pokemon or the amount of money we agreed!')
end
function sellPokemonn(cid, name, price)
local pokename = name
local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
local itemsball = getItemsInContainerById(bp.uid, 2222)
local itemsultra = getItemsInContainerById(bp.uid, 2220)
for _, pok in pairs(itemsball) do
if string.lower(getItemAttribute(pok, "poke"):sub(9, findLetter(getItemAttribute(pok, "poke"), "'")-1)) == pokename then
if(doPlayerRemoveMoney(cid, 20000000)) then
doRemoveItem(pok, 1)
local health = 7800 -- Health do poke
local maxhealth = 7800 -- Maximo de health do poke
local description = "Contains a Elite Hitmonchan."
local poke1 = "This is Elite Hitmonchan's pokeball. HP = ["..health.."/"..maxhealth.."]"
item = doCreateItemEx(2219)
doItemSetAttribute(item, "poke", poke1)
doItemSetAttribute(item, "nome", "Elite Hitmonchan")
doItemSetAttribute(item, "description", description)
doPlayerAddItemEx(cid, item, true)
doTransformItem(item, 2222)
selfSay('Thank You for letting me train him.')
return true
end
end
end
for _, pok in pairs(itemsultra) do
if string.lower(getItemAttribute(pok, "poke"):sub(9, findLetter(getItemAttribute(pok, "poke"), "'")-1)) == pokename then
if(doPlayerRemoveMoney(cid, 20000000)) then
doRemoveItem(pok, 1)
local health = 7800 -- Health do poke
local maxhealth = 7800 -- Maximo de health do poke
local description = "Contains a Elite Hitmonchan."
local poke1 = "This is Elite Hitmonchan's pokeball. HP = ["..health.."/"..maxhealth.."]"
item = doCreateItemEx(2219)
doItemSetAttribute(item, "poke", poke1)
doItemSetAttribute(item, "nome", "Elite Hitmonchan")
doItemSetAttribute(item, "description", description)
doPlayerAddItemEx(cid, item, true)
doTransformItem(item, 2220)
selfSay('Thank You for letting me train him.')
return true
end
end
end
selfSay('Hey, you do not have that pokemon or the amount of money we agreed!')
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if (msgcontains(msg, 'bye') and focus == cid) then
selfSay('See you around then!')
focus = 0
elseif (msgcontains(msg, 'hi') and (focus == 0) and (focus ~= cid) and (getDistanceToCreature(cid) <= 4)) then selfSay('Welcome! I train pokemons fighters, you have a fighter pokemon?.') focus = cid talkState[talkUser] = 1 talk_start = os.clock() elseif (msgcontains(msg, 'machamp') and talkState[talkUser] == 1 and focus == cid) then selfSay('It is impossible to defend against punches and chops distributed by his four arms. It has a great fighting spirit.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] == 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'machoke') and talkState[talkUser] == 1 and focus == cid) then selfSay('It has a powerful body, uses a belt to power savings to regulate their movements.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] == 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'machop') and talkState[talkUser] == 1 and focus == cid) then selfSay('A very good pokemon for intense workouts, has a great facility to master all forms of martial arts.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] ~= 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'poliwrath') and talkState[talkUser] == 1 and focus == cid) then selfSay('Has developed muscles, the muscles used for quick attacks despite being in the water.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] == 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'primeape') and talkState[talkUser] == 1 and focus == cid) then selfSay('An angry pokemon. gets even more furious when he lost a fight.') elseif (msgcontains(msg, 'thx') and talkState[talkUser] == 1 and focus == cid) then selfSay('Its nothing, tell me if you need something more.') talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'hitmonlee') and talkState[talkUser] == 1 and focus == cid) then selfSay('Interesting! Is a pokemon with legs fast and hard, has devastating kicks. Always wanted to train one of these, if you want I can train him for a sum of 200k. Accepted?') talkState[talkUser] = "hitmonlee" elseif (msgcontains(msg, 'yes') and talkState[talkUser] == "hitmonlee" and focus == cid) then sellPokemon(cid, "hitmonlee", 1) talkState[talkUser] = 1 ---------------------------------------------------------------- elseif (msgcontains(msg, 'hitmonchan') and talkState[talkUser] == 1 and focus == cid) then selfSay('Is a great boxer, a man who never gives up. I always wanted to train one of these. For an amount of 200k I can transform it into a great boxer. Accepted?') talkState[talkUser] = "hitmonchan" elseif (msgcontains(msg, 'yes') and talkState[talkUser] == "hitmonchan" and focus == cid) then sellPokemonn(cid, "hitmonchan", 1) talkState[talkUser] = 1 end end function onThink() if focus == 0 then selfTurn(1) else argx, argy, argz = selfGetPosition() dir = getDirectionTo({x=argx,y=argy,z=argz}, getThingPos(focus)) if dir == 7 then dir = 0 elseif dir == 6 then dir = 3 elseif dir == 5 then dir = 1 elseif dir == 4 then dir = 3 end selfTurn(dir) end if (os.clock() - talk_start) > 59 then
if focus ~= 0 then
selfSay('We have been talking for too much time!')
focus = 0
end
end
if focus ~= 0 then
a, b, c = selfGetPosition()
if c ~= getThingPos(focus).z then
focus = 0
end
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 4 then
selfSay('Come back to sell me pokemons!')
focus = 0
end
end
return true
end
Depois vá em Data/Npc crie 1 arquivo xml e adicione isso dentro:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Raviel" script="elitenpc.lua" walkinterval="350000" floorchange="0" speed="0">
<health now="150" max="150"/>
<look type="313"/>
<parameters>
<parameter key="message_greet" value="Welcome! I train pokemons fighters, you have a fighter pokemon?"/>
<parameter key="message_farewell" value="Bye."/>
<parameter key="message_idletimeout" value="Bye."/>
<parameter key="message_walkaway" value="Bye."/>
</parameters>
</npc>
Para trocar o preço ,basta voce abrir preucurar no script por (doPlayerRemoveMoney(cid, 20000000)) e mudar o 20000000 , para o seu preço.
E não esqueça de colocar o nome do arquivo .LUA que voce criou no Data\Npc\Script de elitenpc , se não ,não vai funcionar.
Ex: O npc ira perguntar se vc tem algum pokemon do tipo lutador.
Se falar Hitmonlee ow Hitmonchan ele dará uma breve descrição deles , e fala que sempre teve vontade de treinar 1 desses.
Ai eh só o player fala Yes com 1 desses 2 pokes na bag + 200k e pronto.
Com os outros pokes , ele soh irar falar sobre eles
Obs: Os scripts estão em Azul e não reparem se meu topico ficou desorganizado pois e meu primeiro topico espero que compreendão
Creditos: Otserver Mania 80% (por criar a script)
Eu:20% (por divulgar a script no forum)
Última edição por [PS]Killer em Sex Jun 15, 2012 4:57 pm, editado 1 vez(es)
Re: Npc que troca Hitmonlee por Elite
Cara isso foi voce mesmo que fez ?
Eu vi um igualzim em outro site.
Se nao foi voce poste os devidos creditos.
Eu vi um igualzim em outro site.
Se nao foi voce poste os devidos creditos.
Re: Npc que troca Hitmonlee por Elite
sim cara coloque os creditos
msm assim vou te dar um +
msm assim vou te dar um +
Reyiu- Membro
- Mensagens : 11
Placar : 17
Data de inscrição : 09/06/2011
Re: Npc que troca Hitmonlee por Elite
no site n ta os creditos mais vou tentar descobrie pois duplicar post e crime então irei preocurar os creditos e postar
@ Topico editado espero ter Ajudado Muito obrigado pelo alerta
@ Topico editado espero ter Ajudado Muito obrigado pelo alerta
Devidos creditos colocados
Xisto escreveu:Cara isso foi voce mesmo que fez ?
Eu vi um igualzim em outro site.
Se nao foi voce poste os devidos creditos.
Queria te informar que ja pus os devidos creditos e agradeço pelo seu alerta muito obrigado
Re: Npc que troca Hitmonlee por Elite
bom cara esse npc n funfa no meu server, como vc pego de otro site vc tb n deve sabe edita nda, porem se puder eu gostaria que voce me mostrasse na script aond é o id da bag e o id da ball q no meu server é diferente.
ja q vc posto aki vc deve sabe edita pq se n soube uq adianta divulga se vc n sabe edita e passa pros outros??
ja q vc posto aki vc deve sabe edita pq se n soube uq adianta divulga se vc n sabe edita e passa pros outros??
095455- Novato
- Mensagens : 6
Placar : 6
Data de inscrição : 03/07/2012
Re: Npc que troca Hitmonlee por Elite
Bag;
Ball;
local itemsball = getItemsInContainerById(bp.uid, 2222)
local itemsultra = getItemsInContainerById(bp.uid, 2220)
local itemsball = getItemsInContainerById(bp.uid, 2222)
local itemsultra = getItemsInContainerById(bp.uid, 2220)
Ball;
item = doCreateItemEx(2219)
Aott- Membro
- Mensagens : 17
Placar : 34
Data de inscrição : 29/04/2011
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|