• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ request for help, a script that targets specific sqm

Snowden

New Member
Joined
Dec 23, 2023
Messages
3
Reaction score
0
GitHub
Snow
if you culd help with a script that targets all the monster in a specific sqm no mather how many other monsters are, like in the image, i only want to kill the one in the red circle
 

Attachments

Lua:
local function targetPosition(position)
    local tile = Tile(position)
    if not tile then
        return false
    end

    local creatures = tile:getCreatures()
    if #creatures == 0 then
        print("No creatures found on tile.")
        return true
    end

    local creatureNames = {}
    for i = 1, #creatures do
        table.insert(creatureNames, creatures[i]:getName())
    end

    print("The creatures found on the tile are: " .. table.concat(creatureNames, ", "))
    return true
end
 
Lua:
local function targetPosition(position)
    local tile = Tile(position)
    if not tile then
        return false
    end

    local creatures = tile:getCreatures()
    if #creatures == 0 then
        print("No creatures found on tile.")
        return true
    end

    local creatureNames = {}
    for i = 1, #creatures do
        table.insert(creatureNames, creatures[i]:getName())
    end

    print("The creatures found on the tile are: " .. table.concat(creatureNames, ", "))
    return true
end
can you explain how it works, because is not :(
 
Back
Top