Ir para conteúdo

Featured Replies

Postado

Salve carai! Então, tenho estudado um pouco de lua e acabei fazendo um script, simples, mas que pode vir a ser útil para alguns servidores...

 

O que o script faz? É simples, ele te deixa tirar a "pele" de um animal ainda vivo, como a obsidian knife faz com os mortos.

PS: Você pode configurar os mobs e suas respectivas "peles" no script, você só precisar tem um mínimo de conhecimento em lua.

PS²: Script feito em um TFS 1.2 recém baixado.

 

actions.xml: (PS: Não esqueça de definir o ID do item a ser usado)

	<action itemid="ID DO ITEM" script="skinning.lua" />

 

Observação: A Sintaxe em lua nos codes do fórum está aparentemente bugada, apenas copie o código abaixo e cole no seu editor lua que ficará normal.

 

actions/scripts/skinning.lua:

local wool = {"Sheep", "Black Sheep"} -- Creatures configuration for the first table which gives wool when skinned
local leather = {"Deer", "Bear", "Rat"} -- Creatures configuration for the second table which gives minotaur leather when skinned (Should probably rename the item to leather by the way)
local dleather = {"Dragon", "Wyvern"} -- Creatures configuration for the third table which gives green dragon leather when skinned (Could also change this to green leather or something)
local tPos = getCreaturePosition(target)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	if isCreature(target) and isInArray(wool, getCreatureName(target)) then
		doSendMagicEffect(tPos, 1) -- The magic effect that will be shown @ target's position when skinned.
        player:addItem(11236, 3) -- Item which will be added when the mobs at "Wool" table are skinned and its amount.
		doCreatureAddHealth(target, -10)
	elseif isCreature(target) and isInArray(leather, getCreatureName(target)) then
		doSendMagicEffect(tPos, 1) -- The magic effect that will be shown @ target's position when skinned.
        player:addItem(5878, 1) -- Item which will be added when the mobs at "Leather" table are skinned and its amount.
		doCreatureAddHealth(target, -20)
	elseif isCreature(target) and isInArray(dleather, getCreatureName(target)) then
		doSendMagicEffect(tPos, 1) -- The magic effect that will be shown @ target's position when skinned.
        player:addItem(5877, 1) -- Item which will be added when the mobs at "DLeather" table are skinned and its amount.
		doCreatureAddHealth(target, -50)
	elseif isCreature(target) == false then
		player:sendTextMessage(MESSAGE_STATUS_WARNING, "You can only skin creatures.") -- The error message it will give if the player is trying to skin something that isn't a creature.
	else player:sendTextMessage(MESSAGE_STATUS_WARNING, "You cannot skin this creature.") -- The error message it will give if t he player is trying to skin a creature which isn't added in the configuration above.
		return true
	end
end

 

Editado por Oneda
Remover tPos desnecessários (veja o histórico de edições)

Postado

Parabéns, seu tópico de conteúdo foi aprovado!
Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.
Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.

Spoiler

Congratulations, your content has been approved!
Thank you for your contribution, we of Tibia King we are grateful.
Your content will help many other users, you received +1 REP.

 

Projeto ATS (Naruto)

Informações Abaixo

Facebook

Youtube
Discord

 

Tutoriais / Conteúdos

Clique Aqui

Postado
  • Autor

Versão melhorada da mesma action:

 

local mEffect = 1
local creatures = {pack1 = {"Sheep", "Black Sheep"}, pack2 = {"Deer", "Bear", "Rat"}, pack3 = {"Dragon", "Wyvern"}}
local rewards = {pack1 = 11236, pack2 = 5878, pack3 = 5877}
local amounts = {pack1 = 5, pack2 = 2, pack3 = 1}
local damages = {pack1 = -5, pack2 = -15, pack3 = -50}
 
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if target:isCreature(target) and isInArray(creatures.pack1, getCreatureName(target)) then
        toPosition:sendMagicEffect(mEffect)
        player:addItem(rewards.pack1, amounts.pack1)
        target:addHealth(damages.pack1)
    elseif isCreature(target) and isInArray(creatures.pack2, getCreatureName(target)) then
        toPosition:sendMagicEffect(mEffect)
        player:addItem(rewards.pack2, amounts.pack2)
        target:addHealth(damages.pack2)
    elseif isCreature(target) and isInArray(creatures.pack3, getCreatureName(target)) then
        toPosition:sendMagicEffect(mEffect)
        player:addItem(rewards.pack3, amounts.pack3)
        target:addHealth(damages.pack3)
    elseif target:isCreature(target) == false then
        player:sendTextMessage(MESSAGE_STATUS_WARNING, "You can only skin creatures.") -- The error message it will give if the player is trying to skin something that isn't a creature.
    else player:sendTextMessage(MESSAGE_STATUS_WARNING, "You cannot skin this creature.") -- The error message it will give if t he player is trying to skin a creature which isn't added in the configuration above.
        return true
    end
end

 

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo