Entity Flag info


(DrEvil) #1

So I’m working on some auto detection for my bot for CTF flag type goals such as the radar parts in the radar map. I’ve noticed the BotCarryingFlag function, as well as the BG_CanItemBeGrabbed function. These work alright, but BG_CanItemBeGrabbed fails when the parts are dropped somewhere. I’ve looked at BotFlagAtBase, and tried to look at the ent->flags & FL_DROPPED_ITEM but it doesn’t seem to be set. Anyone know of some other variable in the entity that ties a flag to its carrier? Or one that ties a carried to a specific flag?

The best I can find is the poweups flags like if(pEnt->client->ps.powerups[PW_REDFLAG] || pEnt->client->ps.powerups[PW_BLUEFLAG]) , but that gives no info as to what flag the guy is carrying.

Anyone got any ideas?


(EB) #2

http://forums.bots-united.com/index.php?

look for the “FRITZ-BOT” forum…and ask Malifecus.


(Mr.Mxyzptlk) #3

If I understand you correctly, the problem is you wish to see if flag is stolen or returned.
and if the ‘stealable’ type objectives have an entityState_t, then take a look
at g_team.c, function Team_TouchEnemyFlag() and there it sets entityState_t.density = 0 for stolen, and inversely, function Team_ReturnFlagSound() sets entityState_t.density = 1 when returned. Note sure about the 3rd possible state… captured.


(DrEvil) #4

Sure, but density stays 0 when its dropped on the ground, and BG_CanItemBeGrabbed returns false when its on the ground, even tho its available for pickup. BG_CanItemBeGrabbed checks the density as you describe, but doesnt account for availability when dropped. Some of the old AI code checks ent->flags & FL_DROPPED_ITEM, but this never seems to be set when I look at the values when I’ve dropped a flag. I’ll figure it out at some point.


(DrEvil) #5

nm, I see now that the dropped entity isn’t even the same entity as the original one that was picked up. A new entity is created every time you drop a ‘flag’. What a pain.