So, if I understood right, you just want the altfire red trace/line effect of the super shock rifle to have the regular shockrifle blue color.
This should do it (explanation below):
- Code: Select all
class MySuperShockRifle expands SuperShockRifle;
var() class<ShockBeam> ShockBeamClass;
var E_ShotType shotType;
function Fire(float Value)
shotType = ST_Fire;
function AltFire(float Value)
shotType = ST_AltFire;
function SpawnEffect(vector HitLocation, vector SmokeLocation)
local SuperShockBeam Smoke,shock;
local Vector DVector;
local int NumPoints;
local rotator SmokeRotation;
DVector = HitLocation - SmokeLocation;
NumPoints = VSize(DVector)/135.0;
if ( NumPoints < 1 )
SmokeRotation = rotator(DVector);
SmokeRotation.roll = Rand(65535);
Smoke = Spawn(ShockBeamClass[shotType],,,SmokeLocation,SmokeRotation);
Smoke.MoveAmount = DVector/NumPoints;
Smoke.NumPuffs = NumPoints - 1;
Basically the effect is spawned with SpawnEffect, therefore you have to alternate between spawning either ShockBeam (blue version) or SuperShockBeam (red version).
What I did there (so the code would be the most "correct" possible), was to declare ShockBeamClass as the property where you define the beam classes, where the slot 0 is for fire and slot 1 for altfire.
Then I created an enumeration called E_ShotType which is then declared as variable as shotType.
As you can see in SpawnEffect, I used shotType to select which class to spawn from the array.
shotType could have been a byte as well, and assign 0 and 1 in fire and altfire respectively, however legible code is the best thing to do and enumerations in UScript (and some other languages) are the same thing as a byte variables, but with an alias, therefore ST_Fire=0, and ST_AltFire=1 actually, and to keep code legible in what those bytes mean, I used an enum instead (simply good coding practice, that's all).
Btw, I didn't test/compile this code, so if it has any syntax error, sorry.