PDA

View Full Version : [UT2004] Variable Replication


eLy
23rd May 2004, 05:06 AM
Hi,
I'm having a little problem where i'm setting the default value of a global variable from another class. when i run this on a dedicated server the value logs 0.00 (locally it works fine)

I've tested various ROLE and RemoteRole's and i can't quite figure out why it's not working.


class DynamicShockProjectile extends ShockProjectile;

var float GlobalAngle;

replication
{
reliable if (ROLE == ROLE_Authority)
GlobalAngle;
}


simulated function getAngle()
{
......
class'DShockComboVortex'.default.GlobalAngleTemp=GlobalAngle;
}



class DShockComboVortex extends ShockComboVortex;

var float GlobalAngleTemp;

replication
{
reliable if (ROLE == ROLE_Authority)
GlobalAngleTemp;
}

event PostBeginPlay()
{
Super.PostBeginPlay();

ScaleInterp.Mid=1.6*default.GlobalAngleTemp;

log("default.GlobalAngleTemp "$default.GlobalAngleTemp);
}

defaultproperties
{
ScaleInterp=(Start=0.400000,Mid=1.60000,End=0.200000,InTime=0.400000,OutTime=0.400000,InStyle=IS_Inv Exp,OutStyle=IS_InvExp)

RemoteRole=ROLE_SimulatedProxy
bAlwaysRelevant=true
ROLE==ROLE_Authority
}


any suggestions ?
thanks
eLy

Zengi
23rd May 2004, 10:54 AM
I believe PostBeginPlay occurs before variable replication. There is another function to use though it has the word Net somewhere in there, hold on I'll look it up for ya.

Ok goody found it, PostNetBeginPlay ( ).

Now keep in mind this isn't guaranteed to have received the packet of info before it is called. However, PostBeginPlay has 0 % chance of that happening simply because its called before the info is processed.

Instead its probably best to just set a small timer and do what you need to do there.

eLy
23rd May 2004, 11:42 AM
hey Zengi, thanks for the reply.

I have tried using PostNetBeginPlay() before ... no luck.
but i'm gonna check out the Timer as you said, I haven't used that function before.

DarkWithin
23rd May 2004, 12:35 PM
for the Server, i think PostBeginPlay() should be okay
but for the Client, try setting the value in PostNetReceive(), and bNetNotify=true

Mr_Evi1
23rd May 2004, 12:51 PM
Default values of variables are not replicated.

eLy
23rd May 2004, 01:08 PM
oh, this is so great.

there's no way to do this ?
argh, after 4 days of trying to find a new way to do this:
http://forums.beyondunreal.com/showthread.php?t=135332

I was so happy that somebody had a solution for me yesterday...
just to find out that it's impossibile...again ?

are there any other ways to simply read GlobalAngle (in DynamicShockProjectile) from within DShockComboVortex ? that's all i want..
(...that work on a dedicated server...)

well thanks anyway guys.

dataangel
23rd May 2004, 05:20 PM
class'DShockComboVortex'.default.GlobalAngleTemp


That gets the default for that variable for that class. Instead access the variable from an actual instance of the class.


var DShockComboVortex D;

D = spawn(class'DShockComboVortex');

D.GlobalAngleTemp


Something like that.

eLy
23rd May 2004, 07:06 PM
thanks dataangel, i actually have tried that too =)
But it returned 0.00

I'm assuming that is because D.GlobalAngleTemp gets accessed after DShockComboVortex has already fully executed.

Or is there a way to have DShockComboVortex "wait" for me to set D.GlobalAngleTemp before it starts executing?

that would probably be a good solution.