• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run
Formations [Bind]

Release Formations [Bind] 1

SpecialEd

Lua Slayer
Creator
Commits
3
SpecialEd submitted a new resource:

Formations [Bind] - Making you look like a bot group since today

Instructions

1) created "binds" directory under your lua folder
2) copied the formations.lua into the "binds" directory


Start the script - /lua run binds/formations

Usage -

/formation <name> [parameters]

Example -

/formation halfmoon 25 on

Adding formations -

Add your function to the formations table -

Code:
-- this would add an "example" formation
-- Usage: /formation example [dist] [someRandomizeValue] [debug]
formations.example = function(dist...

Read more about this resource...
 
You would have to set the formation then /camphere or whatever the equivalent is for the system you are using, then they'd stay put.

For example, any melee characters will move to fight the mob, then if i have the scatter option in MA/KA selected, they'll land close to their original point (+- 10 or whatever you have it set at). With scatter off, they'll go back to the original location. Casters who don't melee will sit there indefinitely until I tell them to chase again.
 
I think burd was asking about holding the formation while moving - like ISB flying v / star. This just spreads toons out - holding while moving would be neat, though.
 
Just because I can't leave well enough alone, I've tweaked the Lua (learning by plagiarism and tweaking for 30+ years for the win!) Added a random scatter function, will work with your current group, or a raid, and will randomly calculate a bearing from 0-360, and accepts a distance to move which is randomly generated for each character from 1 to <your value>:
INI:
--[[
    Created by Special.Ed
        halfmoon formation - ported from kaens macro
    Shout out to the homies:
        Lads
        Dannuic (my on again off again thing)
        Knightly (no, i won't take that bet) (he knows math too)
    Modded by Toadwart - 210906
        Added the ranscatter formation, and a print function when first run
--]]

local mq = require('mq')
local formations = {}

local Output = function(msg) print('\aw[\atFormations :: Bind\aw] \a-t' .. msg) end
local Debug = function(msg) Output('[Debug] '..msg) end

local print_usage = function()
    local vals = ''
    Output('Usage: /formation <name>')
    for k, v in pairs(formations) do vals = vals .. k .. ', ' end
    Output('Available formations: ' .. vals:gsub(', $', ''))
end

-- add your formation code like this
-- note: they can take whatever arguments you want to pass in

-- formations.example = function(dist, someRandomizeValue, debug, etc...)
--   -- do the things
-- end

formations.halfmoon = function(dist, debug)
    -- set defaults
    dist = dist or 10
    if debug == 'on' then
        Debug('Debugging On')
        debug = true
    else
        Debug('Debugging Off')
        debug = false
    end

    -- check inputs / print formation usage
    if tonumber(dist) == nil then
        Output('Usage: /formation halfmoon [dist = #] [debug = on|off]')
        return
    end

    -- calc the things
    for i = 1, mq.TLO.Group.Members() do
        local y = mq.TLO.Me.Y() + (dist * math.sin(((i * 36) + (mq.TLO.Me.Heading.Degrees() - 198)) / (180 / math.pi)))
        local x = mq.TLO.Me.X() + (dist * math.cos(((i * 36) + (mq.TLO.Me.Heading.Degrees() - 198)) / (180 / math.pi)))
        local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(i).Name(), y, x)
        mq.cmd[cmd]()
        if debug then Debug('/'..cmd) end
        mq.delay(100)
    end
end

formations.ranscatter = function(dist, debug)
    -- set defaults
    if debug == 'on' then
        Debug('Debugging On')
        debug = true
    else
        Debug('Debugging Off')
        debug = false
    end

    -- check inputs / print formation usage
    if tonumber(dist) == nil then
        Output('Usage: /formation ranscatter [dist = #] [debug = on|off]')
        return
    end

    -- calc the things
    if mq.TLO.Raid.Members() > 0 then
        for i = 1, mq.TLO.Raid.Members() do
            local dist = math.random(1,dist)
            local dir = math.random(0,360)
            local y = mq.TLO.Me.Y() + (dist * math.sin(dir))
            local x = mq.TLO.Me.X() + (dist * math.cos(dir))
            if debug then print("Dist: ",dist," Dir: ",dir," X: ",x," Y: ",y) end
            local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Raid.Member(i).Name(), y, x)
            mq.cmd[cmd]()
            if debug then Debug('/'..cmd) end
            mq.delay(100)
        end
    else
        for i = 1, mq.TLO.Group.Members() do
            local dist = math.random(1,dist)
            local dir = math.random(0,360)
            local y = mq.TLO.Me.Y() + (dist * math.sin(dir))
            local x = mq.TLO.Me.X() + (dist * math.cos(dir))
            if debug then print("Dist: ",dist," Dir: ",dir," X: ",x," Y: ",y) end
            local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(i).Name(), y, x)
            mq.cmd[cmd]()
            if debug then Debug('/'..cmd) end
            mq.delay(100)
        end
    end
end

--call usage when lua first run for a default message to user
print('\arAssumes that you are in a safe location to use a formation where doing so will not send\ax')
print('\arone of the toons over a cliff due to a large distance. The onus is on you to verify spread!\ax')

print_usage()

local bind_formation = function(name, ...)
    local args = {...}
    if formations[name] ~= nil then
        formations[name](unpack(args))
    else
        print_usage()
    end
end

mq.bind('/formation', bind_formation)

while true do mq.delay(100) end

syntax after loading: /formations ranscatter 34
-would calculate a random bearing, and a distance for each toon from 1-34 and nav them to the new location. Use at own risk around cliffs/water/void/lava etc!
 
I think burd was asking about holding the formation while moving - like ISB flying v / star. This just spreads toons out - holding while moving would be neat, though.

I did this with dannet and it works great. There was some airplane simulation site that I got the idea from. They allow you to spawn aircraft, and they had a Lua implementation. Basically you check your current loc every 500ms and then tell each of your teammates where to move using mq2nav. That way you don't have little ducklings running behind you. My crew looked more like a football O-Line lol

Don't have the file or I would post it. It was a fun afternoon, but in the end, don't really care if I have 6 toons all following each other or running side-by-side or in some box formation.
 
So i was bored and trying to test out chatgpt.
i asked it to help out and create formations and then tested them they work pretty good so here is some formations all of them function well but some might need tweaking! I have tested all in game

Formations
Lua:
formations.line = function(dist, debug)
    -- set defaults
    dist = dist or 10
    if debug == 'on' then debug = true else debug = false end

    -- check inputs / print formation usage
    if tonumber(dist) == nil then
        Output('Usage: /formation line [dist = 10] [debug on|off]')
        return
    end

    -- calc the things
    for i = 1, mq.TLO.Group.Members() do
        local y = mq.TLO.Me.Y() + (i * dist)
        local x = mq.TLO.Me.X()
        local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(i).Name(), y, x)
        mq.cmd[cmd]()
        if debug then Debug('/'..cmd) end
        mq.delay(100)
    end
end

formations.trapezoid = function(base_dist, height_dist, debug)
    -- set defaults
    base_dist = base_dist or 20
    height_dist = height_dist or 10
    if debug == 'on' then debug = true else debug = false end

    -- check inputs / print formation usage
    if tonumber(base_dist) == nil or tonumber(height_dist) == nil then
        Output('Usage: /formation trapezoid [base_dist = 20] [height_dist = 10] [debug on|off]')
        return
    end

    local i = 1
    local first_half = (mq.TLO.Group.Members() + 1) / 2
    for y_offset = 0, height_dist, height_dist do
        for x_offset = -(base_dist / 2), base_dist / 2, base_dist do
            if i <= mq.TLO.Group.Members() then
                local y = mq.TLO.Me.Y() + y_offset
                local x = mq.TLO.Me.X() + x_offset
                if i <= first_half then
                    x = x - (base_dist / 4)
                else
                    x = x + (base_dist / 4)
                end
                local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(i).Name(), y, x)
                mq.cmd[cmd]()
                if debug then Debug('/'..cmd) end
                mq.delay(100)
                i = i + 1
            end
        end
    end
end

formations.x = function(dist, debug)
    dist = dist or 10
    if debug == 'on' then debug = true else debug = false end

    if tonumber(dist) == nil then
        Output('Usage: /formation x [dist = 10] [debug on|off]')
        return
    end

    local num_members = mq.TLO.Group.Members()
    local x_center = mq.TLO.Me.X()
    local y_center = mq.TLO.Me.Y()
    local degree_inc = 360 / num_members

    for i = 1, num_members do
        local x = x_center + dist * math.cos((i * degree_inc - 90) * (math.pi / 180))
        local y = y_center + dist * math.sin((i * degree_inc - 90) * (math.pi / 180))
        local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(i).Name(), y, x)
        mq.cmd[cmd]()
        if debug then Debug('/'..cmd) end
        mq.delay(100)
    end
end

formations.hammer = function(dist, debug)
    -- set defaults
    dist = dist or 10
    if debug == 'on' then debug = true else debug = false end
 
    -- check inputs / print formation usage
    if tonumber(dist) == nil then
      Output('Usage: /formation hammer [dist = 10] [debug on|off]')
      return
    end
 
    -- calculate positions for the front two members
    local y1 = mq.TLO.Me.Y() + dist
    local x1 = mq.TLO.Me.X() - (dist / 2)
    local y2 = mq.TLO.Me.Y() + dist
    local x2 = mq.TLO.Me.X() + (dist / 2)
 
    -- calculate positions for the back three members
    local y3 = mq.TLO.Me.Y() - (dist * 2)
    local x3 = mq.TLO.Me.X() - dist
    local y4 = mq.TLO.Me.Y() - (dist * 2)
    local x4 = mq.TLO.Me.X()
    local y5 = mq.TLO.Me.Y() - (dist * 2)
    local x5 = mq.TLO.Me.X() + dist
 
    -- move the front two members
    local cmd1 = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(1).Name(), y1, x1)
    mq.cmd[cmd1]()
    if debug then Debug('/'..cmd1) end
    local cmd2 = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(2).Name(), y2, x2)
    mq.cmd[cmd2]()
    if debug then Debug('/'..cmd2) end
 
    -- move the back three members
    local cmd3 = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(3).Name(), y3, x3)
    mq.cmd[cmd3]()
    if debug then Debug('/'..cmd3) end
    local cmd4 = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(4).Name(), y4, x4)
    mq.cmd[cmd4]()
    if debug then Debug('/'..cmd4) end
    local cmd5 = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(5).Name(), y5, x5)
    mq.cmd[cmd5]()
    if debug then Debug('/'..cmd5) end
 
    mq.delay(100)
  end
 


