View Full Version : Need some help (CheckReplacement)...
}DA{Moneyshot
12-02-2007, 11:07 AM
I am using CheckReplacement on a mutator to create an Actor and do some pawn manipulation in the Tick function. Only problem is that at map change, with the seemless server travel, the checkreplacement never gets another UTPlayerController and it appears that my Actor was destroyed (which makes sense). So my mutator will work fine until map change and then it fails. Does anyone have any suggestions on a course of action to spawn my actor that happens only one time per map?
simulated function bool CheckReplacement( Actor Other )
{
local DodgeJumpAndAirControlInfo info;
WarnInternal("############################# CheckReplacement Called #############################");
if(LGIEnableMultiDodge)
{
if( Other.IsA('UTPlayerController') )
{
WarnInternal("############################# Found a UTPlayerController #############################");
info = Spawn( Class'DodgeJumpAndAirControlInfo', Other );
info.Mutator = Self;
}
}
return Super.CheckReplacement(Other);
}
Lotus
12-02-2007, 04:07 PM
There is a new function in mutators called
function GetSeamlessTravelActorList(bool bToEntry, out array<Actor> ActorList)
{
Super.GetSeamlessTravelActorList(bToEntry, ActorList);
}
Add your Info class to the array if its owner(The player controller) is seamlessly traveling.
}DA{Moneyshot
12-02-2007, 08:37 PM
Thx for the info Lotus. The one problem I'm having with that is that I don't have access to the player controllers in that function. Atleast when I attempt to iterate over localplayercontrollers I don't receive anything back. I decided to try something like this in modify player, but I imagine all this looping and checking has the potential to have some performance implications. I'm not certain I like it, but I haven't come up with anything better. Do you have any further suggestion?
simulated function ModifyPlayer(Pawn P)
{
local UTPlayerController Controller;
local DodgeJumpAndAirControlInfo Actor;
local bool foundActor;
foundActor = false;
if(UTPlayerController(P.Controller) != None)
{
Controller = UTPlayerController(P.Controller);
if(ModifierActors.length > 0)
{
foreach ModifierActors(Actor)
{
if(Actor.Owner != None)
{
if(Actor.Owner == Controller)
{
foundActor = true;
break;
}
}
else
{
WarnInternal("############################# Found Destroyed Actor #############################");
ModifierActors.RemoveItem(Actor);
}
}
}
if(!foundActor)
{
WarnInternal("############################# No actor for pawn. Creating. #############################");
Actor = Spawn( Class'DodgeJumpAndAirControlInfo', Controller );
Actor.Mutator = Self;
ModifierActors.AddItem(Actor);
}
}
Super.ModifyPlayer(P);
}
}DA{Moneyshot
12-02-2007, 10:53 PM
Actually I got to thinking that their may be another way that is a little less resource intensive yet to do this. I came up with the below code:
simulated function ModifyPlayer(Pawn P)
{
local UTPlayerController Controller;
local DodgeJumpAndAirControlInfo Actor;
local bool foundActor;
foundActor = false;
if(UTPlayerController(P.Controller) != None)
{
Controller = UTPlayerController(P.Controller);
foreach Controller.ChildActors(class'DodgeJumpAndAirContro lInfo', Actor)
{
if(Actor != None)
{
foundActor = true;
break;
}
}
if(!foundActor)
{
Actor = Spawn( Class'DodgeJumpAndAirControlInfo', Controller );
Actor.SetDefaultProperties(bEnableMultiDodge, bEnableDodgeJump, AirControl);
}
}
Super.ModifyPlayer(P);
}
Lotus
12-03-2007, 09:54 AM
I was thinking more along the lines of:
function GetSeamlessTravelActorList(bool bToEntry, out array<Actor> ActorList)
{
local DodgeJumpAndAirControl dj;
foreach dynamicactors(class'DodgeJumpAndAirControl', dj)
for(i=0; i<actorlist.length; i++)
{
if(ActorList == dj.owner)
ActorList.length=dj;
}
Super.GetSeamlessTravelActorList(bToEntry, ActorList);
}
}DA{Moneyshot
12-04-2007, 12:02 PM
I hadn't even thought of that. That is probably the best solution. I will look to do that in my next release if I can ever figure out the couple bugs that are left. Thanks for your help.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.