1
[aporte] Palanca que te da potions por plantas el Jue Sep 14, 2017 3:46 am
[Adm] SevuOT
![[Adm] SevuOT](https://2img.net/u/2712/30/40/04/avatars/10743-22.jpg)
Miembro

Aqui esta el codigo del action:
- Código:
local config = {
cost = 0,
plantId = 5881,
plantPerPotions = 3,
potionIds = { 7590, 7591 },
needLevel = 45
}
function onUse(player, item, fromPos, target, toPos)
local plants = getPlayerItemCount(player, config.plantId)
local pGold = getPlayerMoney(player)
local level = getPlayerLevel(player)
if level >= config.needLevel then
if pGold >= config.cost then
if plants >= config.plantPerPotions then
local cPotion = config.potionIds[math.random(1, #config.potionIds)]
doPlayerRemoveItem(player, config.plantId, plantPerPotions)
doPlayerRemoveMoney(player, config.cost)
doPlayerAddItem(player, cPotion, 1)
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, 'Has creado ' .. getItemName(cPotion) .. ' x1')
doSendMagicEffect(fromPos, CONST_ME_PLANTATTACK)
else
doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, 'Necesitas mas plantas curativas para crear una potions usable.')
end
else
doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, 'No tienes oro suficiente para iniciar el ritual.')
end
else
doPlayerSendTextMessage(player, MESSAGE_EVENT_DEFAULT, 'No tienes suficiente nivel para iniciar el ritual.')
end
return true
end
en action.xml agregas la actionid del item por ejemplo:
- Código:
<action actionid="14000" script="plantToPotions.lua" />
Importante: No es necesario que sea una palanca, tambien se lo pueden agregar a una pared, puerta, pisos, cualquier objeto...
Para servidores: OTX 2 - ( basado en 0.3.6 y 0.4 ) - Quizas si usas TFS 1.xx puede que te sirva
Última edición por The_Pain el Jue Sep 14, 2017 3:59 am, editado 1 vez (Razón : Importante)

Si tu cuenta de PayPal no esta verificada no importara, igual aceptan pagos con cuentas no verificadas.
![[aporte] Palanca que te da potions por plantas TRJEB8aSRYK5IulEU6ilJw](https://2img.net/image.prntscr.com/image/TRJEB8aSRYK5IulEU6ilJw.png)