formations.star = function(dist, debug)
    -- set defaults
    dist = dist or 10
    if debug == 'on' then debug = true else debug = false end

    -- check inputs / print formation usage
    if tonumber(dist) == nil then
        Output('Usage: /formation star [dist = 10] [debug on|off]')
        return
    end

    -- calc the things
    for i = 1, mq.TLO.Group.Members() do
        local angle = (i - 1) * 360 / mq.TLO.Group.Members() + (mq.TLO.Me.Heading.Degrees() - 180)
        local y = mq.TLO.Me.Y() + dist * math.sin(angle / (180 / math.pi))
        local x = mq.TLO.Me.X() + dist * math.cos(angle / (180 / math.pi))
        local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(i).Name(), y, x)
        mq.cmd[cmd]()
        if debug then Debug('/'..cmd) end
        mq.delay(100)
    end
end

formations.arrow = function(dist, debug)
    dist = dist or 10
    if debug == 'on' then debug = true else debug = false end
    
    if tonumber(dist) == nil then
      Output('Usage: /formation arrow [dist = 10] [debug on|off]')
      return
    end
 
    -- position the first member behind you
    local x = mq.TLO.Me.X() - dist
    local y = mq.TLO.Me.Y()
    local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(1).Name(), x, y)
    mq.cmd[cmd]()
    if debug then Debug('/'..cmd) end
    mq.delay(100)
 
    -- position the second member to your left
    x = mq.TLO.Me.X() - (dist / 2)
    y = mq.TLO.Me.Y() + (dist / 2)
    cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(2).Name(), x, y)
    mq.cmd[cmd]()
    if debug then Debug('/'..cmd) end
    mq.delay(100)
 
    -- position the third member to your right
    x = mq.TLO.Me.X() + (dist / 2)
    y = mq.TLO.Me.Y() + (dist / 2)
    cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(3).Name(), x, y)
    mq.cmd[cmd]()
    if debug then Debug('/'..cmd) end
    mq.delay(100)
 
    -- position the fourth member ahead of you
    x = mq.TLO.Me.X() + dist
    y = mq.TLO.Me.Y()
    cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(4).Name(), x, y)
    mq.cmd[cmd]()
    if debug then Debug('/'..cmd) end
    mq.delay(100)
  end

  formations.diamond = function(dist, debug)
    -- set defaults
    dist = dist or 10
    if debug == 'on' then debug = true else debug = false end

    -- check inputs / print formation usage
    if tonumber(dist) == nil then
        Output('Usage: /formation diamond [dist = 10] [debug on|off]')
        return
    end

    -- calc the things
    for i = 1, mq.TLO.Group.Members() do
        local angle = (i - 1) * 360 / mq.TLO.Group.Members() + mq.TLO.Me.Heading.Degrees() - 90
        local y = mq.TLO.Me.Y() + (dist * math.sin(angle / (180 / math.pi)))
        local x = mq.TLO.Me.X() + (dist * math.cos(angle / (180 / math.pi)))
        local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(i).Name(), y, x)
        mq.cmd[cmd]()
        if debug then Debug('/'..cmd) end
        mq.delay(100)
    end
end

formations.triangle = function(dist, debug)
    dist = dist or 10
    if debug == 'on' then debug = true else debug = false end

    if tonumber(dist) == nil then
        Output('Usage: /formation triangle [dist = 10] [debug on|off]')
        return
    end

    local x = mq.TLO.Me.X()
    local y = mq.TLO.Me.Y()
    local angle = 60

    for i = 1, mq.TLO.Group.Members() do
        local new_x = x + (dist * math.cos((angle * (i - 1)) / (180 / math.pi)))
        local new_y = y + (dist * math.sin((angle * (i - 1)) / (180 / math.pi)))
        local cmd = string.format('dex %s /moveto loc %.2f %.2f', mq.TLO.Group.Member(i).Name(), new_x, new_y)
        mq.cmd[cmd]()
        if debug then Debug('/'..cmd) end
        mq.delay(100)
    end
end
 
Release Formations [Bind]

Users who are viewing this thread

Back
Top
Cart