Always snap to grid

Legacy:CorDharel/BioRocket

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

BioRocket[edit]

This is my first little project, a BioRifle with Rockets as primary ammo. I did it, not perfect, but I want to add some more functions to make the mutator playable and unique.

Current status:[edit]

08.08.2003 I want to code some more functions for my BioRocket to get more into unrealscript.

- Old

04.04.03 I got it! Wasn't that hard as I thought. Perhaps I will post a tutorial about it.

02.04.03 When I pickup a BioRiflePickup, I get the rocket launcher :)

31.03.03 I got a Biorifle with the sound of the rocket launcher, but I can't see some projectiles.

My Classes I thought I have to use:[edit]

- BioRocketMut - For the mutator

- BioRocket - For the new weapon

- BioRocketPickup - For the pickup

- BioRocketFire - For the projectile fire


Here is my current code:[edit]

Class BioRocketMut:

class BioRocketMut extends Mutator
config(user);
 
function bool bCheckReplacement (Actor Other, out byte bSuperRelevant)
{
 
bSuperRelevant = 0;
 
if ( xWeaponBase(Other) != None )
        {
        if ( xWeaponBase(Other).WeaponType == Class'BioRifle')
            xWeaponBase(Other).WeaponType = Class'BioRocket';
            return true;
        }
 
else if ( WeaponPickup(Other) != None )
{
 if ( string(Other.Class) ~= "XWeapons.BioRiflePickup" )
  ReplaceWith( Other, "CorPackage.BioRocketPickup");
  return true;
}
else
    return true;
 
return false;
}
 
defaultproperties
{
    GroupName="BioRocket"
    FriendlyName="BioRocket"
    Description="Replaces all BioRifles with rocket Shooting BioRifle"
}

Class BioRocket

class BioRocket extends RocketLauncher config(user);
 
defaultproperties
{
     PickupClass=Class'CorPackage.BioRocketPickup'
     ItemName="BioRocket"
}

Class BioRocketPickup

class BioRocketPickup extends UTWeaponPickup;
 
static function StaticPrecache(LevelInfo L)
{
    L.AddPrecacheMaterial(Texture'XEffects.xbiosplat2');
    L.AddPrecacheMaterial(Texture'XEffects.xbiosplat');
    L.AddPrecacheMaterial(Texture'XGameShaders.bio_flash');
	L.AddPrecacheStaticMesh(StaticMesh'WeaponStaticMesh.BioRiflePickup');
}
 
simulated function UpdatePrecacheMaterials()
{
    Level.AddPrecacheMaterial(Texture'XEffects.xbiosplat2');
    Level.AddPrecacheMaterial(Texture'XEffects.xbiosplat');
    Level.AddPrecacheMaterial(Texture'XGameShaders.bio_flash');
}
 
defaultproperties
{
     MaxDesireability=0.750000
     InventoryType=class'CorPackage.BioRocket'
     PickupMessage="You got the BioRocket"
     PickupSound=Sound'PickupSounds.FlakCannonPickup'
     PickupForce="FlakCannonPickup"
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'WeaponStaticMesh.BioRiflePickup'
     DrawScale=0.700000
}

Class BioRocketFire

class BioRocketFire extends ProjectileFire;
 
function PlayFireEnd()
{
}
 
function InitEffects()
{
    Super.InitEffects();
    if ( FlashEmitter != None )
		Weapon.AttachToBone(FlashEmitter, 'tip');
}
 
function Projectile SpawnProjectile(Vector Start, Rotator Dir)
{
    local Projectile p;
 
    p = RocketLauncher(Weapon).SpawnProjectile(Start, Dir);
    if ( p != None )
		p.Damage *= DamageAtten;
    return p;
}
 
defaultproperties
{
     ProjSpawnOffset=(X=25.000000,Y=6.000000,Z=-6.000000)
     TweenTime=0.000000
     FireSound=SoundGroup'WeaponSounds.RocketLauncher.RocketLauncherFire'
     FireForce="BioRocketFire"
     FireRate=0.900000
     AmmoClass=Class'XWeapons.RocketAmmo'
     AmmoPerFire=1
     ShakeRotTime=2.000000
     ShakeOffsetMag=(X=-20.000000)
     ShakeOffsetRate=(X=-1000.000000)
     ShakeOffsetTime=2.000000
     ProjectileClass=Class'XWeapons.RocketProj'
     BotRefireRate=0.500000
     WarnTargetPct=0.900000
     bSplashDamage=True
     bSplashJump=True
     bRecommendSplashDamage=True
     FlashEmitterClass=Class'XEffects.RocketMuzFlash1st'
}