SeePlayer() event not triggering in singleplayer mode..?

I’m finding that my enemy AI controllers are not triggering the SeePlayer() event in single player mode. However it works fine in MP.

Does anyone know why this might be?

I can’t see the implementation of what calls SeePlayer(). I’m guessing it’s in the native C++.

If you use (outside of any state)


event SeePlayer (Pawn Seen)
{
	super.SeePlayer(Seen);
        `log(Seen);
}

Does it not log the player? SeePlayer in an AIController works right out of the box for me.

EDIT: Almost works out of the box for me… I recall the default implementation of GetPlayerViewPoint put the ai eyepoint in the ground. Here’s mine if it helps you:


simulated event GetPlayerViewPoint(out vector out_Location, out Rotator out_Rotation)
{	
        local vector Location_New;
	Location_New=Pawn.Location;
	Location_New.z=Pawn.Location.z+Pawn.EyeHeight;
	
	out_Location = Location_New;
	out_Rotation = Rotation;
}

But once I had the AI’s viewpoint set up correctly, I simply used seeplayer without any modifications and it works fine.

Thanks @Crollo. I’ll give that a try when I get back to my work station. It seems strange that it works fine during multiplayer though…

Hey scooter, just checking in to see if you solved it or if you’re still having troubles with it.

@Crollo. Thanks for checking back. I just tried adding SeePlayer outside of any state and logging, and it never gets triggered.

I also tried your suggestion with GetPlayerViewPoint() but still nothing. I’ve tested that my player controller has bIsPlayer=true and it does.

One thing that is a little confusing is that the signature of SeePlayer in Controller.uc, it states that it is called if bIsPlayer is set to true on ‘Seen’, where ‘Seen’ is a pawn. However bIsPlayer is a param of the Controller class, not the Pawn class. I’m guessing this simply an error, or a change was made through the course of UDK releases.



/* epic ===============================================
* ::SeePlayer
*
* Called whenever Seen is within of our line of sight
* if Seen.bIsPlayer==true.
*
* =====================================================
*/
event SeePlayer( Pawn Seen );


I’m pretty stumped by why SeePlayer is not firing for me in SP, when it’s working perfectly in multiplayer. Does anyone have any other ideas of why?

Since it is native code we can’t see exactly what it’s checking, it may be a typo and it’s checking the IsPlayerPawn function on the pawn instead of bisplayer, or it could be casting from the pawn to it’s controller.

The only other thing I can think of off the top of my head is perhaps me using UDKbot instead of aicontroller might affect things.
Could you post your player pawn and controller?

EDIT: You can also verify the eyepoint is correct by adding the following to your tick event:



        local vector ViewLocation;
	local rotator ViewRot;
	GetPlayerViewPoint(ViewLocation,ViewRot);
	DrawDebugLine( ViewLocation, ViewLocation+200*normal(vector(viewrot)), 0, 255, 0, false);

I made a mistake in the GetPlayerViewPoint, instead of Pawn.Rotation it should just be Rotation. This only affects the pitch of the rotation, however so it shouldn’t damage seeplayer.