Getting variables from other objects or traits

Right now I can only share properties between objects and traits, but it would be very useful being able to fetch variables.
Is there a good way of doing this?

Variables are local to the Node Tree there are in. If you want to share that with another node tree you would have to either store the variable in a property or create a node function that returns the result of the variable.

You can see how to create node functions here, but might be easier just to use a property. Is there any problem just using properties instead of variables?

I’m getting by using properties, I can’t think of anything that you could do with variables that you can’t with properties, I just feel like it would be tidier and more confortable, but I realize it’s not that much of a problem anyway.

About node fuctions, I’m confused about their current state, I remember being able to use them in 2.79, but I can’t get to work the nodes that I got now in 2.8 with the nodepack, and they are different from the ones on the documentation or your example.


I have two identical call function nodes, one of which, in my tests, causes a crash, while the other does nothing.
This call nodes lack any value output, so I assume they are meant to be used with this other Return function node, which can have as many outputs as I like.
It would seem like there are two pairs of nodes to define a function, Function and Function Output, like the old ones, that can only output one value; and Start Function with End Function, with multiple arguments.
All nodes lack a trait input.
I don’t know if I’m doing something wrong, or if I have installed conflicting conflicting function nodes or something.

Oh, yeah, the logic pack has a different set of Function nodes, which should probably be removed. The newer function nodes are built-in to Armory and those are the ones that I linked to. I think there is a conflict there and I’m not sure if there is a way to make it with the logic pack installed without removing the other function nodes from the pack.

1 Like

I removed the relevant .py, .pyc and .hx files from the libraries folder and now it works.
Thanks, though it would have been cool to have multiple outputs per function.

It’s not a bad thought, but part of the reason there is only one output is that the Function and Call Function nodes actually work with Haxe functions as well, and Haxe only allows a single return value.

In Haxe if you want to return multiple values, you put those values in an object and then return the object. You might be able to do that with Arrays in nodes. :thinking: I’m not sure, though, I haven’t tried it. I guess maybe that could get worked into the nodes to do that for you automatically.

If you thought it would be useful you could create a feature request and maybe link back here to give some extra context.

You are correct: you put the values into an object or a structure, and return that.

This might be something that – right now – has to be done using “hand-written Haxe,” but it does sound like a good idea that maybe needs to be articulated into a feature request. Consider carefully what might be “the very best thing that you would wish for, and exactly how you would use it,” then submit that request.

New logic-node types are fairly easy to create, and the underlying software architecture is very flexible. So, the [harder …] question is “what should it be, and what should it do?” Think about it. (Please comment here to build consensus …) Once we all agree what it should be, “doing it” is easy.

1 Like

Thanks for your interest.
I’ll keep noding and using functions so I guess i’ll realise what I miss and what would be useful to implement.
As a basis to improve upon, I guess a Return Object node that works like the Call Function one but with a button to add outputs would be fine.
Note that i’m very new to programing, I hope to learn some Haxe and Python along the way as I bump into problems, but for now my understanding of how they work is really low.