PDA

View Full Version : How to change Emitter properties on clients?


seema
19th Apr 2005, 02:03 PM
I've been looking at other forum posts and found out how to replicate my Emitter to clients using RemoteRole = ROLE_SimulatedProxy, but after the Emitter is spawned I want to change the color and that doesn't seem to work.

The color is changed on the server but not on the clients. Can anyone help me? I'm posting code below. I removed all the parts unnecessary to this topic.


HZGameInfo extends GameInfo;
...
simulated function Timer()
{
super(GameInfo).Timer();
...
RestartInstructor();
...
}

simulated function RestartInstructor()
{
...
SpawnLevelObjects();
...
}

simulated function SpawnLevelObjects()
{
...
scenarioDataPack.SpawnLevelObjects();
...
}

class HZScenarioDataPack extends Actor;
...
simulated function SpawnLevelObjects()
{
SpawnHazards();
...
}

simulated function bool SpawnHazards()
{
...
GPN = ZoneInformation[i].GasPNodes[0];
HG = spawn(class'GasEmitter', None,'', GPN.Location, GPN.Rotation);

gasColor = getGasColor(i);
...
HG.SetGasProperties(gasColor, iExposureRadius, iExposureSyptom);
}

class GasEmitter extends Emitter;
...
simulated function SetGasProperties(color GasColor, int iExposureRadius, int symptom)
{
// set gas color
Emitters[0].ColorMultiplierRange.X.Min=GasColor.R;
Emitters[0].ColorMultiplierRange.X.Max=GasColor.R;

Emitters[0].ColorMultiplierRange.Y.Min=GasColor.G;
Emitters[0].ColorMultiplierRange.Y.Max=GasColor.G;

Emitters[0].ColorMultiplierRange.Z.Min=GasColor.B;
Emitters[0].ColorMultiplierRange.Z.Max=GasColor.B;
}

defaultproperties
{
Begin Object Class=SpriteEmitter Name=SpriteEmitter1
Acceleration=(X=0,Y=0,Z=-5)
UseCollision=True
DampingFactorRange=(X=(Min=0.900000,Max=0.990000),Y=(Min=0.900000,Max=0.990000),Z=(Min=0.100000,Max= 0.300000))
ColorScaleRepeats=1.000000
ColorMultiplierRange=(X=(Min=128.000000,Max=128.000000),Y=(Min=52.000000,Max=52.000000),Z=(Min=216.0 00000,Max=216.000000))
FadeOutFactor=(W=1.500000)
FadeOutStartTime=2.000000
FadeOut=True
FadeInEndTime=2.000000
FadeIn=True
UseActorForces=True
MaxParticles=2000
AutoDestroy=True
StartMassRange=(Min=8.000000,Max=2.000000)
SpinParticles=True
SpinsPerSecondRange=(X=(Max=0.100000),Y=(Max=0.100000),Z=(Max=0.100000))
UseRegularSizeScale=False
SizeScale(0)=(RelativeTime=60.000000,RelativeSize=15.000000)
StartSizeRange=(X=(Min=10.000000,Max=20.000000),Y=(Min=1.000000,Max=1.000000),Z=(Min=1.000000,Max=1. 000000))
UniformSize=True
DrawStyle=PTDS_AlphaBlend
Texture=Texture'testpackage.smoke1'
TextureUSubdivisions=2
TextureVSubdivisions=2
SubdivisionScale(0)=1.000000

SubdivisionScale(1)=1.000000
SubdivisionScale(2)=1.000000
SubdivisionScale(3)=1.000000
LifetimeRange=(Min=60.000000,Max=240.000000)
StartVelocityRange=(X=(Min=-7.000000,Max=7.000000),Y=(Min=-7.000000,Max=7.000000),Z=(Min=-5.000000,Max=-10.000000))
Name="SpriteEmitter1"
End Object
Emitters(0)=SpriteEmitter'HotZone.GasEmitter.SpriteEmitter1'

bNoDelete=False
bAlwaysRelevant=true
RemoteRole=ROLE_SimulatedProxy
}

Arelius
20th Apr 2005, 03:17 PM
Well, first your likely going to need a replication block to replicate your changes.

I see you have the simulated function there, but that won't quite do it because first of all, simulated functions aren't automatically replicated, second of all functions can only be replicated to clients who's Controller, or Pawn is owning the actor.

so a replication block could look alot like this

replication
{
reliable if(Role==Role_Authority) mVar1, mVar2;
}

that would replicate mVar1 and mVar 2 from the Authority of the pawn (server most of the time, Role==Role_Authority) to all the clients.