Wargasmic
(Wargasmic)
November 10, 2016, 2:07am
461
Glad it works now! A majority of Parameter commands can be found on the wiki: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
Unfortunately I haven’t had time to update it in a bit, so callbacks aren’t in the wiki but they do work in the parser. With the “Simple” node you can set an object as the loop target then use “loopfunction” or “olfn” (short for “on loop function name”) then specify the function name. For example “olfn = MyFunction;” or “loopfunction = MyFunction;”. I’ll add these to the wiki when I remember
This will call your function every time a loop section completes so for your situation it should sound every time it changes direction without having to do anything extra.
Thanks again , but after attempting to use callbacks as you suggested upon starting the game (PIE) the game freezes for a few seconds (for the first run) then starts running as normal but the callback isn’t being called.
is the function call now along with the PlaySound function. EDIT: I also tried using “olfn” in place of “loopfunction”
tweenComponent->ActorMoveFromToSimple(“Move”, this, from, to, ECoordinateSpace::world, false, 3.f, EaseType::easeInAndOutQuintic, “looptype = pingpong; loopfunction = PlaySound;”);
void AMovingEnemy::PlaySound() {
if(moveSound)
UGameplayStatics::PlaySoundAtLocation(GetWorld(), moveSound, GetActorLocation(), 1.f, 1.f);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, TEXT("Playing sound!"));
}
Cheers!