Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Olá TKbianos,

Descidi compartilhar a você o taming.lua, feito pelo Otland e explicado por mim...

Bem, o que ele faz ?

Simples, esse script da função a todos os itens de montaria (aqueles que servem para capturar o monstro)

Então, vamos lá !

XML code :

	<action itemid="13295" event="script" value="other/taming.lua"/> <!-- reins -->

	<action itemid="13294" event="script" value="other/taming.lua"/> <!-- harness -->

	<action itemid="13293" event="script" value="other/taming.lua"/> <!-- leather whip -->

	<action itemid="13298" event="script" value="other/taming.lua"/> <!-- carrot on a stick -->

	<action itemid="13247" event="script" value="other/taming.lua"/> <!-- hunting horn -->

	<action itemid="13305" event="script" value="other/taming.lua"/> <!-- giant shrimp -->

	<action itemid="13291" event="script" value="other/taming.lua"/> <!-- maxilla maximus -->

	<action itemid="5907" event="script" value="other/taming.lua"/> <!-- slingshot -->

	<action itemid="13307" event="script" value="other/taming.lua"/> <!-- sweet smelling bait -->

	<action itemid="13292" event="script" value="other/taming.lua"/> <!-- tin key -->

	<action itemid="13938" event="script" value="other/taming.lua"/> <!-- golden can of oil -->

	<action itemid="13939" event="script" value="other/taming.lua"/> <!-- sugar oat -->

	<action itemid="13508" event="script" value="other/taming.lua"/> <!-- slug drug -->

	<action itemid="13535" event="script" value="other/taming.lua"/> <!-- fist on a stick -->

	<action itemid="13536" event="script" value="other/taming.lua"/> <!-- diapason -->

	<action itemid="13537" event="script" value="other/taming.lua"/> <!-- bag of apple slices -->

	<action itemid="13538" event="script" value="other/taming.lua"/> <!-- bamboo leaves -->

	<action itemid="13539" event="script" value="other/taming.lua"/> <!-- golden fir cone -->

	<action itemid="13498" event="script" value="other/taming.lua"/> <!-- scorpion sceptre -->
Crie um arquivo lua chamado : taming.lua e bote dentro da pasta other e botei isso:

local ACTION_RUN, ACTION_BREAK, ACTION_NONE, ACTION_ALL = 1, 2, 3, 4

local TYPE_MONSTER, TYPE_NPC, TYPE_ACTION, TYPE_UNIQUE = 1, 2, 3, 4

local config = {

[5907] =  {NAME = 'Bear',	 ID = 3,  TYPE = TYPE_MONSTER,  CHANCE = 20,  FAIL_MSG = { {1, "The bear ran away."}, {2, "Oh no! The slingshot broke."}, {3, "The bear is trying to hit you with its claws."} }, SUCCESS_MSG = "You have tamed the bear."},

[13295] =  {NAME = 'Black Sheep',	ID = 4,  TYPE = TYPE_MONSTER,  CHANCE = 25,  FAIL_MSG = { {1, "The black sheep ran away."}, {2, "Oh no! The reins were torn."}, {3, "The black sheep is trying to run away."} }, SUCCESS_MSG = "You have tamed the sheep."},

[13293] =  {NAME = 'Midnight Panther',  ID = 5,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The panther has escaped."}, {2, "The whip broke."} }, SUCCESS_MSG = "You have tamed the panther."},

[13298] =  {NAME = 'Terror Bird',	ID = 2,  TYPE = TYPE_MONSTER,  CHANCE = 15,  FAIL_MSG = { {1, "The bird ran away."}, {3, "The terror bird is pecking you."} }, SUCCESS_MSG = "You have tamed the bird."},

[13247] =  {NAME = 'Boar',	 ID = 10,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The boar has run away"}, {3, "The boar attacks you."} }, SUCCESS_MSG = "You have tamed the boar."},

[13305] =  {NAME = 'Crustacea Gigantica',  ID = 7,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The crustacea has run away."}, {2, "The crustacea ate the shrimp."} }, SUCCESS_MSG = "You have tamed the crustacea."},

[13291] =  {NAME = 'Undead Cavebear',   ID = 12,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The undead bear has run away."} }, SUCCESS_MSG = "You have tamed the skeleton."},

[13307] =  {NAME = 'Wailing Widow',   ID = 1,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The widow has run away."}, {2, "The widow has eaten the sweet bait."} }, SUCCESS_MSG = "You have tamed the widow."},

[13292] =  {NAME = 'Tin Lizzard',	ID = 8,  TYPE = TYPE_NPC,   CHANCE = 40,  FAIL_MSG = { {2, "The key broke inside."} }, SUCCESS_MSG = "You have started the Tin Lizzard!"},

[13294] =  {NAME = 'Draptor',	 ID = 6,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The draptor has run away."}, {3, "The draptor has fled."} }, SUCCESS_MSG = "You have tamed the draptor."},

[13536] =  {NAME = 'Crystal Wolf',   ID = 16,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The wolf has run away."} }, SUCCESS_MSG = "You have tamed the wolf."},

[13539] =  {NAME = 'White Deer',	ID = 18,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {2, "The cone broke."}, {3, "The deer has fled in fear."} }, SUCCESS_MSG = "You have tamed the deer."},

[13538] =  {NAME = 'Panda',	 ID = 19,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {4, "Panda ate the leaves and ran away."} }, SUCCESS_MSG = "You have tamed the panda."},

[13535] =  {NAME = 'Dromedary',	ID = 20,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "Dromedary has run away."} }, SUCCESS_MSG = "You have tamed the dromedary."},

[13498] =  {NAME = 'Sandstone Scorpion',   ID = 21,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The scorpion has vanished."}, {2, "Scorpion broken the sceptre."} }, SUCCESS_MSG = "You have tamed the scorpion"},

[13537] =  {NAME = 'Donkey',	 ID = 13,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The witch has escaped!"} }, SUCCESS_MSG = "You have tamed the mule."},

[13938] =  {NAME = 'Uniwheel',	ID = 15,  TYPE = TYPE_NPC,   CHANCE = 40,  FAIL_MSG = { {2, "The oil is having no effect."} }, SUCCESS_MSG = "You have found an Uniwheel."},

[13508] =  {NAME = 'Slug',	 ID = 14,  TYPE = TYPE_MONSTER,  CHANCE = 40,  FAIL_MSG = { {1, "The slug has run away."}, {3, "The drug had no effect."} }, SUCCESS_MSG = "You have tamed the slug."},

[13939] =  {NAME = 'War Horse',	ID = 23,  TYPE = TYPE_MONSTER,  CHANCE = 15,  FAIL_MSG = { {1, "The horse runs away."}, {2, "The horse ate the oats."} }, SUCCESS_MSG = "You have tamed the horse."}

}

local function doFailAction(cid, mount, pos, item, itemEx)

local action, effect = mount.FAIL_MSG[math.random(1, table.maxn(mount.FAIL_MSG))], CONST_ME_POFF

if(action[1] == ACTION_RUN) then

  doRemoveCreature(itemEx.uid)

elseif(action[1] == ACTION_BREAK) then

  effect = CONST_ME_BLOCKHIT

  doRemoveItem(item.uid, 1)

elseif(action[1] == ACTION_ALL) then

  doRemoveCreature(itemEx.uid)

  doRemoveItem(item.uid, 1)

end

doSendMagicEffect(pos, effect)

doCreatureSay(cid, action[2], TALKTYPE_MONSTER_SAY)

return action

end

function onUse(cid, item, fromPosition, itemEx, toPosition)

local mount = config[item.itemid]

if(mount == nil or getPlayerMount(cid, mount.ID)) then

  return false

end

local rand = math.random(1, 100)

--Monster Mount

if(isMonster(itemEx.uid) and not isSummon(itemEx.uid) and mount.TYPE == TYPE_MONSTER) then

  if(mount.NAME == getCreatureName(itemEx.uid)) then

   if(rand > mount.CHANCE) then

	doFailAction(cid, mount, toPosition, item, itemEx)

	return true

   end

   doPlayerAddMount(cid, mount.ID)

   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

   doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)

   doRemoveCreature(itemEx.uid)

   doSendMagicEffect(toPosition, CONST_ME_POFF)

   doRemoveItem(item.uid, 1)

   return true

  end

--NPC Mount

elseif(isNpc(itemEx.uid) and mount.TYPE == TYPE_NPC) then

  if(mount.NAME == getCreatureName(itemEx.uid)) then

   if(rand > mount.CHANCE) then

	doFailAction(cid, mount, toPosition, item, itemEx)

	return true

   end

   doPlayerAddMount(cid, mount.ID)

   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

   doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)

   doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)

   doRemoveItem(item.uid, 1)

   return true

  end

--Action Mount

elseif(itemEx.actionid > 0 and mount.TYPE == TYPE_ACTION) then

  if(mount.NAME == itemEx.actionid) then

   if(rand > mount.CHANCE) then

	doFailAction(cid, mount, toPosition, item, itemEx)

	return true

   end

   doPlayerAddMount(cid, mount.ID)

   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

   doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)

   doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)

   doRemoveItem(item.uid, 1)

   return true

  end

--Unique Mount

elseif(itemEx.uid <= 65535 and mount.TYPE == TYPE_UNIQUE) then

  if(mount.NAME == itemEx.uid) then

   if(rand > mount.CHANCE) then

	doFailAction(cid, mount, toPosition, item, itemEx)

	return true

   end

   doPlayerAddMount(cid, mount.ID)

   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

   doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)

   doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)

   doRemoveItem(item.uid, 1)

   return true

  end

end

return false

end

Explicando :
[5907] =  {NAME = 'Bear',	 ID = 3,  TYPE = TYPE_MONSTER,  CHANCE = 20,  FAIL_MSG = { {1, "The bear ran away."}, {2, "Oh no! The slingshot broke."}, {3, "The bear is trying to hit you with its claws."} }, SUCCESS_MSG = "You have tamed the bear."},

5907 = Item que precisa ser usado !

Name = O alvo (Nesse alvo é que você ira usar o item).

ID = Id da mount, isso é configurado no mount.xml.

TYPE = os tipos são : TYPE_MONSTER, TYPE_NPC (Existem 2 mounts que são feitos por esse tipo),TYPE_ACTION, TYPE_UNIQUE.

Chance = A chance de conseguir em %.

FAIL_MSG = Aqui você pode botar diversas mensagens com diversas de diversas funções... Exemplo : {1, "O urso correu pra longe."} Nesse caso, aquele 1 significa que o monstro fugiu, e então a mensagem você pode mudar, mas você tambem pode adicionar o tipo 2, o tipo 2 funciona como se o item tivesse quebrado... {2, "O urso comeu a banana."}, o tipo 3 é que nada acontece ... {3, "O urso latiu pra você."} e o tipo 4, é aonde o player se fode todo onde tudo acontece e nada a favor do player {4, "O urso comeu a banana e saiu correndo."}

SUCCESS_MSG = É a mensagem de sucesso, exemplo : "Você capturo o urso mais estranho do mundo."

Ajudei ? não precisa de rep +, apenas comente !

Att. Huziwara no Mokou

Editado por Huziwara (veja o histórico de edições)
bXEB9.jpg
Link para o post
Compartilhar em outros sites

mais um ótimo trabalho !

Quer ver o que você nunca viu?, simplesmente vá aonde você nunca foi.

(alguém).

Dancing-pug-caught.gif?

Link para o post
Compartilhar em outros sites

Existem alguns bugs..

King Scorpion = Sandstone Scorpion

Tin Lizzard = Inoperative Tin Lizzard

Uniwheel = Inoperative Uniwheel

:)

Obrigada, e desculpa, pois ele está configurado de acordo com o meu server...

Mas eu botei ai :

Sandstone Scorpion

Obrigada novamente !

Att. Huziwara no Mokou

bXEB9.jpg
Link para o post
Compartilhar em outros sites
  • 4 weeks later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo