If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I trying to do also a script with this, but for hunt hellgorak, its almost finished just need to make some changes hehe, probably I release it when its end.

Regards,

I was testing this function and you should use CreatureType property instead of type.

You can also create variations of creatures loop, sorting the best target. For example this script will return player with the lowest hp percent to the highest.

Code:

function getCreatures(...)
local filter = type(arg[1]) == 'string' and arg[1] or "pmfs"
local sort = type(arg[2]) == 'function' and arg[2] or false
local cre, temp = getcreatures(filter), {}
local i = -1
while i < cre.count do
temp[#temp + 1] = cre[i]
i = i + 1
end
if sort then table.sort(temp, sort) end
i = 0
return function()
i = i + 1
if i <= #temp do
return temp[i].id, temp[i]
end
return nil
end
end
function sort(a, b)
return a.hpperc < b.hpperc
end
for CreatureID, CreatureObject in getCreatures("p", sort) do
print(string.format("[HP: %d] [Name: %s]", Creature.hpperc, CreatureObject.name))
end

and for exemple... a guy traps me with a ghoul/skeleton summon in cults cave - yalahar.... i dont know why... i cant move, what do I do, to walk through the summon? (OPT-PVP)

is this new funciotn related to this? :/

The main purpose of the function is detecting what type of creature you are handling. Examples on my first post.

You can use setpvpmode(0) to turn into Dove mode, and then use move(DIRECTION) to run from traps. Of course it needs a more skilled script to do this, but generally you'll end up using these functions.