News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 23rd May 2004, 05:06 AM   #1
eLy
Registered User
 
eLy's Avatar
 
Join Date: Mar. 18th, 2003
Posts: 169
Sarcastic [UT2004] Variable Replication

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()
{
     ......
     class'DShockComboVortex'.default.GlobalAngleTemp=GlobalAngle;
}
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
__________________
My UT Tribute (12min/160MB): http://eLy.ch.vu (disable popup blockers)

Last edited by eLy; 23rd May 2004 at 12:41 PM.
eLy is offline   Reply With Quote
Old 23rd May 2004, 10:54 AM   #2
Zengi
Registered User
 
Join Date: May. 14th, 2004
Posts: 36
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 by Zengi; 23rd May 2004 at 10:57 AM.
Zengi is offline   Reply With Quote
Old 23rd May 2004, 11:42 AM   #3
eLy
Registered User
 
eLy's Avatar
 
Join Date: Mar. 18th, 2003
Posts: 169
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.
__________________
My UT Tribute (12min/160MB): http://eLy.ch.vu (disable popup blockers)
eLy is offline   Reply With Quote
Old 23rd May 2004, 12:35 PM   #4
DarkWithin
Registered User
 
Join Date: May. 8th, 2004
Posts: 5
for the Server, i think PostBeginPlay() should be okay
but for the Client, try setting the value in PostNetReceive(), and bNetNotify=true

Last edited by DarkWithin; 23rd May 2004 at 12:38 PM.
DarkWithin is offline   Reply With Quote
Old 23rd May 2004, 12:51 PM   #5
Mr_Evi1
International arms dealer
 
Mr_Evi1's Avatar
 
Join Date: Jan. 4th, 2003
Location: UK
Posts: 312
Default values of variables are not replicated.
__________________
http://come.to/MrEvil
Mr_Evi1 is offline   Reply With Quote
Old 23rd May 2004, 01:08 PM   #6
eLy
Registered User
 
eLy's Avatar
 
Join Date: Mar. 18th, 2003
Posts: 169
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.
__________________
My UT Tribute (12min/160MB): http://eLy.ch.vu (disable popup blockers)

Last edited by eLy; 23rd May 2004 at 01:16 PM.
eLy is offline   Reply With Quote
Old 23rd May 2004, 05:20 PM   #7
dataangel
Registered User
 
Join Date: Apr. 11th, 2004
Posts: 184
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.
dataangel is offline   Reply With Quote
Old 23rd May 2004, 07:06 PM   #8
eLy
Registered User
 
eLy's Avatar
 
Join Date: Mar. 18th, 2003
Posts: 169
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.
__________________
My UT Tribute (12min/160MB): http://eLy.ch.vu (disable popup blockers)
eLy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:25 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer