I am currently trying to have an enemy spawned from a creature spawner navigate to a specific point.
I believe everything is set up properly, however the code fails at,
Navigatable := Creature.GetNavigatable
Here is my code:
feindController := class(creative_device):
@editable
CreatureSpawner:creature_spawner_device = creature_spawner_device{}
@editable
NavPoint:creative_prop = creative_prop{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
CreatureSpawner.SpawnedEvent.Subscribe(OnSpawned)
OnSpawned(Agent: agent):void=
spawn:
NavTo(Agent,NavPoint)
Print("fiend spawned")
NavTo(Agent: agent, Prop: creative_prop)<suspends>:void=
Print("NavTo called")
if:
Print("if called")
Character := Agent.GetFortCharacter[]
Print("Character")
Navigatable := Character.GetNavigatable[]
Print("Navigatable")
then:
Print("then called")
NewPos := Prop.GetTransform().Translation
Print("Nav target: {NewPos}")
NewNavTo := MakeNavigationTarget(NewPos)
Navigatable.NavigateTo(NewNavTo)
Print("Navigating to: {NewPos}")
Any advice is appreciated,
Thank you!