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 307
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

local idsToFind = {3031, 3035} local tiles = g_map.getTiles() for _, tile in pairs(tiles) do local topItem = tile:getTopItem() if topItem then for _, id in pairs(idsToFind) do

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

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
14 hours ago, Rishi said:

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

creatures = g_game.getCreatures()

pairs(creatures)
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...

This is not really a script request so I'm not sure if I'm posting this in the right area, but I was wondering if it's possible to use the hotkey script function to change a variable for a persistent script.

 

One alternative solution I thought of was to simply call one of two variations of the script through a hotkey, but not sure how to do this or if it's possible either.

local variable1 = true
if variable1 == true then
	variable1 = false
else
	variable1 = true
end

if variable1 == true then
	-- call persistentScript1
else
	-- call persistentScript2
end

 

Any advice would be appreciated

 - Tokumei

 

Edited by Tokumei
Link to post
Share on other sites
On 10/18/2021 at 10:41 PM, Kuuba said:

Hi Zelek,

 

i need a script that will fallow specifid player when no monster is targeted.

 

This should do the trick. I haven't tested it a lot so let me know if it works as intended.

--------------------------------------------
--    Follow Player When Not Attacking
--             by Tokumei
--------------------------------------------
--    Version 1.0 (21/10/2021)
--------------------------------------------

-- Edit this part --
local friend = "Tokumei"    -- Name of player you want to follow.

-- Don't edit this unless you know what you're doing --
local creature
local creatures = g_game.getCreatures()

for v, k in pairs(creatures) do
  if k:getName() == friend and k:isPlayer() then
    creature = k
    break
  end
end
if not g_game.isAttacking() and not g_game.isFollowing() and creature then 
  g_game.follow(creature)
end

auto(100, 250)

 

- Tokumei

Link to post
Share on other sites
On 10/22/2021 at 11:36 PM, Rise said:

Hey can anyody write me a script that SKINS{with item} dead body?

 

If you used the search function you would have found this script.

I have no idea if it works or not though as I haven't tested it.

 

 

- Tokumei

Edited by Tokumei
Spelling
Link to post
Share on other sites

 HELLO !!! Hello im play in NARUTO STORY OTS  and character have spell to throw sword on monster and this sword fly on floor and  have id 10896 ... when im pick up " stand up on this sql floor id sword10896 " CD spell its 0.  " PLEASE SCRIPT FOR THIS SPELL 🙂 im need to chracter use spell and always go stand on this id sql floor. Can u make this script for me please very very very please

 

name spell " Hisenken "

id sword on floor  " 10896 "

Link to post
Share on other sites
On 2/7/2021 at 7:42 PM, Zelek said:

function Position:isInRange(from, to)
	local zone = {
		nW = {
			x = (from.x < to.x and from.x or to.x),
			y = (from.y < to.y and from.y or to.y),
			z = (from.z < to.z and from.z or to.z)
		},
		sE = {
			x = (to.x > from.x and to.x or from.x),
			y = (to.y > from.y and to.y or from.y),
			z = (to.z > from.z and to.z or from.z)
		}
	}

	if  self.x >= zone.nW.x and self.x <= zone.sE.x
	and self.y >= zone.nW.y and self.y <= zone.sE.y
	and self.z >= zone.nW.z and self.z <= zone.sE.z then
		return true
	end
	return false
end

local fromPos = Position.new(123, 456, 7) -- top left corner
local toPos = Position.new(321, 654, 7) -- bottom right corner

local playerPos = g_game.getLocalPlayer():getPosition()

if not playerPos:isInRange(fromPos, toPos) then
    playSound("alarm.wav")
    if getOption("Global/BotPaused") == "false" then
        setOption("Global/BotPaused", "true")
        sleep(300000)
    end
    if getOption("Global/BotPaused") == "true" then
        setOption("Global/BotPaused", "flase")
    end
end

auto(500)

 

This Doesnt work. Lua error

Could you fix the code? Banners usually teleport players somewhere if they expect the player to use cavebot so this script would be much appreciated to working

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

Could you edit this script so the values are set more randomly not only 2 values?

I mean a range lets say for example from 25-50 and from 100-250

if g_game.isAttacking() then
  setOption("Cavebot/WalkDelay", "180")
else
  setOption("Cavebot/WalkDelay", "25")
end
auto(100)

 

Link to post
Share on other sites
On 11/14/2021 at 9:18 PM, wasiex said:

Could you edit this script so the values are set more randomly not only 2 values?

I mean a range lets say for example from 25-50 and from 100-250


if g_game.isAttacking() then
  setOption("Cavebot/WalkDelay", "180")
else
  setOption("Cavebot/WalkDelay", "25")
end
auto(100)

 

 

I don't think it's necessary to use here, but you could probably use the math.random() function.

 

local randomizer01 = tostring(math.random(150,200))		-- returns a random number between 150 and 200
local randomizer02 = tostring(math.random(20,50))		-- returns a random number between 20 and 50

if g_game.isAttacking() then
  setOption("Cavebot/WalkDelay", randomizer01)
else
  setOption("Cavebot/WalkDelay", randomizer02)
end
auto(100)

 

I haven't tested it at all though. Let me know if it works.

 

- Tokumei

  • Thanks 1
Link to post
Share on other sites
21 hours ago, Ruchacz said:

Can i have script for ene ring ?

 

Unfortunately I don't think it's currently possible to equip items. 

I could be wrong, hopefully I am, and someone else could show us how to do that.

 

- Tokumei 

Link to post
Share on other sites

×
×
  • Create New...