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

Movement Script to ActionScript

enemyy

Member
Joined
Aug 11, 2017
Messages
28
Reaction score
5
Hello guys,

Can someone helpme to transform this movements script in to Action Script?

i'm using TFS 1.3

Lua:
local WINDOW_ID = 4203
local BUTTON_ACCEPT = 0
local BUTTON_CLOSE = 1

local WAYPOINTS_STORAGE = 41875
local WAYPOINTS = {
  [1] = {
    name = "waypoint 1",
    position = Position(32978, 31287, 6)
  },
  [2] = {
    name = "Waypoint 2",
    position = Position(32978, 31280, 6)
  },
}

function onStepIn(player, item, position, fromPosition)
  if player:isPlayer() and fromPosition:getDistance(position) == 1 then
   
    for i = 1, #WAYPOINTS do
      local waypoint = WAYPOINTS[i]
      if position == waypoint.position and player:getStorageValue(WAYPOINTS_STORAGE + i) ~= 1 then
        player:setStorageValue(WAYPOINTS_STORAGE + i, 1)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "New waypoint unlocked!\n-- " .. waypoint.name .. " --")
        return true
      end
    end

    local empty = true
    for i = 1, #WAYPOINTS do
      local waypoint = WAYPOINTS[i]
      if position == waypoint.position and player:getStorageValue(WAYPOINTS_STORAGE + i) == 1 then
        empty = false
        break
      end
    end

    if not empty then
      player:registerEvent("WaypointsModal")
     
      local title = "Waypoints"
      local message = "Choose your destination."
     
      local window = ModalWindow(WINDOW_ID, title, message)

      window:addButton(BUTTON_ACCEPT, "Teleport")
      window:addButton(BUTTON_CLOSE, "Close")

      for i = 1, #WAYPOINTS do
        local waypoint = WAYPOINTS[i]
        if player:getStorageValue(WAYPOINTS_STORAGE + i) == 1 then
          window:addChoice(i, waypoint.name)
        end
      end

      window:setDefaultEnterButton(BUTTON_ACCEPT)
      window:setDefaultEscapeButton(BUTTON_CLOSE)

      window:sendToPlayer(player)
    end
  end
    return true
end

function onWaypointsModal(player, modalWindowId, buttonId, choiceId)
  player:unregisterEvent("WaypointsModal")

  if modalWindowId == WINDOW_ID then
      if buttonId == BUTTON_ACCEPT then
        if player:getStorageValue(WAYPOINTS_STORAGE + choiceId) == 1 then
          player:teleportTo(WAYPOINTS[choiceId].position)
          WAYPOINTS[choiceId].position:sendMagicEffect(CONST_ME_ENERGYAREA)
        end
      end
  end
end

i get it from oen432 waypoint system by @oen432
 
Last edited:
Back
Top