Giving an NPC Memory
Jump to navigation
Jump to search
Entity memory
NPCs can remember other entities in two ways:
Enemies
An NPC's combat memory is managed by the CAI_Enemies class.
Todo: Document it.
UpdateEnemyMemory( CBaseEntity *pEnemy, const Vector &position, CBaseEntity *pInformer )ClearEnemyMemory()SetEnemyOccluder(CBaseEntity *pBlocker)
Unreachable
RememberUnreachable( CBaseEntity *pEntity, float duration = -1 )- Causes the NPC to ignore the entity for the specified number of seconds. -1 means the AI's default, which is usually 3 seconds.
IsUnreachable(CBaseEntity *pEntity)- Test reachability.
Memory Bits
Memory bits are flags which relate to the NPC's current state (for example, bits_MEMORY_SUSPICIOUS and bits_MEMORY_FLINCHED). See game/server/ai_basenpc.h for a full list.
Remember(int iMemory)Forget(int iMemory)- Set/remove a particular bit.
HasMemory(int iMemory)HasAllMemories(int iMemory)- Check whether one or more memory bits are set.
CAI_SchedulesManager::GetMemoryID(const char *state_name)- Modify this function to add support for extra memory bits in schedule definitions. You shouldn't need to call it yourself.