Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.
How do I…
get the external events to make joints using global varibles
What is the expected result
that if i go to the next level, joints will update global varibles relateing to the joint so i can have my triggers work better and not have guess about what id a joint will have
What is the actual result
confusion because some enemys in level 2 won’t move when activated, they worked fine before trying to do this, only in level 1 enemys are working properly, need help
Currently, you can only use scene variables within the create joint events. You would need to assign the scene variable to a global variable afterwards. Personally, I like to assign the joint IDs to an object variable. (after the joint is created)
I guess if you wanted to store the joint ID to a global variable for multiple scenes using a shared external events then you could use a global structure variable with a child name using the CurrentSceneName() expression.
Add joint using tempID as the variable name
Set JointID[CurrentSceneName()] = tempID
I think they’re slowly moving that way. All variables are starting to be treated as equals. There’s no reason to require a certain type. There are still a few hold outs like joint IDs and the raycast return coordinates.
Why do you want a joint id to be global? It is only valid for the scene it has been created in. If you start another scene (or restart the current), then the old id will be pointless because the joint won’t exist any longer.
well it would auto update joint id’s which means we can use the external events to make the code and have it just use a global varible so we don’t need to rewrite the code every time you have a new scene and re make every variable per object, meaning if your making a game with say 10 scenes or levels, and you use joints alot, you don’t need to make seperate sets of code for each level per joint, as instead you could just use one set of code that will just read and use globals meaning code won’t be just for the one scene, but for all, meaning we won’t be guessing the ids, meaning its much better
you would probably be able to use scene variables as well, but it would be best to not have to re write code every time i make a scene, and every time i need to activate certain joints i would rather use a global variable rather than guess
Have you looked into extension scene variables? I’d suggest them over extension global variables to avoid ids hanging round from one scene to another and causing confusion: