Jump to content

Request Script


Zelek

Recommended Posts

5 hours ago, untucbre said:

I need a script to use a spell and a script to use a certain item permanently

I have using this script for spells.
 

Quote

if g_game.isAttacking() then
    if #g_game.getMonstersAround(1) >= 2 then
        g_game.talk("Area Spell")
    else
        g_game.talk("Target")
    end
end
auto(500)

It's using Target if you are attacking someone or use area spell if monsters are more then 2.

 

What you want to use? Food or something like that? I use this script. 
 

Quote

local foodId = food_ID
g_game.use(foodId)
auto(10000, 30000)

 

Link to comment
Share on other sites

On 10/24/2020 at 12:02 PM, Zelek said:

if not g_game.isOnline() then return end
local leftSlot = 6
local rightSlot = 5
g_game.move(7368, {x=65535, y=leftSlot, z=0}, 100)
auto(5000)

Currently there is no way to read player's equipment to know when the weapon is gone, so it's best to just move the items every x amount of time.

I'll be adding it in the future versions.

Have arrow slot? like above leftslot

Link to comment
Share on other sites

Just now, strzala said:

I need script "use item on dead monster" please help me

 

auto(100)

local corpseIds = {5362, 5362} -- ids of bodies
local itemIdToUse = 7803 -- id of the item to use on bodies

function table.find(t, value)
  for k,v in pairs(t) do
    if v == value then return k end
  end
end

local tiles = g_map.getTiles()
local corpses = {}
for _, tile in pairs(tiles) do
    if tile:getPosition():getDistance(g_game.getLocalPlayer():getPosition()) <= 1 then
        local topItem = tile:getTopItem()
        if topItem and table.find(corpseIds, topItem:getId()) then
            table.insert(corpses, topItem)
        end
    end
end

if #corpses > 0 then
    for _, corpse in pairs(corpses) do
        setOption("Cavebot/Enabled", "false")
        g_game.stop()
        g_game.useItemOnPosition(itemIdToUse, corpse:getPosition())
        sleep(1000)
    end
else
    setOption("Cavebot/Enabled", "true")
end

 

Link to comment
Share on other sites

10 minutes ago, lediv said:

 

auto(100)

local corpseIds = {5362, 5362} -- ids of bodies
local itemIdToUse = 7803 -- id of the item to use on bodies

function table.find(t, value)
  for k,v in pairs(t) do
    if v == value then return k end
  end
end

local tiles = g_map.getTiles()
local corpses = {}
for _, tile in pairs(tiles) do
    if tile:getPosition():getDistance(g_game.getLocalPlayer():getPosition()) <= 1 then
        local topItem = tile:getTopItem()
        if topItem and table.find(corpseIds, topItem:getId()) then
            table.insert(corpses, topItem)
        end
    end
end

if #corpses > 0 then
    for _, corpse in pairs(corpses) do
        setOption("Cavebot/Enabled", "false")
        g_game.stop()
        g_game.useItemOnPosition(itemIdToUse, corpse:getPosition())
        sleep(1000)
    end
else
    setOption("Cavebot/Enabled", "true")
end

 

Hmmm don't  work for me i correct setup id 😞

Link to comment
Share on other sites

On 4/10/2021 at 1:11 AM, strzala said:

Hmmm don't  work for me i correct setup id 😞

remember to put correct id of the item and body and enable "read map tiles" in info and options tab. It works for me

Edited by lediv
Link to comment
Share on other sites

55 minutes ago, shiro785 said:

Hi i'm looking for a script that uses a spell if i'm stun by a player, or just stun. thx

use g_game.getLocalPlayer():getStates()        to find corect state number
and then add   
g_game.getLocalPlayer():hasState()  condition to cast spell

 

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I'm looking for a script to use inventory item for the same item. in inventory.. I try to looking for docs : inventory item use on inventory item but i can't find ;( ... someone can help ? 

Edited by Poszep
Link to comment
Share on other sites

On 4/28/2021 at 5:44 PM, Poszep said:

Hi,

I'm looking for a script to use inventory item for the same item. in inventory.. I try to looking for docs : inventory item use on inventory item but i can't find ;( ... someone can help ? 

Completly dont know if it will work, but you can try

g_game.useInventoryItemOnPosition(3031, g_game.getAttackingCreature():getPosition()

 

instead of map position, you can try to insert bp position

Link to comment
Share on other sites

×
×
  • Create New...