In the 38.00 update Epic intrducted sidekicks along with a way to control them in verse via scene graph, I have even seen some people make them react to specific things in their maps (being angry when near props in prop hunt), but i can’t figure out how to control them myself
Here is the documentation we currently have:
Trying to figure this out, My attempts to get the equipped_sidekick_component for a specific agents entity have failed. I’m assuming the fort character entity is supposed to have this component automatically if a player is using a side kick, I’m just not seeing it.
I’ve tried to get the component like this:
GetComponent[equipped_sidekick_component]
And Also by iterating over them:
Components := FCEntity.GetComponents()
for (Component : Components):
if (SidekickComp := equipped_sidekick_component[Component]):
I thought perhaps you have to instantiate the component your self:
equipped_sidekick_component=equipped_sidekick_component{Entity:=FCEntity}
however since it is an epic-internal class you can not instantiate it.
Update I was able to get the component and actually play a reaction on my side kick. Only issue is I am still trying to work out what the parent entity of the component is so that it can be used per agent. If that fails alternatively, the component has a function to get the agent and someone could iterate over all the side kick components, get the agent, then insert those as a key value pair of a map. After that you can refer to the map.
if(SimEntity := GetSimulationEntity[]):
SideKickComponents :=
for(TempComponent : SimEntity.FindDescendantEntitiesWithComponent(equipped_sidekick_component)):
TempComponent
Print("DEBUG: Found: {SideKickComponents.Length} ")
if(TempEntity := SideKickComponents[0]):
if (SideKickComponent := TempEntity.GetComponent[equipped_sidekick_component]):
SideKickActions := array{sidekick_reaction.Happy, sidekick_reaction.Dance, sidekick_reaction.Emote, sidekick_reaction.Angry, sidekick_reaction.Worried}
RandomAction := SideKickActions[GetRandomInt(0, SideKickActions.Length - 1)] or sidekick_reaction.Happy
Print("Debug: Got SideKick component!")
if(SideKickComponent.PlayReaction[RandomAction]):
Print("DEBUG: SideKick Play Event Success!")
Hi, sorry for the late replay, but here’s what i came up with it’s not perfect as i’m learning but it works:
UpdateSidekickBehaviour(Agent : agent, Reaction : sidekick_reaction, MaybeMood : ?sidekick_mood, AffectMood : logic)<suspends>: void =
if(SimulationEntity := Agent.GetSimulationEntity[]):
SidekickEntites := SimulationEntity.FindDescendantEntitiesWithComponent(equipped_sidekick_component)
for(SidekickEntity : SidekickEntites):
if(Sidekick := SidekickEntity.GetComponent[equipped_sidekick_component]):
if(Owner := Sidekick.GetOwningAgent[]):
if(Owner = Agent):
if(AffectMood = false):
if(Sidekick.PlayReaction[Reaction]){}
else:
if(Mood := MaybeMood?):
set Sidekick.MoodOverride = option{Mood}
else:
set Sidekick.MoodOverride = false