PredeterminedMoveTowardsLocation property

Justin

Administrator
Staff member
It's a property, not a serialized field. Right now it can only be set via code. The reason for this is that the property is a single object but the MoveTowardsLocation returns an array so it's easiest to set via code to reduce confusion.
 

James

Member
re:"Right now it can only be set via code".. where in the code can I set this. I tried searching the entire solution but I can't seem to find anything.
 

Justin

Administrator
Staff member
It's on the cover ability. You can set it by doing something like:

Code:
var cover = ultimateCharacterLocomotion.GetAbility<Cover>();
cover.PredeterminedMoveTowardsLocation = yourLocation;
 

James

Member
and... "yourLocation" refers to what exactly? The location of the cover object or the location of the enemy object?
 

James

Member
I see this issue in Visual Studio, however, it compiles in Unity but shows an issue in Visual Studio 2019 Professional 16.9.3

1618070166406.png
 

James

Member
So, I seem to be back to square one here. I've tried the code snipped you posted but still no luck. I have a very small simple scene setup, two cover points, but the AI just ignores the cover positions no matter what I seem to try.

Will the AI use cover positions during combat phase?
 

Justin

Administrator
Staff member
The PredeterminedMoveTowardsLocation should point to the Transform that the MoveTowardsLocation component has been added to. The StartCover task uses this to tell the AI agent what cover position to take.

Code:
            m_Cover.PredeterminedMoveTowardsLocation = m_CoverPoint.Value.MoveTowardsLocation;
 

James

Member
Here's what I've been playing with, no luck.


public class DeleteThis : MonoBehaviour
{
public UltimateCharacterLocomotion ultimateCharacterLocomotion;
public MoveTowardsLocation MoveToLocation;

void Start()
{
Cover cover = ultimateCharacterLocomotion.GetAbility<Cover>();
cover.PredeterminedMoveTowardsLocation = MoveToLocation;
}
}
 

James

Member
also, once I get this working what is the best way to keep AI actors in a certain area dedicated to seeking cover and fighting from cover?

I'm trying to get that same feeling from playing AI like in Gears of War, I'm sure Opsive AI can handle this, just looking for "best practices" or best known solutions for this kind of behavior
 

James

Member
1619617947333.png

I find this an odd part of the code.

The m_DetectedObject seems to be generic items that do NOT have MoveTowardsLocation associated with them.

Debugging this I notice that it can return projectiles, blank primitives, etc all items that do not have any MoveTowardsLocation scripts attached?
 
Top