Page 1 of 1

Possessed PlayerPawn

Posted: Fri Sep 04, 2015 6:34 am
by Cybernetic pig

Code: Select all

ScriptLog: PostPostBeginPlay Called
ScriptLog: There is no player :/
Log: Spawning new actor for Viewport WindowsViewport0
ScriptLog: Team 0
ScriptLog: Login: Player
ScriptLog: MYCHK:: 5 :: 79
ScriptLog: Lean Keys UNDEFINED, disabling tiptoes
ScriptLog: Team 0
Log: Possessed PlayerPawn: JCDentonMale 01_NYC_UNATCOIsland.JCDentonMale1
I used PostPostBeginPlay() of an actor already placed in the map to log if (player == none) log("There is no player :/");
player being player = DeusExPlayer(GetPlayerPawn());

So, to be able to reference the player before possession using a beginPlay function, what can I do? Is there a beginPlay function (or something similar called once the object is spawned) that is called after player possession, in the case of pre-placed actors in a map?

Re: Possessed PlayerPawn

Posted: Fri Sep 04, 2015 12:03 pm
by DDL
Prebeginplay, beginplay, postbeginplay and even postpostbeginplay. There are loads.

What are you trying to do, exactly? If your code is critically dependent on a possessed playerpawn, why not have the playerpawn itself call it once possessed?

I've put fucktons of code into my playerclass because it's one of the few things you can guarantee will definitely be there, and doing stuff, when you want things to happen.

Re: Possessed PlayerPawn

Posted: Fri Sep 04, 2015 3:00 pm
by Cybernetic pig
DDL wrote:Prebeginplay, beginplay, postbeginplay and even postpostbeginplay. There are loads.
Yeah, but all are called before player possession. PostPostBeginPlay being the last called.
What are you trying to do, exactly? If your code is critically dependent on a possessed playerpawn, why not have the playerpawn itself call it once possessed?
I guess I'll have to. I want to do a variety of things upon initialization that involve both DeusExPlayer and various actors.

Thanks.

Re: Possessed PlayerPawn

Posted: Fri Sep 04, 2015 3:06 pm
by DDL
I wrote all my stuff to work with vanilla deusex.u (coz I didn't like the idea of replacing core code), so my player class literally sweeps through the entire level at runtime and replaces every actor with my own modified versions, transferring properties across as necessary.

It's insanely inefficient coding and would probably make any rational programmer weep, but the take home message is: it's doable.

I'd also be cautious about interpreting log messages, especially with startup stuff. I've found some things seem to merrily log that they can't find a player, but then work entirely correctly as if they had found the player, so it's....confusing.

Re: Possessed PlayerPawn

Posted: Fri Sep 04, 2015 9:45 pm
by Hanfling
@cypig:
You could try to use event DetailChange() in GameInfo, or use PostLogin() on GameInfo, etc..

@DDL:
I would have prefered putting that into a Mutator, as that is exactly what they are supposed to do.

Re: Possessed PlayerPawn

Posted: Sat Sep 05, 2015 8:09 am
by Cybernetic pig
Yeah, PostLogin was what was needed. Thanks.

Re: Possessed PlayerPawn

Posted: Wed Sep 23, 2015 4:26 pm
by Cybernetic pig
Bunged it in TravelPostAccept() in DeusExPlayer in the end, definitely more appropriate.