I ran into a strange problem the other day with a script I am writing. I am trying to make an actor always point at another actor. I got it working offline, but naturally it dosent work online so i had to delve into replication. I got the rest of my script working by making some of the functions simulated and replicating a few variables. But for some reason this part of my script will not work, and i dont understand why:
Like i said, everything else works fine, so i know the functions are getting run on the client, not just the server. But I dont understand why this particular one would not work. Any ideas?
Code:
simulated event Tick(float TimeDelta)
{
if (bActive)
{
GotoState('viewing');
bActive=False;
}
}
event Trigger (Actor Other, Pawn EventInstigator)
{
bActive = True;
Instigator = EventInstigator;
}
Simulated State Viewing
{
simulated event Tick (float Delta)
{
local vector a, b;
if (vtarget!= none)
{
a = Self.location;
b = vtarget.location;
global.tick(Delta);
SetRotation(rotator(b - a));
}
}
}
Like i said, everything else works fine, so i know the functions are getting run on the client, not just the server. But I dont understand why this particular one would not work. Any ideas?