Time for action – Using simulated functions
We'll be using PostBeginPlay
for this, which is why we're spawning the AwesomeWeaponUpgrade
with Kismet instead of just placing one directly in the editor. PostBeginPlay
is called when an actor is first created, but our client won't connect to the server until that's already happened. This is an important thing to note when dealing with replication for editor-placed actors.
Open
AwesomeWeaponUpgrade
in ConTEXT.To start, we're going to write a non-simulated version of
PostBeginPlay
.function PostBeginPlay() { `log("PostBeginPlay===================="); }
We'll add some equal signs to the end of our log to make it easier to spot.
Compile the code.
Run the server and the client, and then run over to the trigger. We'll see the log show up on the server:
[0013.84] ScriptLog: PostBeginPlay====================
We won't see this on the client.
Now let's see what happens when we add the
simulated
function modifier:simulated function PostBeginPlay() { `log...