Lots of trouble with finding objects

cup of cake

Member... or am i?
EDIT: I found the solution! Turns out i forgot to pass parameters to for mobj in mobjs.iterate(mobj) :dramahog:
But now the issue is that i can't locate the closest object of that type, atleast, i couldn't find a function for it, unless i have to make the code myself which sucks.

So, i'm trying to make a grabbing and throwing function similar to the pikmin series for a character i'm making.
The problem? I CANNOT for the life of me figure out how to find objects of a specific type.
Let's say i want to find MT_THING.

I've tried using searchBlockmap:
Lua:
local function search()
searchBlockmap("objects", function(refmobj, foundmobj), player.mo)
end
addHook("SpinSpecial", search)

local function function(refmobj, foundmobj)
if foundmobj.type == MT_THING then
    print("found mt_thing")
    end
end
It didn't seem to activate the print no matter what i tried.

I've tried for mobj in mobjs.iterate:
Lua:
local function search(player)
    for mobj in mobjs.iterate
    if mobj.type == MT_THING then
    print("found mt_thing")
    end
    end
end
addHook("SpinSpecial", search)
Similarly either didn't work or just flatout crashed my game.

I can't use P_LookForEnemies either, since MT_THING isn't supposed to be an enemy.
Am i using these functions incorrectly? Are there any others?
 
Last edited:

Who is viewing this thread (Total: 0, Members: 0, Guests: 0)

Back
Top