Mostly Harmless

Legacy:IndianPsycho/Developer Journal

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
April 11th, 2004
Game now installs the JoinTeamInteraction as soon as a player joins the game. It's more a hack than a fix, but whatever. Next up is forcing playermodels on a team basis. I've a feeling that this shouldn't be so hard. My feelings usually turn out to be completely wrong though.
Later that day
Well that wasn't so hard :D I've added the force playermodel/sounds/skins/whatever on a per-team basis. Since it didn't take that long I've changed it a bit so hypothetical modteams can customize alot of the playerclass related stuff. Currently it's all routed via my custom SpeciesType. Also customized the casting system so some weapon-effects change their look depending on your PlayerClass (on your SpeciesType, to be more precise).
April 10th, 2004
I'm currently struggling with PlayerController.Player being None. When I call a Server -> Client replicated function, which is supposed to install an Interaction, from my gametype's PostLogin() it throws a bunch of accessed nones at me. To make matters worse, it throws these accessed nones at me in the client log. I know Player is not replicated to the server, so I am confused as to why it is none. What's even more confusing is the fact that it is only none at certain moments; in PostLogin() or in general in any and all functions which are called right after the PlayerController is first spawned, such as PostBeginPlay() and RestartPlayer(). If I create an exec function which calls the same function as PostBeginPlay(), Player suddenly isn't None anymore!
Others have suggested doing this via the Mutator way, but since I'm working on a Total Conversion this seems really silly to me. I have tried it (more out of boredom than out of any hope for success), however I run into the same problem. The way I did it was to keep a clientside bool var in my Playercontroller class which was true if the interaction needed to be installed and false if not. I then had the mutator's ModifyLogin (and when that didn't work the Mutator's ModifyPlayer) check for that var and if true call the Server -> Client replicated function in my PlayerController class. Still no luck.
Currently I've overidden RestartPlayer in my gameinfo, using basically the same method as with the mutator, only now without the mutator. Player is still none the first time it tries to install the interaction, however as soon as the player dies and then respawns (IE when RestartPlayer is called again) Player is not None anymore, it installs the interaction, sets the bool to false and everything is well and good. This is however unacceptable since the idea is that players should be able to join teams via this interaction, so I need this interaction to be installed as soon as a player joins the game. Not as soon as a player has joined the game and then has suicided and respawned.

Discussion[edit]

GRAF1K: I may be speaking complete giberish, but:

// Instead of RestartPlayer, use this
 
event PlayerController Login( string Portal, string Options, out string Error )
{
    // Blah blah blah
}
 
// To avoid acessed nones, use
if ( PlayerController(Other) != None )
{
    // Blah blah blah
}

Hope this helps. :)

IndianPsycho: That's what I originally used, except not Login, but PostLogin. The problem isn't that NewPlayer == None, rather NewPlayer.Player is none. :)