Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- summonName = "Orc",
- cost = 10000, -- in gp, put 0 to disable
- remove = "yes" -- should egg by removed after use?
- }
- config.remove = (config.remove == "yes" and true or false)
- function onUse(player, item, fromPosition, target, toPosition, isHotkey)
- local pos = player:getPosition()
- if(pos.x == CONTAINER_POSITION) then
- player:sendCancelMessage("Put item on the floor first.")
- return true
- end
- if(config.cost > 0 and player:getMoney() < config.cost) then
- player:sendCancelMessage("Not enought money, trainer cost " .. config.cost .. " gp's.")
- return true
- end
- effect = CONST_ME_MAGIC_RED
- Game.createMonster(config.summonName, pos)
- ret:setMaster(player)
- if(config.cost > 0) then
- player:removeMoney(config.cost)
- end
- if(config.remove == true) then
- item:remove(1)
- end
- Position(pos):sendMagicEffect(effect)
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement