I was trying to make a behavior function and I ran into a problem where the “Trigger Once” condition only works sometimes. Not sure if this is a bug or if more likely I’m just failing to understand something. These pictures help to explain what’s going on.
This picture takes place in the behavior function I made and does’t work as intended. The first “Trigger Once” works fine and the Object is created. But the actions in the second “Trigger Once” don’t happen.
Since I’m a new user I could only put one image, but essentially its the same picture as the first except the bottom events are not connected to a “Trigger Once”, and everything works as I intended it to. I also know that the Object and HPBackground were linked because 1. the actions in the bottom events worked and 2. in a different function I moved each HPbackground on top of their linked Objects and every instance of the Object had a HPbackground in the right position.
So I’m not sure why the second “Trigger Once” actions don’t happen. Any ideas or explanations?
I would try to use “trigger once” as part of the events in the sub-conditions instead of making those blocks as sub-conditions of “trigger once” - I hope that makes sense. Have you tried that already?
Yes, hmm…It may be that you’re missing another type of condition to trigger the actions, like a variable, collision checking, mouse or keyboard command - something like that.
No I don’t have anything else in place to keep these events from working other than the “If HPBackground is linked to Object”
The actions works when I by pass the trigger once condition. As so
The first trigger once seems to work fine. And I know that the two objects are linked together since the actions are done. However once I put the second trigger once condition in it doesn’t work anymore
I meant that perhaps you need to add another condition; just don’t know which - if any - would be appropriate for your project. Maybe someone with more knowledge of linked object conditions can offer advice as I haven’t worked with that one yet.
The other possibility is that it doesn’t need “trigger once” if it works as desired without it.
Yeah your right in this case I could leave the event block with out the trigger once since the actions don’t take much resources to accomplish.
Or I could simply put everything in the top “trigger once” block, but I just used this as a simple example some things I need to have several different “trigger once” blocks to accomplish things in a order or so they don’t enter a loop.
Its a really weird thing though. I came across this several times but only in the behavior functions. If i use the same code in just the regular event blocks everything works fine.
Indeed, I seem to run into more problems with behavior functions than in scene or external event sheets too. Sometimes it is my own error and other times I just can’t put my finger on the problem.