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
-
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
GoTo
some 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
GoTo
action to modify it's behaviour.DataLeaf.gd
OwnRoom.gd
Which has allowed me to simplify my logic as follows:
has_own.gd
own_bedroom.gd
go_to.gd
Another example use case for the
DataLeaf
, stateless:AvailableWorkstation.gd
SetUsed.gd
Would be nice to see the

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