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 rest of the project if you want to take a look.
Thanks in advance!
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 MainCharacter now hides to the side to avoid the enemy's kill sphere
The blueprint is pretty much the same as I inserted in the previous answer, I just added AddWorldOffset before the set timer.
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 :D
Sorry for the delay.
So it looks like it's a logic issue in your Boss_BP. Currently; OnComponentHit you have it cast to the Blocker_BP > On Fail > Cast to Enemy_BP > On Fail > Cast to Character. This seems to be causing the issue. You need to either add in some sort of logic that it only cast to the correct actor when it is hit or change the Cast To Character to Cast To Hero_BP. That seems to work as well.
Let me know if that fixes the issue on your end or not.
answered Feb 23 '17 at 03:48 PM
TJ V ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here