Download

Enemy trace and quick turn on 180 degrees

Hi everyone! Have two questions.

  1. My game is sidescroller, so I have a problem with slow turns (my enemy) on 180 degrees, (move forward and backward on X direction). So I wonder if there any way to make turn around for my enemies much quicker?
  2. Second problem, is that enemy trace me depending on distance that set up in default properties, so let’s say my character on 3 rd floor, and enemy on 2 nd and he can see me, also he move in direction that I go (same problem when my charater below him). Is there any way to make his trace only on x direction to avoid this problem.

Sorry for my bad English and thanks in advance.

For the first, you can try with rotationrate.yaw, in the pawn class. Use “focus” to point to the player, then rotationrate.yaw control the velocity.

For the second, I don’t understand very well, but you can use dot product to get the orientation between pawns, or vsize. Perhaps this helps you: Legacy:UnrealScript Vector Maths - Unreal Wiki

Now when i have a direction where to move, it’s not that bad. Thank you for help.

Hi again.
Have no luck with rotation. If I am right, I need something like RotationRate.yaw = 20 in my enemy class, and I not sure I understand where
exactly I need to put this line. Any help would be appreciated.
Thanks in advance.

In the defaultproperties section. Something like this:

RotationRate=(Pitch=30000,Yaw=30000,Roll=30000)

20 is a very low value, try with 20000, or 40000.

You can change the value in any part of the code, using “actor.rotationrate.yaw = new value”.

Yes, this solved the problem. Thank you for time you spent helping me.

Again me. Back to first question. So, try to clarify my problem. In my script I have controller which extends from UTBot, so my bot moving from point to point and if I in his aggressivemode (pc != None && pc.Pawn != None && VSize(Pawn.Location - pc.pawn.Location) <= aggressivemode)) he will verify shoot at me or chase me, and if I in AttackDistance he will shoot at me

As I mentioned my game is side scroller. For example I have a house with 2 floors. Bot is patrolling 1st floor and my pawn is on 2, and a problem is when my pawn located right above my enemy (or so), I am in his aggressive mode distance, so he stop patrolling. To solve this issue I can make space between floors higher, or in my def prop make aggressivemode distance smaller, but both options is my plan B. In kismet this problem would be solved by adding “trace node”, if player not obstructed = stop and shoot, if obstructed = don’t bother.

Hope all this makes sense, and thanks in advance.

The problem is solved.