How to find the position of a trigger entity?

I made a trigger entity that allows a player to capture a flag. I’m trying to make a thing that tells the player where to go, however i noticed that


for k,v in ipairs(ents.FindByClass("wb_trig_flagcap")) do

doesn’t find it at all.

is there a way to do this?

mmm in dont realy understand… What did you want ?

Creat an area and if player with flag enter in, he cap the flag ?

The way you code for finding wb_trig_flagcap is correct but somethings is wrong on your game side.
Check that your entity exists in-game.

I already have made this, and I did put it in the map, however my concern is … well i should have mentioned that it is a brush entity. I’m trying to make some huds to tell the player where to take the flag, but i cant find the position of these trigger brushes.

Even if it was a brush entity, it would works like a point entity.
I’m sure it is related to map. You should really do a check in-game if the entity is present.

Can you run this command on your map in-game and return the list of entities found?



lua_run for k,v in pairs(ents.GetAll()) do if v:GetClass() == "wb_trig_flagcap" then print("FOUND "..tostring(v)) else print(v:GetClass()) end end


Because it’s a brush entity it’s not networked to clients if I remember correctly. Because of that you won’t be able to find it client side. You could try networking this information when it changes, or you could try and mess around with

Entity:AddEFlags and EFL_FORCE_CHECK_TRANSMIT

and maybe

ENT:UpdateTransmitState

Although I’ve never used these and as such I don’t know if they’ll work



AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:KeyValue(key,value)
    if key == "team" then self.team=tonumber(value) return false end
end

function ENT:UpdateTransmitState()
    return TRANSMIT_ALWAYS
end

function ENT:Think()
	self:SetNWInt("team",self.team)
	self:AddEFlags( EFL_FORCE_CHECK_TRANSMIT )
end


tried doing this, but running gedo’s for loop does not show clientside, but you’re right, it shows serverside. ironically, i was using a FindInSphere to find it when capping