[UT2004] Variable Replication

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

eLy

New Member
Mar 18, 2003
169
0
0
Visit site
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.

Code:
class DynamicShockProjectile extends ShockProjectile;

var float GlobalAngle;

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


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

Code:
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_InvExp,OutStyle=IS_InvExp)

     RemoteRole=ROLE_SimulatedProxy
     bAlwaysRelevant=true
     ROLE==ROLE_Authority
}

any suggestions ?
thanks
eLy
 
Last edited:

Zengi

New Member
May 14, 2004
36
0
0
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.
 
Last edited:

eLy

New Member
Mar 18, 2003
169
0
0
Visit site
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

New Member
May 8, 2004
5
0
0
for the Server, i think PostBeginPlay() should be okay
but for the Client, try setting the value in PostNetReceive(), and bNetNotify=true
 
Last edited:

eLy

New Member
Mar 18, 2003
169
0
0
Visit site
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.
 
Last edited:

dataangel

New Member
Apr 11, 2004
184
0
0
Code:
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.

Code:
var DShockComboVortex D;

D = spawn(class'DShockComboVortex');

D.GlobalAngleTemp

Something like that.
 

eLy

New Member
Mar 18, 2003
169
0
0
Visit site
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.