• 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 Use lever switch item + add actionid

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,312
Reaction score
135
Healthy living!

i never seen such, maybe someone can help out please to make a revscript for such idea

idea:
if i click on xxx/yyy/z, wall item switch to dooritem with action id' 1150 example,

So its like i can click a lever or statue or whatver is on x/y/z location, to make doors appear for entering with level req or key req etc.

script shoud handle multiple lines, meaning i can set in every line new item with new actionid, text appear, time appear.

and yeah, if time dissapears doors removes out and wall item appears back into.

i hope i explain it clear xd



1710886336080.png
Post automatically merged:

saomething like




Lua:
  { PosClick = {800, 874, 8}, removeSwitchItem = {846, 870, 6}, OnSwitchEffect = 195, OnClickAppearEffect = 206, SwitchToId = 6265, SwitchedIdActionId = 1150, ReapearItemId = 1050, respawnTime = 1800, textColor = { on switch click = 215, fail = if already switched or burning(cooldown for player)  ) }, messages = { on switch click = "You removed switched wall to experience doors for 30 minutes!", fail = "It is already switched, already in use..." }  }, --
     
     
     
     
   }
}

local function respawnItem(item, position, effect)
   local tile = Tile(position)
   if tile then
      Game.createItem(item, 1, position)
      position:sendMagicEffect(effect)
   end
end

local action = Action()
function action.onUse(player, item, fromPos, target, toPos, isHotkey)
   local j = item.actionid
   local l = j - removeItemsOnClick
   if config.addedPositions[l] then
      local k = config.addedPositions[l]
      local a = k.Pos
      local pos = Position(a[1], a[2], a[3])
      local c = k.removePos
      local d = Position(c[1], c[2], c[3])
      local tile = Tile(d)
      if tile then
         local thing = tile:getTopVisibleThing()
         if thing then
            if thing:getId() == k.spawnId then
               addEvent(respawnItem, k.respawnTime * 1000, thing:getId(), d, k.appearEff)
               pos:sendAnimatedText(k.messages.success, k.textColor.success)
               player:sendTextMessage(MESSAGE_EVENT_DEFAULT, k.messages.success)
               d:sendMagicEffect(k.removeEff)
               thing:remove()
            else
               player:sendMagicEffect(CONST_ME_POFF)
               player:sendTextMessage(MESSAGE_EVENT_DEFAULT, k.messages.fail)
               pos:sendAnimatedText(k.messages.fail, k.textColor.fail)
            end
         end
      end
   end
   return true
end


for v in pairs(config.addedPositions) do
   action:aid(removeItemsOnClick + v)
end
action:register()

local globalEvent = GlobalEvent("remove-Item_onStartup")

function globalEvent.onStartup()
   doAddActionIDSonTop(config.addedPositions, removeItemsOnClick, "Remove-Items", false)
   for v, k in pairs(config.addedPositions) do
      local pos = Position(k.removePos[1],k.removePos[2],k.removePos[3])
      local tile = Tile(pos)
      if tile then
         Game.createItem(k.spawnId, 1, pos)
      end
   end
   return true
end

globalEvent:register()
 
Last edited:
Back
Top