• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Decay weapon Lever please.

oshrigames

Active Member
Joined
Nov 9, 2012
Messages
222
Reaction score
47
Location
israel
hey.

im looking for lever script that will decay all enchanted weapons back into normal.
cost of the change is 5k.

i tried make one myself but, the amount of errors i got could destroy the death star. ()
so i look for more experience one to help me out here.

visual example:

lever.png


lever 2.png

if there's anything else you need to know let me know.
Edited: im using cryingdamson 0.3.6 (8.60) V8.2

big thanks.
 
Last edited:
here's code for 1.2/1.3, next time provide your engine version like it says to do so in the board rules
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local position = toPosition + Position(-1, 0, 0)
    local tile = Tile(position)
    local tileItem = tile:getTopDownItem()
    if tileItem then
        if tileItem:getType():getDecayId() ~= -1 then
            if player:removeMoney(5000) then
                tileItem:transform(tileItem:getType():getDecayId())
                position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            else
                player:sendCancelMessage("You need 50 platinum coins to use this lever.")
                player:getPosition():sendMagicEffect(CONST_ME_POFF)
            end
        else
            player:sendCancelMessage("It is not possible to decay this item.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
        end
    else
        player:sendCancelMessage("Put a valid item on the counter.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end
    return true
end
 
sorry about that, ive edited & update the request.
please bear with me i kinda lost and new to all of this.

how do i implement that script?
i don't need to state in the script the following?:
lever position, counter position and in reme map editor lever unique id?

also can i name the script how i want?, and just put it in
data\actions\scripts\other?
 
Last edited:
you install it like any other action, you don't need to define any positions or anything like that, just use a unique action id for the lever and set it in RME so that it'll work when you click on it
 
you install it like any other action, you don't need to define any positions or anything like that, just use a unique action id for the lever and set it in RME so that it'll work when you click on it

i mess something up :(

i get this error when i pull the lever.

[25/02/2018 23:08:40] [Error - Action Interface]
[25/02/2018 23:08:40] data/actions/scripts/other/leverdecay.lua:eek:nUse
[25/02/2018 23:08:40] Description:
[25/02/2018 23:08:40] data/actions/scripts/other/leverdecay.lua:2: attempt to call global 'Position' (a nil value)
[25/02/2018 23:08:40] stack traceback:
[25/02/2018 23:08:40] data/actions/scripts/other/leverdecay.lua:2: in function <data/actions/scripts/other/leverdecay.lua:1>

ive tested both of those lines in Action.xml and set unique action id in the lever (RME)
Code:
    <action uniqueid="4561" event="script" value="other/leverdecay.lua"/>
Code:
    <action actionid="4561" event="script" value="other/leverdecay.lua"/>

also big thanks for your help and patience..
 
Last edited:
Back
Top