Jump to content

Request Script


Recommended Posts

local healthToCast = 75
local spellToCast = "thrusting beam"

local distance = 4
local player = g_game.getLocalPlayer()

local target = g_game.getAttackingCreature()
if target and target:getPosition():distance(player:getPosition()) <= distance and player:getHealthPercent() >= healthToCast then
  g_game.talk(spellToCast)
  sleep(900, 1100)
end
auto(100)

 

 

3 hours ago, Sophy Moore said:

How to make target spell to trigger when monster that is targetted is near 1sqm max 4 sqm from me. I mean that this script is trying to use spell even if target is 7sqm away from me.

?

 

local healthToCast = 75
local spellToCast = "thrusting beam"
local player = g_game.getLocalPlayer()
if g_game.isAttacking() and player:getHealthPercent() >= healthToCast then
  g_game.talk(spellToCast)
  sleep(900, 1100)
end
auto(100)

 

Link to post
Share on other sites
  • Replies 288
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

if g_game.isOnScreen("Wolf") then playSound("alarm.wav") sleep(2000) end auto(100)     I'll take a look at it

You can load the “Keep Target” script that is already included in the bot.   Keep soul at 100: local player = g_game.getLocalPlayer() if player:getSoul() ~= 100 then   g_game.talk("furie

local TextToFind = xxx local FoundMessage = false for k,v in pairs(g_game.getTextMessages()) do if v = TextToFind then return FoundMessage = true end end if FoundMessage then gotolabel("HUNTING"

Posted Images

On 1/25/2021 at 7:13 AM, zakne11 said:

local player
local playerhp
local playername = xxxx

for v, k in pairs(g_game.getCreatures()) do
        if k:getName() == "playername" and k:isPlayer() then
          player = k
    	  player:getHealthPercent() = playerhp
          break
        end
      end
if playerhp <= 70 then 
  g_game.talk("exura sio" playername)
end

auto(250)

 

When ever I try to use this it throws this error "Direct use of "pairs(g_game.getCreatures())" is prohibited."

Link to post
Share on other sites

Hi Zelek,

 

 

I wanted to use this script to lure mobs, unfortunately it does not work correctly, after luring 7 mobs cavebot is turned off and targeting is activated, after killing all mobs cavebot is still turned off, can you please check this script.

 

 

Link to post
Share on other sites
On 8/31/2021 at 12:03 PM, Kuuba said:

Hi Zelek,

 

 

I wanted to use this script to lure mobs, unfortunately it does not work correctly, after luring 7 mobs cavebot is turned off and targeting is activated, after killing all mobs cavebot is still turned off, can you please check this script.

 

 

It works correctly, you must be doing something wrong.

Link to post
Share on other sites

Please make macro script

macro(2500, "destroy boxes chairs", function()

and

macro(2500, "scythe wheat", function() >it should be similar because use with function

 


i have some code from riftbot(?) but rly dont know how to edit it for otcv8 (760) server

 

Quote

local FURNITURE_IDS = {2976, 2472, 2524, 2319, 2358} -- list of items to destroy
local MACHETE_ID = 3305 -- id of weapon or machete to destroy.

-- DON'T EDIT BELOW

Module.New("Destroy Furniture", function (mod)

    if Self.isConnected() then
        local pos = Self.Position()
        for x = -1, 1 do
            for y = -1, 1 do
                local item = Map.GetTopMoveItem(pos.x+x, pos.y+y, pos.z)
                if table.find(FURNITURE_IDS, item.id) then
                    -- destroy item
                    Self.UseItemWithGround(MACHETE_ID, pos.x+x, pos.y+y, pos.z, math.random(1000, 1500))

                    break
                end
            end    
        end
    end        
end)

 

or

 

tried...

 

Quote

local FURNITURE_IDS = {2976, 2472, 2524, 2319, 2358}
local MACHETE_ID = 3305

macro(2500, "Destroy Furniture",  function()
    if g_game.isOnline() then
        local pos = g_game.getLocalPlayer():getPosition()
      for _,tile in pairs(g_map.getTiles(posz())) do
        local tilePosition = tile:getPosition()
        local found = false
        if tilePosition.x == pos.x + 1 and tilePosition.y < pos.y + 1 and tilePosition.y > pos.y - 1  then
          -- right 3 cells
          found = true
        end
        if tilePosition.x == pos.x - 1 and tilePosition.y < pos.y + 1 and tilePosition.y > pos.y - 1  then
          -- left 3 cells
          found = true
        end
        if tilePosition.x == pos.x and (tilePosition.y < pos.y + 1 or tilePosition.y > pos.y - 1)  then
          -- upper and below
          found = true
        end
        if found then
          local topItem = tile:getTopThing()
          if table.find(FURNITURE_IDS, topItem.id) then
            g_game.useInventoryItemWith(MACHETE_ID, topItem)
          end
        end
      end
    end        
end)

 

 

Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...