Joriku
Working in the mines, need something?
Hi,
Don't ask me why but I had too little sleep for this. Been sitting with this for around 4 hours on a non sleep and can't manage to get it to take my item as payment instead of money.
Original script
Something I've tried out of alot of options
I managed to make it give it inc. check the item but not to remove it for some reason, then I compleatley lost it
Don't ask me why but I had too little sleep for this. Been sitting with this for around 4 hours on a non sleep and can't manage to get it to take my item as payment instead of money.
Original script
Lua:
-- Script by Klonera/Joriku
local testAction = Action() -- this is our header, the first thing we have to write (except for configuration tables and such)
local spellName = "Increment Mana"
local price = 1000000
function testAction.onUse(player, item, fromPosition, target, toPosition, isHotkey) -- now we can design the action itself
print("Test Script Loaded In Successfully.")
if player:hasLearnedSpell(spellName) then
player:sendCancelMessage("You already have this spell.")
return true
end
if player:getMoney() < price then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You do not have enough money.")
fromPosition:sendMagicEffect(CONST_ME_POFF)
return true
end
player:learnSpell(spellName)
player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("You buy %s for %s gold coins.", spellName, price))
fromPosition:sendMagicEffect(CONST_ME_HEARTS)
player:removeMoney(price)
print("Test Script Ended Successfully.")
return true
end
testAction:aid(667) -- the item is a scythe
testAction:register() -- this is our footer, it has to be the last function executed
Something I've tried out of alot of options
Lua:
-- Script by Klonera/Joriku
local testAction = Action() -- this is our header, the first thing we have to write (except for configuration tables and such)
local c = {
['spellName'] = "Increment Super Mana"
['item'] = 2294,
['price'] = 1
}
function testAction.onUse(player, item, fromPosition, target, toPosition, isHotkey) -- now we can design the action itself
print("Test Script Loaded In Successfully.")
if player:hasLearnedSpell(c.spellName) then
player:sendCancelMessage("You already have this spell.")
return true
end
if player:getId(c.item) == c.price then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You do not have enough tokens.")
fromPosition:sendMagicEffect(CONST_ME_POFF)
return true
end
player:learnSpell(c.spellName)
player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("You buy %s for %s tokens.", c.spellName, c.price))
fromPosition:sendMagicEffect(CONST_ME_HEARTS)
player:removeMoney(c.price)
print("Test Script Ended Successfully.")
return true
end
testAction:aid(660) -- the item is a scythe
testAction:register() -- this is our footer, it has to be the last function executed
I managed to make it give it inc. check the item but not to remove it for some reason, then I compleatley lost it