Replies: 3 comments
-
|
Forked from, since apparently this is not a currently accepted addition: |
Beta Was this translation helpful? Give feedback.
0 replies
-
class_name SomewhereNearby
extends DataLeaf
func get_main_map() -> Variant:
var maps = NavigationServer2D.get_maps()
if not len(maps):
push_error("Could not find main navigation map")
return null
return maps[0]
func get_value(_actor: CharacterBody2D, _blackboard: Blackboard) -> Variant:
var map = get_main_map()
if map == null:
return null
var random_position = Vector2(
randi_range(-10, 10),
randi_range(-10, 10),
)
return NavigationServer2D.map_get_closest_point(map, random_position) |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I did find some problems with this approach, in general if the function to collect a possible data item is slow, then it's still better to memoize the value in the
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
I have the following:

However I would much prefer:
Describe the solution you'd like
I want the character to
GoTosome place, but I don't want to have to specify that place in code every time.I want to describe a list of places:
And then apply these as a child of the
GoToaction to modify it's behaviour.DataLeaf.gdOwnRoom.gdWhich has allowed me to simplify my logic as follows:
has_own.gdown_bedroom.gdgo_to.gdAnother example use case for the
DataLeaf, stateless:AvailableWorkstation.gdSetUsed.gdWould be nice to see the

DataLeafon the flow chart, perhaps I will implement that in future.Beta Was this translation helpful? Give feedback.
All reactions