Hi!
I posted this problem in Coding some time ago, but got no answer.
I am playing with UnrealRuntime 2 - what I want to do now is to switch player skin dynamicly (to simulate smiling or angry face by changing the texture), but it seems impossible to change the texture...
I am quite suprised the code below doesn't work.
The pawn inits with default texture - no problem there, when I call both ServerChangeTexture() and ChangeTexture() the texture actually changes but to blank texture. I am doing this in network game.
Even when I use DynamicLoadObject instead of helper variable MyHappyTex in PostNetReceive() I get the blank texture result. Am I missing something ? Or do these things work differently in Unreal Runtime 2?
I posted this problem in Coding some time ago, but got no answer.
I am playing with UnrealRuntime 2 - what I want to do now is to switch player skin dynamicly (to simulate smiling or angry face by changing the texture), but it seems impossible to change the texture...
I am quite suprised the code below doesn't work.
The pawn inits with default texture - no problem there, when I call both ServerChangeTexture() and ChangeTexture() the texture actually changes but to blank texture. I am doing this in network game.
Even when I use DynamicLoadObject instead of helper variable MyHappyTex in PostNetReceive() I get the blank texture result. Am I missing something ? Or do these things work differently in Unreal Runtime 2?
Code:
class GBPawn extends Pawn;
#exec OBJ LOAD FILE=_PGTX-EmoBoy.utx
var texture MyTexture[2];
var texture MyHappyTex[2];
replication
{
reliable if(Role == Role_Authority)
MyTexture, MyHappyTex;
}
simulated event PostBeginPlay()
{
Super.PostBeginPlay();
// if this pawn is supposed to cast dynamic shadows
if(bActorShadows && bPlayerShadows)
{
// Spawn the shadow and intialize it
Shadow = Spawn(class'ShadowProjector',None,'',Location);
Shadow.ShadowActor = self;
Shadow.LightDirection = Normal(vect(1,1,3));
Shadow.LightDistance = 380;
Shadow.MaxTraceDistance = 3000;
Shadow.bBlobShadow = bBlobShadow;
Shadow.InitShadow();
Shadow.UpdateShadow();
}
MyHappyTex[0]=Texture(DynamicLoadObject("_PGTX-Emoboy.emoboy_clothes_01", class'Texture'));
MyHappyTex[1]=Texture(DynamicLoadObject("_PGTX-Emoboy.emoboy_skin", class'Texture'));
}
function ServerChangeTexture() {
MyTexture[0]=MyHappyTex[0];
MyTexture[1]=MyHappyTex[1];
//MyTexture[0]=Texture(DynamicLoadObject("_PGTX-Emoboy.emoboy_clothes_01", class'Texture'));
//MyTexture[1]=Texture(DynamicLoadObject("_PGTX-Emoboy.emoboy_skin", class'Texture'));
}
simulated function changeTexture() {
MyTexture[0]=MyHappyTex[0];
MyTexture[1]=MyHappyTex[1];
//MyTexture[0]=Texture(DynamicLoadObject("_PGTX-Emoboy.emoboy_clothes_01", class'Texture'));
//MyTexture[1]=Texture(DynamicLoadObject("_PGTX-Emoboy.emoboy_skin", class'Texture'));
}
simulated function PostNetReceive() {
//if (MyTexture[0] != none && Skins[0].Name != MyTexture[0].Name)
//if (MyTexture[1] != none && Skins[1].Name != MyTexture[1].Name)
Skins[0]=MyTexture[0];
Skins[1]=MyTexture[1];
}
defaultproperties
{
MyTexture(0)=Texture'CivilTex.cloth'
MyTexture(1)=Texture'CivilTex.Skin'
MyHappyTex(0)=Texture'_PGTX-Emoboy.emoboy_clothes_01'
MyHappyTex(1)=Texture'_PGTX-Emoboy.emoboy_skin'
bActorShadows=true
bPlayerShadows=true
bNetNotify=true
}