Set Timer by Function not working and no error nor warnings? Glitch?

Hi, I’m working on a game where the main character can transform upon picking up powerups. The powerup only lasts for few seconds and the character transforms back to its original form.

Here’s the problem: The timer doesn’t always work. There are times when I’d get a powerup and never go back to the original form. What’s worse is that the editor doesn’t count it as an error so there are no errors/warnings that popup after I test the game.

The characters look like these for now. The one on the far left is the main character, the other two are the transformations.

Here’s my blueprint set up:

Power Blueprint- When the Character touches power, the main character transforms



Hero (Character) Blueprint - contains the MorphToHero Function



This was quite hard to figure out what went wrong as I don’t get any errors/warnings. I linked the .zip of the project if you want to take a look.

Thanks in advance!

As first step try to not destroy powerup bp when you pick up that… maybe timer is deleted when you destroy powerup actor.

I FIXED IT ! ! Here’s how I figured it out.

This game is basically like Temple Run: You run away from the monster chasing you. So what’s happening in my blueprint is that everytime the player transforms, the old character gets hidden then a new one spawns, after few seconds the player reverts back to its original form.

Well the problem was the Boss_BP (enemy in this game) destroys even the hidden actor causing the set timer to not call its blueprint. So what I did was that after I hid the main character, I moved it to the side so the enemy wouldn’t kill it.

Here’s the problem


1.Player Transforms, OldCharacter gets left behind at the spot where the powerup was


2.Enemy Catches it and kill it

Here’s the Fix


Using AddActorWorldOffset, the MainCharacter now hides to the side to avoid the enemy’s kill sphere



The simplest logic is basically:

Power Overlap > Cast to MainCharacter > Set Actor Hidden > UnPossess > Spawn NewActor > Possess > AddWorldOffset > Set Timer by Event > Add Score > Destroy PowerUp Actor

THANK YOU :smiley:

1 Like