Key binding and 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.

Grey Harverton

New Member
Dec 5, 2001
10
0
0
Australia
I am using UTextrakeybindings to create a binding for a new function.
I am then using 'exec function' to initiate whatever code I want whenever the user has pressed the key for my new function.
This all works very nicely in a single player situation, or when the player is the host of the game but when the player is a client it does nothing.

Is their more stuff I need to do to make the game aware of what the player is doing? I suspect it may have something to do with the replication info of the class which contains 'exec function' but all of my experimentation has led to nothing.
 

Captain Kewl

I know kewl.
Feb 13, 2001
794
0
0
IN YOUR HOUSE
Visit site
Yeah. The function has to be replicated to the server. Not sure about this, but I think the statement you want looks something like:

replication
{
reliable if( Role<ROLE_Authority )
YourFunctionName;
}


Alternatively, you can use a mutate string.
 

2COOL4-U

New Member
Mar 17, 2001
505
0
0
37
dot NL
2cool.free.fr
Originally posted by +RIP+Botje
it should be RemoteRole < Role_authority
or Role == Role_Authority
...

NO WAY DUDE. It should be replicated from the client to the server because it's an exec function

If we're on the server Role == Role_Authority and RemoteRole < Role_Authority. Because the server is always ROLE_Authority and the client never is.

For a client this is the opposite. A client never can be Role_Authority. And the client's Role is the server's remote role.

I pity your replication knowledge :)

BTW if you still think you are right. I replicate over 10 exec functions using Role < Role_Authority. And they all work perfectly over the internet/LAN. I can send you the part from DAPlayer if you like
 

2COOL4-U

New Member
Mar 17, 2001
505
0
0
37
dot NL
2cool.free.fr
Originally posted by Grey Harverton
Would it make any difference where this code was situated? My exec function resides in a class that extends weapon.
It shouldn't if you ask me, as exec functions are always called on the client
 

+RIP+Botje

New Member
Dec 8, 2001
19
0
0
38
A Sanitarium :)
Visit site
exec function Vote ( coerce string S )
exec function CallVote ( coerce string S )
replication
{
reliable if ( Role == ROLE_Authority )
Vote,Callvote;
}

works like a charm
 
Last edited:

2COOL4-U

New Member
Mar 17, 2001
505
0
0
37
dot NL
2cool.free.fr
Originally posted by +RIP+Botje
Code:
exec function Vote ( coerce string S )
exec function CallVote ( coerce string S )
replication
{
	reliable if ( Role == ROLE_Authority )
		Vote,Callvote;
}
works like a charm
What happens here is that the Server sends data to the client and the client doens't send the data to the server here. Perhaps you tried this out in a single player game or in a server game when you were the host. It should not work online for normal clients. Go read the replication tutorial at http://www.planetunreal.com/pipeline