Force AI Perception to Revaluate Attitudes

I’ve overriden the “ETeamAttitude::Type GetTeamAttitudeTowards(const AActor &Other) const” method in my AIController and setting the ID in the constructor. I’ve check how often this method is called, and it seems to do it twice per pawn, but it’s only player and ai bot so maybe it’s checking its own attitude. Once on game start (I’m outside the bot’s sight perception range) and once when I enter the bot’s perception range. This is fine, since it doesn’t seem to call this method ever again. However, I want to be able to change the TeamID at anytime during runtime, but I’m unsure as to how (or what) the GetTeamAttitudeTowards is called.

Is there a way to force this method to be recalled. I don’t mind wiping the attitudes data to do this.

Looking at the definition for “SetGenericTeamID” this feature appears to be on a todo:

//----------------------------------------------------------------------//
// IGenericTeamAgentInterface
//----------------------------------------------------------------------//
void AAIController::SetGenericTeamId(const FGenericTeamId& NewTeamID)
{
	if (TeamID != NewTeamID)
	{
		TeamID = NewTeamID;
		// @todo notify perception system that a controller changed team ID
	}
}

I notice if I unregister the stimuli source from the perception system, then change the player’s team ID, the function is then recalled on the AI controller when I reregister the stimuli source to the perception system. While this seems to work on a temp bases for the Player Controller, I still wouldn’t be able to change the AIControllers ID this way.

You can call PerceptionComponent->RequestStimuliListenerUpdate()

1 Like

Thanks, works perfectly. I assumed it wouldn’t be this easy with that todo being there.