Ulysses
General => Developers Corner => Topic started by: LuaTenshi on October 13, 2015, 08:50:03 PM
-
for _,v in next, ents.FindByClass("prop_*") do
local owner = APA.FindOwner(v);
local box = Vector(0,0,0);
if IsValid(owner) and IsValid(v) and not APA.IsWorld(v) then
box = v:LocalToWorld(v:GetCollisionBounds());
if box and isvector(box) then
for _,x in next, ents.FindInBox(box) do
print(v, owner, x)
if IsValid(x) and isPlayer(x) then
makeSpawnGhost(v,owner)
print(x)
end
end
end
end
end
Getting the following error...
bad argument #2 to 'FindInBox' (Vector exp
ected, got no value)
This is not the full code, but I assure you that all the functions work, but for some reason the box variable gets lost.
-
Bad argument #2 to 'FindInBox' (Vector expected, got no value)
ents/FindInBox (http://wiki.garrysmod.com/page/ents/FindInBox) takes two arguments, the box minimum and the box maximum. You're taking the return values of Entity/GetCollisionsBounds (http://wiki.garrysmod.com/page/Entity/GetCollisionBounds) and putting it in one variable, when it returns two values. Use boxMin, boxMax = v:LocalToWorld(v:GetCollisionBounds()) and then pass those arguments to ents/FindInBox.
-
Ugh, a rookie mistake. Now people are gonna laugh at me. Thanks for the help tho.
-
Ugh, a rookie mistake. Now people are gonna laugh at me. Thanks for the help tho.
Even professionals make rookie mistakes. Don't look down on yourself. ;)
-
Now people are gonna laugh at me.
No worries.
It's not just been 'now'.
/me ducks
-
No worries.
It's not just been 'now'.
/me ducks
Wooooow, Jam. Fight fire with water, not tears with a burn. :P