• 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!

RevScripts Convert script

jel

Member
Joined
Mar 22, 2014
Messages
302
Reaction score
12
Good evening, could someone convert this script to be used in the canary distro



Lua:
local storeBox = Action()

local REWARD = {8153, 37317, 9586, 19082, 3043, 37110, 3079, 28887, 9145, 28895, 37378}
local JEWEL = {37317, 9586, 19082, 3043, 37110, 3079, 28887, 9145, 28895, 37378}
function storeBox.onUse(cid, item, fromPosition, itemEx, toPosition)
      local randomChance = math.random(1, #REWARD)
      doPlayerAddItem(cid, REWARD[randomChance], 1)

local randomLoot = math.random(1,20)
    if randomLoot == 1 then
    doPlayerSendTextMessage(cid, 19, "You found an extra item!")
             local randomChance = math.random(1, #REWARD)
              doPlayerAddItem(cid, REWARD[randomChance], 1)
    end

local randomJewel = math.random(1,10)
    if randomJewel == 1 then
    doPlayerSendTextMessage(cid, 19, "You found a jewel!")
      local charges = math.random(50, 150)   
      local randomChance = math.random(1, #JEWEL)
      doPlayerAddItem(cid, JEWEL[randomChance], 1)
    end
 
doSendMagicEffect(getPlayerPosition(cid), 73)
   doRemoveItem(item.uid, 1)
   return true
end

storeBox:id(9586)
storeBox:register()
 
Lua:
local storeBox = Action()

local REWARD = {8153, 37317, 9586, 19082, 3043, 37110, 3079, 28887, 9145, 28895, 37378}
local JEWEL = {37317, 9586, 19082, 3043, 37110, 3079, 28887, 9145, 28895, 37378}
function storeBox.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local randomChance = math.random(1, #REWARD)
    player:addItem(REWARD[randomChance], 1)

    local randomLoot = math.random(1,20)
    if randomLoot == 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found an extra item!")
        local randomChance = math.random(1, #REWARD)
        player:addItem(REWARD[randomChance], 1)
    end

    local randomJewel = math.random(1,10)
    if randomJewel == 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found a jewel!")
        local randomChance = math.random(1, #JEWEL)
        player:addItem(JEWEL[randomChance], 1)
    end

    player:getPosition():sendMagicEffect(CONST_ME_THUNDER)
    item:remove(1)
    return true
end

storeBox:id(9586)
storeBox:register()

Never used canary, but if it's anything like TFS i'd try with that. BTW: charges is defined but not used.
 
Last edited:
You have an extra argument.
player:sendMagicEffect(player:getPosition(), CONST_ME_THUNDER) to player:getPosition():sendMagicEffect(CONST_ME_THUNDER)
 
Back
Top