Detect a playerpawn/bot that has no collision

Discussions about Coding and Scripting
User avatar
Barbie
Godlike
Posts: 2394
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Detect a playerpawn/bot that has no collision

Post by Barbie » Sun Apr 17, 2022 11:23 am

Is it possible to detect a (idle) player that has no collision, for example with Trace() or TraceActors()?
The reason why player has no collision is because I have set him idle after a timeout:
event IdleBegin
Show

Code: Select all

event IdleBegin(Pawn P) {
	Logger(LOG_Debug, "IdleBegin", "idle mode started for" @ P);
	if (PlayerReplicationInfoSB(P.PlayerReplicationInfo) != None)
		PlayerReplicationInfoSB(P.PlayerReplicationInfo).bIsIdle = true;
	//P.Style = STY_Translucent;
	P.SetDisplayProperties(STY_Translucent, P.Texture, P.bUnlit, P.bMeshEnviromap);
	P.bProjTarget = false;
	P.SetCollision(false, false, false);
	P.Visibility = 0;
	P.UnderwaterTime = -1;
	/* the following has too many side effects, e.g. chat disable, no team view for others, ...
	if (TournamentPlayer(P) != None)
		P.bIsplayer = false; // Monster do not attack player then
	*/
	/* also this does not work because idle mode cannot be ended
	P.GotoState('PlayerWaiting');
	*/
	//P.Disable('Bump'); P.Disable('SeePlayer'); P.Disable('TakeDamage');
	if (P.Weapon != None)
		P.Weapon.SetDisplayProperties(ERenderStyle.STY_Translucent, P.Weapon.Texture, P.Weapon.bUnlit, P.Weapon.bMeshEnviromap);
	if (P.Base != None)
		Logger(LOG_Debug, "IdleBegin", P $ ".Base=" @ P.Base);
}
Neither Trace() nor TraceActors() find that player in idle mode.

Code: Select all

	foreach TraceActors(class'Actor', A, HitLocation, HitNormal, EndTrace, StartTrace)
	{
		//log("TraceActors has hit" @ A);

		if ( ! A.bHidden)
			//if (Pawn(A) != None && Pawn(A).bIsPlayer)
			if (Pawn(A) != None && Pawn(A).PlayerReplicationInfo != None)
			{
				IdentifyTarget = Pawn(A).PlayerReplicationInfo;
				IdentifyFadeTime = 3.0;
				return true;
			}
	}
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

Buggie
Godlike
Posts: 1489
Joined: Sat Mar 21, 2020 5:32 am

Re: Detect a playerpawn/bot that has no collision

Post by Buggie » Sun Apr 17, 2022 12:12 pm

AFAIK - no. Trace stuff use collision hash, which based on collision size. If it zero - then you out of it.

Try play with small size, like 0.001.

User avatar
sektor2111
Godlike
Posts: 5873
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Detect a playerpawn/bot that has no collision

Post by sektor2111 » Sun Apr 17, 2022 1:25 pm

And you say that it's not possible to log collision concerning bCollideActors bBlockPlayers bBlockActors ?
I think I already did this when I was writing "Monster Wake-up" stage from XCMH...

Buggie
Godlike
Posts: 1489
Joined: Sat Mar 21, 2020 5:32 am

Re: Detect a playerpawn/bot that has no collision

Post by Buggie » Sun Apr 17, 2022 4:08 pm

Also. Main idea is be ghost in idle mode. Pawns use Trace for check what collide. projectiles too. So, idea get it via Trace, opposite main idea - be ghost. In fact, you do this idle mode for pawn NOT return in trace. And now want it back... :lol: