OSRS Plugin API
    Preparing search index...

    Class HintArrow

    This section is for hintArrows, arrows that are on the minimap and in the world that help draw attention to specific characters and areas. Everyone has played a game where there is a huge “?” above a character's head.
    That question mark is really a hintArrow letting you know to talk to that specific character. Let's go over how you can create your own hint arrows for your plugin.

    There are two different types of hintArrows you can make: a character hintArrow or a location hintArrow. A character hint arrow will appear on top of a player’s or npc’s head and follow them around, whereas a location hint arrow will appear at a specific location or coordinates in the game world. When you create a hintArrow, you can choose which type it will be with the hintArrow properties.

    You also have the ability to customize what you want your hintArrows to look like. A hintArrow is able to look like any sprite (image) that is currently in the game, and it can also be customized using its function properties.

    Once a hintArrow is created and drawn into the world there are a multitude of methods you can use on it. You can make the hintArrow blink on and off screen at different rates (setFlashRate), change its position (setTargetCoord), change the character it is following (setTargetNpc), change how it looks (setNewSprite), and much more. Have fun playing around with hintArrows, and have your plugin lead players to all kinds of fun locations or funny NPC’s.

    Hint Arrows can be used for placing directional arrows on the minimap and in the world to draw attention to certain areas. Eventually placing them on the world map will be supported.

    -- This example will add a Hint Arrow to every goblin around you using the inventory bag sprite.
    local goblins = osrs.ClientOp.getNpcIdByNameAll("Goblin")
    local hintArrows = {}

    for i = 1, #goblins do
    hintArrows[i] = osrs.HintArrow.new({
    npc = goblins[i],
    drawOnMinimap = false,
    sprite = 123
    })
    end

    -- When you wanted to clear all the arrows from both the client and Lua state you can do this.
    for i = 1, #hintArrows do
    --Removes the reference to the arrow from the client.
    hintArrows[i]:clear()
    --Removes the reference to the arrow from the Lua state.
    hintArrows[i] = nil
    end

    Passing an empty table will result in an inactive arrow object which can still be manipulated later. Arrows are intended to point at a single target so only pass a table with either coord, player, or npc, not all of them.

    However if you do pass a table with more than one the order the "Arrow Mode" is set is coord -> player -> npc, so top priority is always NPC. Below is the full table you could pass into the .new function.

    fullTable = 
    {
    coord = osrs.MapCoord.new(0, 0, 0),
    player = 0,
    npc = 0,
    sprite = 0,
    fineCoords = { x = 64, z = 64},
    drawOnMininmap = true,
    drawOnWorldMap = true,
    drawInWorld = true,
    }

    local hintArrow = osrs.HintArrow.new(fullTable)
    Index

    Constructors

    Methods

    • Removes the hint arrow from the client.

      Returns void

      -- Create a hint arrow pointing at an npc arround you
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = osrs.ClientOp.getNpcIdByName("Man")})
      -- Press Q to clear out the hint arrow
      test = function (keycode)
      if(keycode == 32) then
      osrs.print("Cleared out Hint Arrow")
      hintArrow:clear()
      end
      end

      osrs.Events.subscribe(test, osrs.Events.KEY_DOWN)
    • Retrieves the current mode of the hint arrow.

      Returns ArrowMode

      -- Create a hint arrow pointing at an npc arround you
      local playerCoord = osrs.ClientOp.coord()
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, coord = playerCoord})
      -- Get the npc's coord

      --Sets to be NPC arrow.
      hintArrow:setArrowMode(osrs.HintArrow.ArrowMode.ARROW_NPC)
      osrs.print(hintArrow:getArrowMode())
      --Sets to be COORD arrow.
      hintArrow:setArrowMode(osrs.HintArrow.ArrowMode.ARROW_COORD)
      osrs.print(hintArrow:getArrowMode())
      --Sets to be Player arrow.
      hintArrow:setArrowMode(osrs.HintArrow.ArrowMode.ARROW_PLAYER)
      osrs.print(hintArrow:getArrowMode())
      --Any other value will result in the arrow being set inactive.
      --Useful if you want to keep the arrow alive but don't actively want it.
      hintArrow:setArrowMode(osrs.HintArrow.ArrowMode.ARROW_INACTIVE)
      osrs.print(hintArrow:getArrowMode())
    • Returns the Fine X of this arrow.

      Returns number

      osrs.print(tostring(hintArrow:getFineX()))
      
    • Returns the Fine Z of this arrow.

      Returns number

      osrs.print(tostring(hintArrow:getFineZ()))
      
    • Returns the current flash off time of an arrow.

      Returns number

      -- Create a hint arrow pointing at an npc arround you
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = osrs.ClientOp.getNpcIdByName("Woman")})
      -- Get the flash time off of the hint arrow
      osrs.print(tostring(hintArrow:getFlashOffTime()))
    • Returns the current flash rate of an arrow.

      Returns number

      -- Create a hint arrow pointing at an npc arround you
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = osrs.ClientOp.getNpcIdByName("Woman")})
      -- Get the flash rate of the hint arrow
      osrs.print(tostring(hintArrow:getFlashRate()))
    • Returns the coord that the HintArrow is targetting, if TargetMode is set to COORD. Otherwise, returns a Map Coord with -1, -1, -1.

      Returns MapCoord

      local playerCoord = osrs.ClientOp.coord()
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, coord = playerCoord})
      -- Get the targeted coord
      local coord = hintArrow:getTargetCoord()
      osrs.print("Hint Arrow is currently targetting X: %i, Level: %i, Z: %i: ", coord.x, coord.level, coord.z)
    • Returns target NPC's short ID.

      Returns number

      -- Create a hint arrow pointing at an npc arround you
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = osrs.ClientOp.getNpcIdByName("Woman")})
      -- Get the npc's short ID
      osrs.print(tostring(hintArrow:getTargetNpc()))
    • Returns the ID of the player this arrow is targeting.

      Returns number

      -- Get the ID of the local player
      local wasFound, id = osrs.ClientOp.playerFindSelf();
      -- Create a hint arrow with the local player as the target
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, player = id})
      -- Get the players ID from the hint arrow
      osrs.print(tostring(hintArrow:getTargetPlayer()))
    • Returns if this arrow is being drawn in the world.

      Returns boolean

      -- Create a hint arrow pointing at an npc arround you
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = osrs.ClientOp.getNpcIdByName("Woman")})
      -- Check to see if the arrow is drawn in the world
      osrs.print(tostring(hintArrow:inWorld()))
    • Returns if this arrow is being drawn on the minimap.

      Returns boolean

      -- Create a hint arrow pointing at an npc arround you
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = osrs.ClientOp.getNpcIdByName("Woman")})
      -- Check to see if the arrow is on the minimap
      osrs.print(tostring(hintArrow:onMinimap()))
    • Tries to set the "Arrow Mode" of this arrow. The arrow mode represents what type of arrow it is, NPC, Coord, or Player.

      Parameters

      • arrowMode: number

        Mode to try set arrow to.

      Returns void

      -- Create a hint arrow pointing at an npc arround you
      local playerCoord = osrs.ClientOp.coord()
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, coord = playerCoord})
      -- Get the npc's coord

      --Sets to be NPC arrow.
      hintArrow:setArrowMode(osrs.HintArrow.ArrowMode.ARROW_NPC)
      osrs.print(hintArrow:getArrowMode())
      --Sets to be COORD arrow.
      hintArrow:setArrowMode(osrs.HintArrow.ArrowMode.ARROW_COORD)
      osrs.print(hintArrow:getArrowMode())
      --Sets to be Player arrow.
      hintArrow:setArrowMode(osrs.HintArrow.ArrowMode.ARROW_PLAYER)
      osrs.print(hintArrow:getArrowMode())
      --Any other value will result in the arrow being set inactive.
      --Useful if you want to keep the arrow alive but don't actively want it.
      hintArrow:setArrowMode(osrs.HintArrow.ArrowMode.ARROW_INACTIVE)
      osrs.print(hintArrow:getArrowMode())
    • Set the fine coordinate of an arrow pointing at a coord.

      Parameters

      • x: number

        Fine x coordinate

      • z: number

        Fine z coordinate

      Returns void

      --Set the fine coordinates to the centre of the tile.
      hintArrow:setFineCoords(64, 64)
    • Overrides the default rate at which the arrow flashes in client ticks. An off time higher than the flash rate will result in the arrow not appearing at all, but if you want to turn off an arrow temporarily use :setArrowMode(0) instead.

      Actual math is:

      (clientTick % flashRate) < offTime
      

      Parameters

      • flashRate: number
      • offTime: number

      Returns void

      --Arrow will turn off for 10 ticks every 50 ticks. 
      hintArrow:setFlashRate(50, 10)
    • Set whether this arrow is drawn in the world (Above tiles, NPC, or Player).

      Parameters

      • newState: boolean

        State to set this boolean.

      Returns void

      -- Create a hint arrow pointing at an npc arround you
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = osrs.ClientOp.getNpcIdByName("Woman")})
      -- Set the arrow to not be drawn in the world
      hintArrow:setInWorld(false)
    • Set the sprite of the Hint Arrow to the given sprite ID.

      Parameters

      • spriteID: number

        The ID of the sprite to assign to arrow.

      Returns void

      -- Create a hint arrow pointing at an npc arround you
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = osrs.ClientOp.getNpcIdByName("Woman")})
      -- Change the sprite of the hint arrow
      hintArrow:setNewSprite(100)
    • Set whether this arrow is drawn on the minimap.

      Parameters

      • newState: boolean

        State to set this boolean.

      Returns void

      -- Create a hint arrow pointing at an npc arround you
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = osrs.ClientOp.getNpcIdByName("Woman")})
      -- Set the hintArrow to not show up on the minimap
      hintArrow:setOnMinimap(false)
    • Set the target coord this arrow is targeting.

      Parameters

      • coord: MapCoord

        A osrs.MapCoord representing the Height, X, and Z of the arrow.

      Returns void

      -- Create a hint arrow pointing at a specified MapCoord
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, coord = osrs.MapCoord.new(-1,-1,-1)})
      local coord = hintArrow:getTargetCoord()
      osrs.printf("Hint Arrow is currently targetting X: %i, Level: %i, Z: %i: ", coord.x, coord.level, coord.z)
      local playerCoord = osrs.ClientOp.coord()
      hintArrow:setTargetCoord(playerCoord)
      -- Get the targeted coord
      coord = hintArrow:getTargetCoord()
      osrs.printf("Hint Arrow is currently targetting X: %i, Level: %i, Z: %i: ", coord.x, coord.level, coord.z)
    • Set the NPC this arrow is targeting.

      Parameters

      • npcID: number

        ShortID for the NPC in the world.

      Returns void

      -- Create a hint arrow with an empty npc to target
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, npc = -1})
      -- Get the ID of an npc arround you
      local id = osrs.ClientOp.getNpcIdByName("Woman")
      -- Set the npc target of the hint arrow
      hintArrow:setTargetNpc(id)
    • Set the player this arrow is targeting.

      Parameters

      • playerID: number

        ID of the player to target.

      Returns void

      -- Create a hint arrow with an empty player to target
      local hintArrow = osrs.HintArrow.new({sprite = 123, drawInWorld = true, player = -1})
      -- Get the ID of the local player
      local wasFound, id = osrs.ClientOp.playerFindSelf();
      -- Set the hint arrow target to the local player
      hintArrow:setTargetPlayer(id)