slaw
Software Developer
Requested from here: http://otland.net/f132/request-trainer-egg-30702/
How it works: You're placing item on floor (It won't work in backpack!), and you use it. Monster is summoned, money removed.
WARNING: Only TFS 0.3+
data/actions/scripts/trainer_eqq.lua
Remember to add new line in actions.xml!
How it works: You're placing item on floor (It won't work in backpack!), and you use it. Monster is summoned, money removed.
WARNING: Only TFS 0.3+
data/actions/scripts/trainer_eqq.lua
Code:
local config = {
summonName = "Training Monk",
cost = 10000 -- in gp, put 0 to disable
remove = "yes" -- should egg by removed after use?
}
config.remove = getBooleanFromString(config.remove)
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getCreaturePosition(cid)
if(pos.x == CONTAINER_POSITION) then
doPlayerSendCancel(cid, "Put item on the floor first.")
return TRUE
end
if(config.cost > 0 and getPlayerMoney(cid) < config.cost) then
doPlayerSendCancel(cid, "Not enought money, trainer cost " .. config.cost .. " gp's.")
return TRUE
end
local ret, effect = doSummonMonster(cid, config.summonName), CONST_ME_MAGIC_RED
if(ret ~= RETURNVALUE_NOERROR) then
effect = CONST_ME_POFF
doPlayerSendDefaultCancel(cid, ret)
else
if(config.cost > 0) then
doPlayerRemoveMoney(cid, config.cost)
end
if(config.remove == TRUE) then
doRemoveItem(item.uid)
end
end
doSendMagicEffect(pos, effect)
return TRUE
end
Remember to add new line in actions.xml!
Last edited: