I've been trying to figure this out but how do I change the bonescale of a actor spawned by the PlayerController and is owned by the pawn? So far I can only change it's bonescale by changing the owning pawns bonescale
As far as I know, it doesn't matter who owns the actor. You should be able to change bone scale anyway. Unless it is an attachment bone and you are trying to set it to 0.
Post the code so I can take a loot at it.
simulated function Setup(xUtil.PlayerRecord rec, optional bool bLoadNow)
{
local KFPlayerReplicationInfo KFPRI;
KFPRI = KFPlayerReplicationInfo(PlayerReplicationInfo);
Super.Setup(Rec, bLoadNow);
if( KFPRI != none && KFPRI.ClientVeteranSkill != none && KFPRI.ClientVeteranSkillLevel == 50 )
SpawnHandEmitters();
bHasFootAdjust = False;
FeetAdjSpec = Class<SPECIES_KFMaleHuman>(rec.Species);
if( Controller == none )
return;
else if( FeetAdjSpec==None || Level.NetMode==NM_DedicatedServer || Bot(Controller) != None )
return;
if( Adjuster!=None )
Adjuster.Destroy();
Adjuster = Controller.Spawn(class'FPActor', self,, Location, Rotation);
Adjuster.AdjustingPawn = Self;
Adjuster.SpecType = FeetAdjSpec;
Adjuster.LinkMesh(Mesh);
FPActor(Adjuster).InitAdjuster(rec.BodySkinName, rec.FaceSkinName);
}
class FPActor extends KFPawnFootAdjuster;
var int BodyLoc, CrouchLoc;
var Controller PawnController;
simulated function InitAdjuster(string BodySkin, string FaceSkin)
{
if( AdjustingPawn.Controller == none)
return;
LinkMesh(AdjustingPawn.Mesh);
Skins[0] = Material(DynamicLoadObject(BodySkin, class'Material', true));
Skins[1] = Material(DynamicLoadObject(FaceSkin, class'Material', true));
PawnController = AdjustingPawn.Controller;
AdjustingPawn.SetBoneScale(1, 0.001, 'CHR_LArmUpper');
AdjustingPawn.SetBoneScale(2, 0.001, 'CHR_RArmUpper');
AdjustingPawn.SetBoneScale(4, 0.001, 'CHR_Head');
}
simulated function AdjustBones(bool bSetBoneSize)
{
if( !bSetBoneSize )
{
bHidden = false;
AdjustingPawn.SetBoneScale(1, 0.001, 'CHR_LArmUpper');
AdjustingPawn.SetBoneScale(2, 0.001, 'CHR_RArmUpper');
AdjustingPawn.SetBoneScale(4, 0.001, 'CHR_Head');
}
else
{
bHidden = true;
AdjustingPawn.SetBoneScale(1, 1.0, 'CHR_LArmUpper');
AdjustingPawn.SetBoneScale(2, 1.0, 'CHR_RArmUpper');
AdjustingPawn.SetBoneScale(4, 1.0, 'CHR_Head');
}
}
simulated function Tick(float DeltaTime)
{
local Vector PawnRotation,DrawOffset;
local bool BoneReset,bBehindViewToggled,bGottenAdjuster;
local FMXHumanPawn FHumanPawn;
Super.Tick(DeltaTime);
if(PawnController == none)
return;
FHumanPawn = FMXHumanPawn(AdjustingPawn);
PawnRotation = vector(AdjustingPawn.Rotation);
PawnRotation.Z = 0.00;
DrawOffset.Z += AdjustingPawn.EyeHeight-47;
if( AdjustingPawn != none )
{
if( PlayerController(PawnController).bDuck == 1 )
{
PawnRotation = float(CrouchLoc) * Normal(PawnRotation);
SetLocation(AdjustingPawn.Location + PawnRotation + vect(1.35,0,29.5));
}
if( PlayerController(PawnController).bDuck == 0 )
{
PawnRotation = float(BodyLoc) * Normal(PawnRotation);
SetLocation(AdjustingPawn.Location + PawnRotation + vect(0.41,0,6.5));
}
SetRotation(AdjustingPawn.Rotation);
}
if(PawnController != none && !PlayerController(PawnController).bBehindView)
AdjustingPawn.SetTwistLook(FHumanPawn.PawnTwist, 0);
if(!PlayerController(PawnController).bBehindView && bBehindViewToggled)
{
bBehindViewToggled = false;
AdjustBones(false);
bHidden = false;
}
else if(PlayerController(PawnController).bBehindView && !bBehindViewToggled)
{
bBehindViewToggled = true;
AdjustBones(true);
bHidden = true;
}
if( (PawnController.IsInState('PlayerFlying') || PawnController.Pawn.Physics == PHYS_Swimming) && !BoneReset )
{
BoneReset = true;
AdjustBones(true);
bHidden = true;
}
else if( (PawnController.IsInState('PlayerWalking') || PawnController.Pawn.Physics == PHYS_Walking) && !bBehindViewToggled )
{
BoneReset = false;
AdjustBones(false);
bHidden = false;
}
}
Auto state Setup
{
Begin:
AdjustingPawn.bHasFootAdjust = True;
Stop;
}
defaultproperties
{
BodyLoc=-21
CrouchLoc=-23
bHidden=False
bOnlyOwnerSee=True
bOnlyRelevantToOwner=True
bAnimByOwner=True
bClientAnim=True
RemoteRole=ROLE_SimulatedProxy
}
I see a lot of replication issues in your code.
1. Why are you using PawnController.Pawn instead of AdjustingPawn? Controller is replicated only to net owners. If pawn isn't controlled locally, then Controller=none.
2. KFPawnFootAdjuster is spawned locally. Its RemoteRole=ROLE_None. That means no replication for this actior. If you want to replicate it somehow, then you should spawn it on server-side only (spawn it inside non-simulated function or inside Role==ROLE_Authority block) and set RemoteRole=ROLE_SimulatedProxy.
Btw, what are you trying to accomplish with this code?