Constants are, well, constants, the meaning of the word being, among others, "something that does not change over time". Most of actor properties expect a constant value for their definition,
DamageFunction being an exception. So it's simply not possible to declare
Speed the way you want it. However, you can change the value of the
Speed backing field at runtime, for example, if you override
Tick:
Code: Select all
override void Tick()
{
Super.Tick();
Speed = Cvar.FindCvar('cl_tracerbasespeed').GetInt() * Random(1, 3);
}
Note that the above will work for monsters but not for projectiles. This is because a projectile's velocity is set only once when it gets spawned. You will have to change the value of
Vel (a 3D vector) instead:
Code: Select all
override void Tick()
{
Super.Tick();
double mySpeed = Cvar.FindCvar('cl_tracerbasespeed').GetInt() * Random(1, 3);
Vel = Vel.Unit() * mySpeed;
}
If you actually intend to set the speed only once and keep it at that, then overriding
BeginPlay should do it. Then, you can manipulate
Speed and not
Vel because at this time, the velocity has not yet been set by the engine:
Code: Select all
override void BeginPlay()
{
Super.BeginPlay();
Speed = Cvar.FindCvar('cl_tracerbasespeed').GetInt() * Random(1, 3);
}