Download

its posible to use SetGenericTeamId in c++ component class

hi, i want to setup team for ai perception, i follow this tutorial https://www.thinkandbuild.it/ue4-ai-perception-system/ in this tutorial the function its inside a c++ class child of ai controller, i want to do same thing but in a component c++ class, so it can be reusable in other actor the equip. but im very noob in c++, somebody can help please? thanks

Hi you could create a team actor component and could have team id, team name etc on this Then after creating you would add this in each actor, and then you could override GetTeamAttitudeTowards in your ai controller.

thanks, i will try

i tried but cat get to work, i make a component with id and call c++ funcion to change tema, but dont work. can anyone help please?

#pragma once
#include “CoreMinimal.h”
#include “AIController.h”
#include “aic_equipos.generated.h”
UCLASS(Blueprintable)//Blueprintable creo que no hace falta
class BASEUNREAL_API Aaic_equipos : public AAIController
{
GENERATED_BODY()

public :

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = “equipos”)

FGenericTeamId idEquipo;

UFUNCTION(BlueprintCallable, Category = “equipos”)
void EscribirEquipo(int _numeroEquipo);

};

// --------------------------------------------------------------------------------------------------------------------------------------
#include “aic_equipos.h”

void Aaic_equipos::EscribirEquipo(int _numeroEquipo)
{

idEquipo = FGenericTeamId(_numeroEquipo);
SetGenericTeamId( FGenericTeamId ( _numeroEquipo) );

idEquipo = GetGenericTeamId();

}

i follow this tut