I’m a complete UE noob trying to create a simple endless runner where the player is being chased by a truck, and I want the truck’s speed to increase when the player hits obstacles and decrease when the player pick up powerups. However, calling a function that changes the variable that determines the truck’s movement speed doesn’t seem to actually affect the truck it if changed from anywhere except the truck blueprint itself, even though the truck, obstacles and powerups are all part of the same parent class. I assume either the function that moves the truck or the tick that calls it doesn’t automatically check if the variable changed, so presumably I need some kind of event dispatcher, but am a complete noob with those. What would be the most sensible way to make this happen?
There is a event called “Event Hit”. If your object hit something, this event well be called.
Same result as with my other attempts with overlap events - the truck speed variable does actually change (confirmed by a printout) yet the truck does not actually speed up. The only way I have managed to actually speed it up is when the truck itself overlaps with the player character, from within the truck’s blueprint. I’m now wondering if I need to somehow rework the rather simplistic truck movement script, which is currently set up as such in the parent class blueprint and which the truck blueprint simply calls on tick.