Time Behavior Not Working

whirlingwolf

  • Posts: 6
I've started running into this problem last night:

I've set it up so that I have an intro music track play and then I used the "do after ___ seconds" behavior to play the loop. For some reason, this mysteriously stopped working last night, and I can't figure out why.

Today, I've attached an actor to an enemy which spawns after the enemy dies and then kill itself after a set amount of time. This uses the same behavior, but fails to work. Attached is an image of this. Why am I running into this problem and how can I go about fixing it?

Photon

  • Posts: 2693
Chances are some other actor has spawned in between your "Create Actor" and delayed "Kill Last Created Actor". Store the specific actor you want to kill in an attribute, then kill it using that.
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

whirlingwolf

  • Posts: 6
Thanks a lot for the response. I'm attempting to do as you say, but since I'm new, I think I might be confused on how to do it. Do I do this under the attributes tab under settings or the attributes tab in block code editor? And how, would I store the specific actor I want to kill in an attribute?

Photon

  • Posts: 2693
In your palette, go to the Attributes tab and create an attribute. Give it a name and make sure its set to be an Actor attribute. Not actor type or group, but actor.

Then, IMMEDIATELY after you create the actor you are going to kill later, set the attribute to last created actor. Go to Attributes >> Setters to get the block needed for assigning the attribute.

Finally, inside your "Do After X Seconds" wrapper, "kill" the actor stored in the attribute. In other words, go to Attributes >> Getters and put the attribute inside the kill block.
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

whirlingwolf

  • Posts: 6
Thanks! I manage to get it to work. However, I'm still having issues with background music. This is what I have. The intro plays, but the loop does not. Suggestions?

froz

  • Posts: 250
There is no loop in the code you shown. "Do after" is not a loop, so it will just run once. "Do every" is a loop.

whirlingwolf

  • Posts: 6
Oops, in the "Do after" the sound is suppose to "loop" not "play." However, despite this, the Main Theme does not play at all regardless. Would changing the "Do after" to "Do every" still fix this problem?

Photon

  • Posts: 2693
I would not change it to a "Do Every". Try changing the channel, or just using a flat "loop" without channel specification.
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!