Jump to content

Request Script


Zelek

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 comment
Share on other sites

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 comment
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 comment
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 comment
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 comment
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 comment
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

  • Thanks 1
Link to comment
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 comment
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 comment
Share on other sites

  • 2 weeks later...
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 comment
Share on other sites

20 hours ago, Rikos1 said:

Hi, i need script for drop items, like toput on waypoint action and then drop ID item on this sqm, anyone?

 

 

The search function is a wonderful thing.

 

 

Just remove the Auto part at the bottom and put it in an action waypoint.

I haven't used it personally, but I assume it works.

 

- Tokumei

Edited by Tokumei
Clarification
Link to comment
Share on other sites

×
×
  • Create New...