| Home Page | Recent Changes | Preferences

SabbathCat/AnyProjectileSpawner

It's basically a MortarSpawner code, but now will fire any projectile.

//=============================================================================
// MortarSpawner3. New (Improved?)
//=============================================================================
class GungHo extends Effects;

#exec mesh import mesh=gungho01 anivfile=Models\gungho01_a.3d datafile=Models\gungho01_d.3d x=0 y=0 z=0 mlod=0
#exec mesh origin mesh=gungho01 x=0 y=0 z=0 YAW=-16384 PITCH=16384 ROLL=0


#exec mesh sequence mesh=gungho01 seq=All startframe=0 numframes=1

#exec meshmap new meshmap=gungho01 mesh=gungho01
#exec meshmap scale meshmap=gungho01 x=0.13281 y=0.13281 z=0.26563

var() int ShellDamage;
var() int ShellMomentumTransfer;
var() int ShellBlastRadius;
var() int RateOfFire;
var() float ShellSpeed;
var() int Deviation;
var() bool bDeviate;
var() sound FireSound;
var() Class<Projectile> ProjectileType;
var() float ProjectileScale;
var() float PCRM;
var() float PCHM;
var() vector VelocityMultiplyerJ;

function BeginPlay()
{
    SetTimer(RateOfFire, True);
}

function Timer()
{
    LaunchShell();
    PlaySound(FireSound, SLOT_None, 4.0);   
}

function LaunchShell()
{
    local rotator NewRot;
    local Projectile shell;

    if (bDeviate)
    {
        NewRot.Pitch = Rotation.Pitch + (Deviation/2) - (Deviation * FRand());
        NewRot.Roll  = Rotation.Roll  + (Deviation/2) - (Deviation * FRand());
        NewRot.Yaw   = Rotation.Yaw   + (Deviation/2) - (Deviation * FRand());
    }
    else
        NewRot = Rotation;

    shell = Spawn(ProjectileType,,, Location+Vector(Rotation)*20, NewRot);
        shell.Speed = ShellSpeed;
    shell.Damage = ShellDamage;
    shell.MomentumTransfer = ShellMomentumTransfer;
    shell.DrawScale=ProjectileScale;
//  shell.CollisionHeight = shell.CollisionHeight*PCHM;
//  shell.CollisionRadius = shell.CollisionRadius*PCRM;
        shell.Velocity=shell.Velocity*VelocityMultiplyerJ;

}

defaultproperties
{
     ShellDamage=70
     ShellMomentumTransfer=150000
     ShellBlastRadius=400
     RateOfFire=5
     Deviation=4096
     bDeviate=True
     FireSound=Sound'UnrealShare.flak.Explode1'
     bHidden=True
     bNetTemporary=False
     bDirectional=True
  DrawType=DT_Mesh
  Mesh=Mesh'gungho01'
  bCollideWhenPlacing=False
  bCollideWorld=False
  CollisionRadius=17.00000
  CollisionHeight=34.00000
  MultiSkins(0)=Texture'UnrealI.Skins.JBlob1'
  MultiSkins(1)=Texture'UnrealI.Skins.JBoulder1'
  MultiSkins(2)=Texture'UnrealI.Skins.AAsbSuit1'
     ProjectileScale=1.000000
     PCHM=1.000000 
     PCRM=1.000000
  VelocityMultiplyerJ=1.000000,1.000000,1.000000
}

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In