I thought this would work fine, it looks fine to me, but online this code returns an accessed none in this function and shows all four explosions rather than just the random one chosen. It seems that it explodes multiple times (seems to be when it hits a wall, not an actor) because I can hear the explode sound effect multiple times.
Any ideas? Because I don't see anything wrong with this code at all.
Oh, and timescale is a float variable I defined in the beginning of the script, it goes up as the projectile's time in the air goes up.
Any ideas? Because I don't see anything wrong with this code at all.
Oh, and timescale is a float variable I defined in the beginning of the script, it goes up as the projectile's time in the air goes up.
Code:
simulated function Explode(vector HitLocation, vector HitNormal)
{
local FireworkExp1 s;
local FireworkExp2 t;
local FireworkExp3 u;
local FireworkExp4 v;
local float Rand;
BlowUp(HitLocation);
Rand = FRand();
if((Rand>=0)&&(Rand<0.25))
{
s = spawn(class'RajMutators2.FireWorkExp1',,,HitLocation + HitNormal*16 );
s.DrawScale+=TimeScale;
}
else if((Rand>=0.25)&&(Rand<0.5))
{
t = spawn(class'RajMutators2.FireWorkExp2',,,HitLocation + HitNormal*16 );
t.DrawScale+=TimeScale;
}
else if((Rand>=0.5)&&(Rand<0.75))
{
u = spawn(class'RajMutators2.FireWorkExp3',,,HitLocation + HitNormal*16 );
u.DrawScale+=TimeScale;
}
else if((Rand>=0.75)&&(Rand<=1.0))
{
v = spawn(class'RajMutators2.FireWorkExp4',,,HitLocation + HitNormal*16 );
v.DrawScale+=TimeScale;
}
else
{
v = spawn(class'RajMutators2.FireWorkExp4',,,HitLocation + HitNormal*16 );
v.DrawScale+=TimeScale;
}
PlaySound(MiscSound, SLOT_None, 2.3);
Destroy();
}
Last edited: