Help with Slomo Effect

Hello guys!

It’s me here annoying again :smiley:

I added a cool slomo effect whenever the player perform a headshot on the enemy.

The effect is very simple, it’s basically detect the hit bone on the pawn takedamage event (it runs on the enemy pawn class):

    //this variable is to identify the hit location
    local name HitBone;
    HitBone = Mesh.FindClosestBone(HitLocation);

    //this statement will check if the enemy was attacked by bullet weapons to play the hitbones animations and death
    //we are isolating the hitbones detection only to bullet weapons
    //also we don't need Headhosts nor hit reaction animations whenever using RPG7
    if (DamageType != class'UTDmgType_AIKnife' && DamageType != class'UTDmgType_RPG7')

      //we also want that headshot effect be triggered only by players (p1 and p2) and not Bots   

        if(HitBone == 'b_Neck' || HitBone == 'b_Head')



         HeadShotCount = true;

         //this function will play the flash animation headshot icon and slomo effect/////////////////
         ForEach LocalPlayerControllers(class'PlayerController', localPlayer)

         //this function will play the flash animation headshot icon and slomo effect/////////////////



So I set a small timer to sent the pawn to the slomo function:

//this function will turn on slomo for headshots
simulated function StartSlomo()

then after one second (because the slomo effect slows the time), I send the pawn to the finish slomo function:

//this function will turn off slomo
simulated function FinishSlomoHeadshot()
       local Playercontroller localplayer;


       ForEach LocalPlayerControllers(class'PlayerController', localPlayer)

Everything is working perfectly, however, I realized a bug, that happens only with keyboard on PC, but if I use a gamepad (xbox360 controller), this bug does not happen (also it does not happen on consoles PS3 Xbox360). This bug only happens with a keyboard on PC.

The bug is that if whenever the slomo effect begins, the player is pressing any of the moving keys (W,A,S,D), the player pawn continues running to the direction the button was pressed. In example, if whenever the slomo effect began I was running left (pressing A), the player pawn continues to walk left forever, and only stops if I press the key another time.

Any help?

I like the slomo effect, it feels kinda bullet time, but if I can’t solve this problem, I will remove it (slomo effect).


if ( bIsInSlomoState )
//do not move on the process move function playercontroller

Or make a new state on playerController extending player move

SlowMo state processMove() doing nothing.

Good like my friend and pieeeeeeeeeeeeece : D

I can specifiy further. But i would like a copy of your game for fun , PURELY FUN.

Hello @Neongho

Thanks man for the tip.

Ok, I understood now. But I will try also to disable player input during that one second on which the slomo effect happens.

Here is the video showcasing the slomo effect, begin on 05:46:

I plan (hope) untill march release the first episode of my game, with a lot of content, including split screen multiplayer, with many game modes :smiley:

Cheers my friend!

Try Cleartimer(‘timername’); instead Cleartimer(); ?

Hello man, how are you :cool:

Thanks for trying to help me.

I think I already discovered the problem.

This line of code is causing the bug on which the player continues moving indefinetely if the player is pressing one of the move keys whenever the slomo effect begins.

This line of code causes this bug:


I think that whenever the enemy pawn casts the localplayer and tries to run a console command (any console command), this bug happens.

This exec function HeadshotIconAnimStart is just a function I created inside UTGFxHudWrapper class to show the headshot icon animation:

//function to show headshot icon animation////////////////////////////////////////////////////
exec function HeadshotIconAnimStart()
  if ( HeadshotIconHUD == none )
       HeadshotIconHUD = new(PlayerOwner) class'UTGFxTweenableMoviePlayer';

  HeadshotIconHUD.MovieInfo = SwfMovie'gameplay_icons.udk_headshot';
  HeadshotIconHUD.bDisplayWithHudOff = true;
  HeadshotIconHUD.bEnableGammaCorrection = false;
  HeadshotIconHUD.LocalPlayerOwnerIndex = class'Engine'.static.GetEngine().GamePlayers.Find(LocalPlayer(PlayerOwner.Player));
  setTimer(1.00, false, 'HeadshotIconAnimEnd');

function HeadshotIconAnimEnd()
//function to show headshot icon animation////////////////////////////////////////////////////

However, If I show this flash movie icon animation in kismet, using GFXMovieOpen node, that bug does not happen.

By the way, the bug is not because the slomo, it happenned even without slomo, it has to do with the loading of that flash animation and casting the local player to run a console command.

Any ideas to solve it (besides doing everything in kismet)?

This is a minor bug because the player hardly will be able to do a headshot while running (the enemies move a lot). However, as a game developer, you need to think on all possible scenarios, right?


I tested now an exec function inside my player pawn, and the bug did not happen.**

Hello guys, found the solution. What matter is that it works the way I want.

To give my game some kinda variation, I am creating many game modes, besides campaign. Two of these game modes are Heashots and BlowThemUp.

In headshots the player needs to do a minimum ammount of headshots to complete the mission. So, even though the enemy pawn detects headshot (one headshot he dies), I decided to show the headshot icon only on this mode, as it will have no use on campaign mode, in example.

So whenever I do something specific for a map (because the map will contain all gameplay rules, done in kismet), I can do all in kismet, both the slomo effect and load a gfx movie (headshot icon) in kismet instead of loading from UTGFXHudWrapper using an exec function, as it is only this what was causing the bug.

Now another doubt, how can I set SetViewScaleMode(SM_NoScale) for the FlashMovie loaded in kismet throught openGFXMovie?

Already solved it. Just on the flash file I add a new layer for action script, and add this small code:

Stage.scaleMode = "noScale"