i’m currently stuck with a problem, maybe you guys can help me. What i want to do: Every time my object “Vogel” (Bird) gets into the state “AufBodenFliegen” (Flyontheground) i want to create one object of “kollision” and set its variable ID to the current id variable of object “Vogel”. I will do some stuff with the object “kollision” and delete it later.
Currently in my scene i got three objects “Vogel”. Here is the problem: Sometimes it creates one object “kollision” sometimes two and sometimes nothing. I dont really know where the problem is as im using a foreach loop.
Here is the screenshot:
Thank you in advance!
hört sich an, als ob das Problem bei der Variable liegt.
show us the screenshot how you set the variable Status of bird.
and you should put the trigger once under the variable Status condition.
danke für deine Bemühungen!
The obj “Vogel” spawns with the state “Warten” (wait). If it spawns with the state “AufBodenFliegen” it creates for each obj “Vogel” an object “kollision”, so you are right the problem is not the first screenshot i attached. So here is the state “Warten”:
Unfortunately i couldnt figure out why the the problem is here and how to fix it.
@Slash is it necessary to put the trigger once under the variable Status condition? Because there are some other Conditions/Actions that run with the Status “AufBodenFliegen”. They are currently just not active because of my problem.
Thank you in advance,
Try a for each loop too to set the variable.
And no, you don’t need to use trigger once on the variable, but all actions I saw in your screenshot should be trigger once.
You can move those actions to a subevent and give them trigger once too, if you plan on adding non trigger once actions
All states are in one for each loop. At the top there is a foreach loop and beneath der are all events for my object “Vogel” and all events for the state variable “Status”.
I need the bigger picture.
Looks like those events on its own should work.
I still suspect something is wrong with how you set the variables.
The easiest way would be if you upload your project
This is basically everything:
(sorry i really dont want to upload my project)
When i try to figure out a problem i deactive all conditions / actions until i find the problem. But i just cant figure it out. For debug purpose i created 3 obj “Vogel” in my scene with the ID 1, 2 and 3. And all are spawning in the state “Warten” after 2 second every “Vogel” should create an object “Kollision”. But it still dont work.
To be honest i dont want to find a workaround way i would like to understand why its not working
I guess i found the problem: If i use the RandomInRange(x,y) function for the timer “Warten” not all birds will spawn an object. If i use a “Vogel” variable with RandomInRange(x,y) and use it in the timer “Warten” it wont work neither. If i pass in a variable without any random numbers its working. This is strange… Thank you for your help anyway im a little confused but at least i can continue now. Danke trotzdem für deine Aufmerksamkeit!