Task to do SeekAndPickup - best approach?

corb555

New member
I use the BD UtilitySelector and a custom TaskScore Decorator to determine which task to perform. An example of the TaskScore decorator would be to return a high score for seeking a HealthPickup if our health is low and a HealthPickup is visible and nearby. I'm writing a task which will do an atomic Seek and Pickup object. This is basically a standard Seek to the object (with automatic UIS object pickup). However, I want to return Failure if it is not able to be added to UIS for any reason. Without this the TaskScore will keep returning a high score for Health Pickup even if it is impossible to add the pickup object to the UIS Inventory DB. I have two questions about the approach to implement this: 1) In the SeekAndPickup task, after I reach the pickup item, I need to monitor if the item was added to the DB. My plan is to a) listen to the Inventory Add event in SeekAndPickup, b) when that event occurs for our desired object, set a pickedUp flag, c) in the OnUpdate routine, once we have arrived at the item, return Success once the pickedUp flag is set and return TaskStatus.Failure if it is not set after 50? millis after we reached the item. Is this a reasonable approach? 2) The second question: the TaskScore Decorator needs to know if the chosen task (SeekAndPickup) returned TaskStatus.Failure. If it fails, TaskScore will lower the score by X percent for Y millis so we select a different task instead of repeatedly doing something that will fail. To do this, I was just going to add OnChildExecuted(TaskStatus childStatus) and set timer/flag if the return is Failure. Again, is this the best approach? (Sample BD diagram below with the custom TaskScore and standard Seek. Note, all the Score Tasks are the same routine with different parameters)BD Task Score.png
 
In the SeekAndPickup task, after I reach the pickup item, I need to monitor if the item was added to the DB. My plan is to a) listen to the Inventory Add event in SeekAndPickup, b) when that event occurs for our desired object, set a pickedUp flag, c) in the OnUpdate routine, once we have arrived at the item, return Success once the pickedUp flag is set and return TaskStatus.Failure if it is not set after 50? millis after we reached the item.
Your task could detect if it's within the trigger, and then it knows the next frame whether or not the item has been picked up. This was you are not waiting an arbitrary amount of time for a failure.

To do this, I was just going to add OnChildExecuted(TaskStatus childStatus) and set timer/flag if the return is Failure. Again, is this the best approach?
That'll work.
 
Top