I understand the concept of UnrealScript, (classes, subclasses, OOP) and I made this mod that I learned from 3DBuzz but I am not exactly getting it. I look at the scripts in the actor class browser and it just doesn't make much sense. Here is the script for the flak shell. //================================================== ===========================
// flakshell
//================================================== ===========================
class flakshell extends Projectile;
#exec TEXTURE IMPORT NAME=NewFlakSkin FILE=textures\jflakslugel1.bmp GROUP="Skins" DXT=5
var xemitter trail;
var vector initialDir;
simulated function PostBeginPlay()
{
local Rotator R;
if ( !PhysicsVolume.bWaterVolume && (Level.NetMode != NM_DedicatedServer) )
Trail = Spawn(class'FlakShellTrail',self);
Super.PostBeginPlay();
Velocity = Vector(Rotation) * Speed;
R = Rotation;
R.Roll = 32768;
SetRotation(R);
Velocity.z += TossZ;
initialDir = Velocity;
}
simulated function destroyed()
{
if (Trail!=None)
Trail.mRegen=False;
Super.Destroyed();
}
simulated function ProcessTouch(Actor Other, Vector HitLocation)
{
if ( Other != Instigator )
{
SpawnEffects(HitLocation, -1 * Normal(Velocity) );
Explode(HitLocation,Normal(HitLocation-Other.Location));
}
}
simulated function SpawnEffects( vector HitLocation, vector HitNormal )
{
PlaySound (Sound'WeaponSounds.BExplosion1',,3*TransientSound Volume);
if ( EffectIsRelevant(Location,false) )
{
spawn(class'FlakExplosion',,,HitLocation + HitNormal*16 );
spawn(class'FlashExplosion',,,HitLocation + HitNormal*16 );
spawn(class'RocketSmokeRing',,,HitLocation + HitNormal*16, rotator(HitNormal) );
if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
Spawn(ExplosionDecal,self,,HitLocation, rotator(-HitNormal));
}
}
simulated function Landed( vector HitNormal )
{
SpawnEffects( Location, HitNormal );
Explode(Location,HitNormal);
}
simulated function HitWall (vector HitNormal, actor Wall)
{
Landed(HitNormal);
}
simulated function Explode(vector HitLocation, vector HitNormal)
{
local vector start;
local rotator rot;
local int i;
local FlakChunk NewChunk;
start = Location + 10 * HitNormal;
if ( Role == ROLE_Authority )
{
HurtRadius(damage, 220, MyDamageType, MomentumTransfer, HitLocation);
for (i=0; i<6; i++)
{
rot = Rotation;
rot.yaw += FRand()*32000-16000;
rot.pitch += FRand()*32000-16000;
rot.roll += FRand()*32000-16000;
NewChunk = Spawn( class 'FlakChunk',, '', Start, rot);
}
}
Destroy();
}
I just don't fully get it, I mean why cant it just say press primary fire and play animation of flak shell exploding or something like that? Like I said I understand some things like variables and functions like + and - but some of the code makes no sense. Please help!!
// flakshell
//================================================== ===========================
class flakshell extends Projectile;
#exec TEXTURE IMPORT NAME=NewFlakSkin FILE=textures\jflakslugel1.bmp GROUP="Skins" DXT=5
var xemitter trail;
var vector initialDir;
simulated function PostBeginPlay()
{
local Rotator R;
if ( !PhysicsVolume.bWaterVolume && (Level.NetMode != NM_DedicatedServer) )
Trail = Spawn(class'FlakShellTrail',self);
Super.PostBeginPlay();
Velocity = Vector(Rotation) * Speed;
R = Rotation;
R.Roll = 32768;
SetRotation(R);
Velocity.z += TossZ;
initialDir = Velocity;
}
simulated function destroyed()
{
if (Trail!=None)
Trail.mRegen=False;
Super.Destroyed();
}
simulated function ProcessTouch(Actor Other, Vector HitLocation)
{
if ( Other != Instigator )
{
SpawnEffects(HitLocation, -1 * Normal(Velocity) );
Explode(HitLocation,Normal(HitLocation-Other.Location));
}
}
simulated function SpawnEffects( vector HitLocation, vector HitNormal )
{
PlaySound (Sound'WeaponSounds.BExplosion1',,3*TransientSound Volume);
if ( EffectIsRelevant(Location,false) )
{
spawn(class'FlakExplosion',,,HitLocation + HitNormal*16 );
spawn(class'FlashExplosion',,,HitLocation + HitNormal*16 );
spawn(class'RocketSmokeRing',,,HitLocation + HitNormal*16, rotator(HitNormal) );
if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
Spawn(ExplosionDecal,self,,HitLocation, rotator(-HitNormal));
}
}
simulated function Landed( vector HitNormal )
{
SpawnEffects( Location, HitNormal );
Explode(Location,HitNormal);
}
simulated function HitWall (vector HitNormal, actor Wall)
{
Landed(HitNormal);
}
simulated function Explode(vector HitLocation, vector HitNormal)
{
local vector start;
local rotator rot;
local int i;
local FlakChunk NewChunk;
start = Location + 10 * HitNormal;
if ( Role == ROLE_Authority )
{
HurtRadius(damage, 220, MyDamageType, MomentumTransfer, HitLocation);
for (i=0; i<6; i++)
{
rot = Rotation;
rot.yaw += FRand()*32000-16000;
rot.pitch += FRand()*32000-16000;
rot.roll += FRand()*32000-16000;
NewChunk = Spawn( class 'FlakChunk',, '', Start, rot);
}
}
Destroy();
}
I just don't fully get it, I mean why cant it just say press primary fire and play animation of flak shell exploding or something like that? Like I said I understand some things like variables and functions like + and - but some of the code makes no sense. Please help!!
Comment