##Long title, hopefully short post.
So I’m trying to set up some logic in skookum again, and I’ve got a few things going. I’ve run into a semi snag. I’d like to have a node that finds a nearby random point from a special
NodeWeb_BP actor. It’s simple enough, and just contains an array of points. I’d like to make a node that returns said point, so I made a SK method script, and set it up like so:
Simple enough, just a return of vector 3, and I can let the blueprint handle the logic, right?
The return node is on the parameter side! Also, the error is not good either.
The error is a “signature mismatch” by the way.
So I have begun writing the node in skookum, because it’s a simple enough node, but I’m just trying out all the things currently.
So that leads us to:
Here’s the gist of what the node needs to do :
So is there a way to find the closest instance to an actor? Or how do I do something similar with skookum?
I’m still trying to learn the ins and out of the syntax, so I’m currently a dunce.
Thanks in advance!
P.S. I’m currently downloading the newest launcher version of skookum, so if you’re like “Hey, we fixed that!” you might have, and I’m just not there yet.
###[EDIT] Set up some code after looking around at how to handle lists in the docs.
&blueprint () Vector3 [ //Initially, this will be used to test web position !found_pos : Vector3! //Storing closest to reduce number of .distance() calls. !closest_dist : Real! !found_web : NodeWeb_BP.instances.first !current_pos : transform.@translation NodeWeb_BP.instances.do [ !dist : item.transform.@translation.distance( current_pos ) //If closer than closest so far or just the first if [ [dist < closest_dist] or [closest_dist = 0.0] ] [ if not item = found_web [println( item.name " is closer than " found_web.name )] closest_dist := dist found_pos := item.transform.@translation found_web := item ] ] println("Chosen web : " found_web.name) //Now we start using 'found_pos' to store actual goal //Vectors are in local space, due to how UE4 handles placeable vectors found_pos := MathLib.transform_location(found_web.transform found_web.@points.any) found_pos ]
important part really is
item. All seems good now!
If there’s a more optimized solution, please share!
Otherwise, I think we might be cooking with gas now!