PDA

View Full Version : Modifying a bool in a projectile class through a mutator



Radiosity
06-12-2005, 08:29 PM
I've come across a rather annoying problem that I am having trouble finding a way around. Basically, I have a projectile superclass to store a number of variables for use in my projectile subclasses, one of which is a var for spawning a dynamic light class when the projectile explodes.

This works fine. However, since dynamic lights are something of a resource hog I want to have an option in one of my mutators to allow or disallow these light classes from being spawned, by using a bool in the proj superclass, then checking to see if it is true or not in the proj subclasses. Simple enough, or so I thought.

From Mutator.uc:



or to modify, remove,
// or replace all other actors when they are spawned with CheckRelevance(), which
// is called from the PreBeginPlay() function of all actors except those (Decals,
// Effects and Projectiles for performance reasons) which have bGameRelevant==true.


So it seems I can't modify a projectile class through a mutator, which is very annoying. Does anyone happen to know of a way to access and change a variable by using a mutator that I may have missed? Sure, I could just make the bool in the proj superclass a config and save it directly out to my .ini, but ideally I want to give players the option of just clicking a checkbox in a mutator without having to dig through an .ini with in excess of 50 or so options.

Thanks in advance :)

Radiosity
06-12-2005, 08:53 PM
Right, after thinking about the problem from a slightly different angle, I've come up with a good solution that doesn't even touch the projectile class :) In my mutator, instead of trying to modify the projectile to use the light classes, I've simply referenced the light superclass I'm using and told it to switch lighttype and effect to LT_None and LE_None if the mutator bool is set to false. Easy as pie and works like a charm :D



var() config bool bUseProjectileLights;

function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
bSuperRelevant = 0;

if ( !bUseProjectileLights )
{
if ( Other.IsA('RadiantLight') || Other.ClassIsChildOf(Other.class, class'RadiantLight') )
{
RadiantLight(Other).LightType = LT_None;
RadiantLight(Other).LightEffect = LE_None;
}
}
return true;
}