• ents.FindInBox() not returning anything
    6 replies, posted
local function PlayerStomp(ply) local StompingEnts = ents.FindInBox(ply:OBBMins(), ply:OBBMaxs()) PrintTable(StompingEnts) for k, v in pairs(StompingEnts) do print(v) if IsValid(v) and v:IsPlayer() and v:Alive() and v ~= ply then local effectpos = v:GetPos() local effectdata = EffectData() effectdata:SetOrigin(effectpos) effectdata:SetNormal(Vector(0, 0, 0)) util.Effect("BloodImpact", effectdata) --v:TakeDamage(999999999, ply, SWEP) endendend printing StompingEnts returns the table thing like 0x934232 or whatever but PrintTable doesnt print anything and
Sounds like your bounding box doesn't contain any entities then, probably because it is surrounding the player but not anything outside the players bounding box. It looks like you're trying to implement a Mario-esque stomp attack. Might I suggest a different approach? Set up a ENTITY/PhysicsCollide callback on the player, this will trigger code any time an entity collides with another physics object. The callback returns a CollisionData Structure which contains all sorts of information about the collision. You can use this to check if the entity the player collided with is ALSO a player. In order to prevent this from doing damage when you just walk into someone, you can use the HitPos and HitNormal to check if the collision came from above, and at a suitable angle. This will probably take some experimenting and fine tuning to get right, but I can assure you its a much safer and more reliable approach than checking a bounding box.
I have literally stepped inside of the ball entities and inside of a player (bot) and it didnt do anything still. also its not really coming from above, the goal is to spawn like, inside of them and then if i do it should kill them, i was kinda hoping for like a gore explosion type thing but there didnt seem to be any effects like that built in and id rather not take a crack at it myself.
Hmm okay never mind my previous suggestion then. I can't explain why its not working without seeing it in action and doing some testing myself, so I will continue to propose alternate solutions. Since you just want to know if they basically are inside of another player, couldn't you just check the distance between the two players? If its below some very small threshold, insta gib?
that could work
Please visit the wiki and read up on what the functions you used actually do. local StompingEnts = ents.FindInBox(ply:OBBMins(), ply:OBBMaxs()) The codes exactly what you told it to do. It searches entities near the center of the map in a player shaped box. Because that's what you told it to do.
fuck lmao
Sorry, you need to Log In to post a reply to this thread.