UE1 - UT What is the UT99 equivalent of “PlayerController”?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Silver_Ibex

Member
Feb 27, 2001
654
0
16
I have a map decoration item I am coding and I need it to call a function (PlayerCalcView) in the local player pawn, and only the local player pawn of the local machine. The FX of the decoration will change and be different to each of the players, depending on their viewing location.

I know how to do it in UT2k4 script, and want to reproduce the same effect in UT99.

From the UT2k4 code
Code:
// UT2k4 script example in map decoration

var PlayerController localPlayer;

simulated function PostBeginPlay() {
	if (Level.NetMode == NM_DedicatedServer) 
	{
		Disable('Tick');
	}
LocalPlayer = Level.GetLocalPlayerController();
}

simulated event Tick(float d) {
	local actor MyA;
	local vector MyV;
	local rotator MyR;
	if (LocalPlayer == None) 
	{
		LocalPlayer = Level.GetLocalPlayerController();
		if (LocalPlayer == None) return;
	}
	LocalPlayer.PlayerCalcView(MyA,MyV,MyR);

	//do the FX stuff here
}
 
Last edited:

meowcat

take a chance
Jun 7, 2001
803
3
18
PlayerPawn was the equivalent, but it basically had both pawn and controller functions combined.
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
Thanks, but what has me stumped is how to get it to return the info from the actor being controlled by the player.


UT2K4 has it easy, just use “Level.GetLocalPlayerController()” to set up a nametag like variable.

Code:
var PlayerController HelloMyNameIs;

HelloMyNameIs = Level.GetLocalPlayerController();

And then you can spam that actor every time you need updated info returned from it.
Code:
HelloMyNameIs.PlayerCalcView(A,B,C);

so how would that work in UT99? I am guessing it is going to be a bit more complex:confused:
 

meowcat

take a chance
Jun 7, 2001
803
3
18
Well that is definitely a tricky one, but I think the RegisterHUDMutator function from the base UT99 mutator class may give the only real way to do this by iterating through all playerpawns and seeing if the myHud reference does not equal 'none'.

Another tricky part could be that you may need to perform that check every time your custom decoration becomes relevant to a given client (unless it is spawned clientside with a remote role of ROLE_authority or something like that). I don't quite remember how UE1 handles decorations (are there any truely 'static' actors that are treated authoritatively clientside?)
 
Last edited:

Raven

Member
Jan 17, 2004
147
0
16
40
turniej.unreal.pl
I have quite similar function in the emitter.

Code:
simulated function PlayerPawn GetLocalPlayer()
{
        local PlayerPawn pp, LocalPlayer;
	if(Level.NetMode != NM_DedicatedServer)
	{
           foreach AllActors(class'PlayerPawn',pp)
   	   {
	               if(Viewport(pp.Player) != None)
	               {
	               	   LocalPlayer=pp;
	   	       	   break;
	               } 
	   }
	   return LocalPlayer;
	}
	return none;
}

It works clientside only.
 

meowcat

take a chance
Jun 7, 2001
803
3
18
@nargil: I don't think that there was a viewport class in UT99 (class 'player' extends object).
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
As in UT200x, Viewport is a native class in UT that extends Player. I think you can also see this if you browse the object class hierarchy in UnrealEd's actor browser.
In network games, by the way, there's also another kind of Player subclass used: the NetConnection. Like Viewport it's a native-only class. You only need to know it's there, because on a listen server, every PlayerPawn/Playercontroller has a Player object. Only the local player's Player will be a Viewport, the others have a NetConnection.
 

meowcat

take a chance
Jun 7, 2001
803
3
18
Ahhh, Ok (I learn something new every day...). I had initially done a search of the UT99 source code for a viewport class and did not find one (and I did not see any references to a 'viewport' in the playerpawn class). And now that you mention it, UT2kx did not have a specific viewport class (well a uscript stub anyways) either.
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Both UT and UT200x have a Viewport-type variable called Viewport in their Engine.Canvas class. This means, if you have access to a Canvas object (i.e. in just about all functions called during rendering) you can easily access the local PayerPawn/PlayerController through Canvas.Viewport.Actor, where "Actor" is a variable declared in the Player class. That's something I already miss in UT3.