PDA

View Full Version : ShottyShock Mutator


Burningmace
13th Apr 2006, 04:28 PM
I want to make a mutator that turns the Shock Rifle into what is in essence a shotgun. Basically, I want primary fire to fire 6 shock beams at random trajectories within a 10 degree cone. Secondary fire would fire the normal primary fire of the Shock Rifle.

I can do the second part (simply set FireModeClass(1) to XWeapons.ShockBeamFire in the defaultproperties of my ShottyShock class).

How can I do the first part?

rich_zap
13th Apr 2006, 05:16 PM
Have a look at what shockbeamfire is extended off of. It should be InstantFire.

Inside instantfire is a function called DoFireEffect if you look at the bottom of this function there is a line that says:

DoTrace(StartTrace, R);

what you want to do is repeat that line 6 times so it looks like the following:

function DoFireEffect()
{
local Vector StartTrace;
local Rotator R, Aim;
local int i

Instigator.MakeNoise(1.0);

// the to-hit trace always starts right in front of the eye
StartTrace = Instigator.Location + Instigator.EyePosition();
Aim = AdjustAim(StartTrace, AimError);
R = rotator(vector(Aim) + VRand()*FRand()*Spread);

For(i=0; i<6; i++)
{
DoTrace(StartTrace, R);
}
}

and to add the random directional element merely make the variable Spread something other than 0.

Burningmace
14th Apr 2006, 05:26 AM
Will the beams actually do damage? I thought DoFireEffect was simply for showing the beam on the screen, not for actually doing the damage...

MonsOlympus
14th Apr 2006, 06:06 AM
Yes I think your right, you'll need to iterate through dofireeffect totally not just the trace. I think modedofire is the one your looking for.

Burningmace
14th Apr 2006, 06:09 AM
rich_zap, I just noticed a problem with your code... wouldn't that fire 6 beams in one single random direction, instead of 6 beams in different random directions? Maybe you meant this...

For(i=0; i<6; i++)
{
R = rotator(vector(Aim) + VRand()*FRand()*Spread);
DoTrace(StartTrace, R);
}


Still, I tried this but it's not working.

Burningmace
14th Apr 2006, 06:57 AM
Never mind, fixed it. I forgot to edit my ShottyShockArena.uc to actually replace the weapon (I always clone my actual mutator class from the previous weapon mod I make).

Here's my code...

ShottyShockArena.uc

class ShottyShockArena extends Mutator
config(user);

function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
bSuperRelevant = 0;
if ( xWeaponBase(Other) != None )
{
if ( xWeaponBase(Other).WeaponType == class'ShockRifle' )
xWeaponBase(Other).WeaponType = class'MutShottyShock.ShottyShockRifle';
else
return true;
}
else if ( WeaponPickup(Other) != None )
{
if ( string(Other.Class) ~= "XWeapons.ShockRiflePickup" )
ReplaceWith( Other, "MutShottyShock.ShottyShockRiflePickup");
else
return true;
}
else
return true;


return false;
}

defaultproperties
{
GroupName="ShottyShock"
FriendlyName="Shotty Shock Rifle"
Description="Replaces the ASMD Shock Rifle with the new ASMD SS2 Rifle."
}


ShottyShockBeamFire.uc

class ShottyShockBeamFire extends ShockBeamFire;

function DoFireEffect()
{
local Vector StartTrace,X,Y,Z;
local Rotator R, Aim;
local int i;

Instigator.MakeNoise(1.0);

StartTrace = Instigator.Location + Instigator.EyePosition();
if ( PlayerController(Instigator.Controller) != None )
{
// for combos
Weapon.GetViewAxes(X,Y,Z);
StartTrace = StartTrace + X*class'ShockProjFire'.Default.ProjSpawnOffset.X;
if ( !Weapon.WeaponCentered() )
StartTrace = StartTrace + Weapon.Hand * Y*class'ShockProjFire'.Default.ProjSpawnOffset.Y + Z*class'ShockProjFire'.Default.ProjSpawnOffset.Z;
}
Aim = AdjustAim(StartTrace, AimError);
Spread = 0.3;
for(i=0; i<6; i++)
{
R = rotator(vector(Aim) + VRand()*FRand()*Spread);
DoTrace(StartTrace, R);
}
}

defaultproperties
{
BeamEffectClass=Class'XWeapons.ShockBeamEffect'
DamageType=Class'XWeapons.DamTypeShockBeam'
DamageMin=45
DamageMax=45
TraceRange=17000.000000
Momentum=60000.000000
bReflective=True
FireSound=SoundGroup'WeaponSounds.ShockRifle.ShockRifleFire'
FireForce="ShockRifleFire"
FireRate=0.700000
AmmoClass=Class'XWeapons.ShockAmmo'
AmmoPerFire=1
ShakeRotTime=2.000000
ShakeOffsetMag=(X=-8.000000)
ShakeOffsetRate=(X=-600.000000)
ShakeOffsetTime=3.200000
BotRefireRate=0.700000
FlashEmitterClass=Class'XEffects.ShockBeamMuzFlash'
aimerror=700.000000
}


ShottyShockRifle.uc

//=============================================================================
// Shock Rifle
//=============================================================================
class ShottyShockRifle extends ShockRifle
config(user);

defaultproperties
{
EffectColor=(B=255,R=192,A=128)
FireModeClass(0)=Class'MutShottyShock.ShottyShockBeamFire'
FireModeClass(1)=Class'XWeapons.ShockBeamFire'
SelectAnim="Pickup"
PutDownAnim="PutDown"
SelectSound=Sound'WeaponSounds.ShockRifle.SwitchToShockRifle'
SelectForce="SwitchToShockRifle"
AIRating=0.630000
CurrentRating=0.630000
OldMesh=SkeletalMesh'Weapons.ShockRifle_1st'
OldPickup="WeaponStaticMesh.ShockRiflePickup"
OldCenteredOffsetY=-8.000000
OldPlayerViewOffset=(X=-15.000000,Z=-5.000000)
OldSmallViewOffset=(X=-8.000000,Y=4.000000,Z=-8.000000)
OldPlayerViewPivot=(Pitch=1000,Yaw=-800,Roll=-500)
OldCenteredYaw=-500
Description="The new ASMD SS2 Rifle has two firing modes, allowing for short and long range attacks.||The primary fire emits a 6-beam shotgun like blast. As innacurate as this is, it is extremely powerful in a short range battle.|The secondary fire is the same as the original ASMD Shock Rifle's primary fire, allowing for higher accuracy in longer range attacks."
EffectOffset=(X=65.000000,Y=14.000000,Z=-10.000000)
DisplayFOV=70.000000
Priority=5
HudColor=(B=255,G=0,R=128)
SmallViewOffset=(X=11.000000,Y=11.500000,Z=-4.000000)
CenteredOffsetY=1.000000
CenteredRoll=1000
CenteredYaw=-1000
CustomCrosshair=8
CustomCrossHairColor=(G=0)
CustomCrossHairScale=1.333000
CustomCrossHairTextureName="Crosshairs.HUD.Crosshair_Cross2"
InventoryGroup=4
PickupClass=Class'XWeapons.ShockRiflePickup'
PlayerViewOffset=(X=4.000000,Y=8.000000,Z=-2.000000)
PlayerViewPivot=(Pitch=-1000)
BobDamping=1.800000
AttachmentClass=Class'XWeapons.ShockAttachment'
IconMaterial=Texture'HUDContent.Generic.HUD'
IconCoords=(X1=250,Y1=110,X2=330,Y2=145)
ItemName="Shotty Shock Rifle"
LightType=LT_Steady
LightEffect=LE_NonIncidence
LightHue=200
LightSaturation=70
LightBrightness=255.000000
LightRadius=4.000000
LightPeriod=3
Mesh=SkeletalMesh'NewWeapons2004.ShockRifle'
DrawScale=0.700000
HighDetailOverlay=Combiner'UT2004Weapons.WeaponSpecMap2'
}


ShottyShockRiflePickup.uc

//=============================================================================
// ShockRiflePickup
//=============================================================================
class ShottyShockRiflePickup extends ShockRiflePickup;

defaultproperties
{
StandUp=(Y=0.250000,Z=0.000000)
MaxDesireability=0.630000
InventoryType=Class'MutShottyShock.ShottyShockRifle'
PickupMessage="You got the Shotty Shock Rifle."
PickupSound=Sound'PickupSounds.ShockRiflePickup'
PickupForce="ShockRiflePickup"
DrawType=DT_StaticMesh
StaticMesh=StaticMesh'NewWeaponPickups.ShockPickupSM'
DrawScale=0.550000
Skins(0)=Texture'UT2004Weapons.NewWeaps.ShockRifleTex0'
Skins(1)=FinalBlend'UT2004Weapons.Shaders.PurpleShockFinal'
}


It's bloody awesome against close range targets, and for long range targets you've always got secondary fire :)

Anyway, feel free to use this mutator on your own server.

rich_zap
14th Apr 2006, 07:54 AM
Glad it worked :). Oops, for some reason i thought the randomizer code was in DoTrace, my bad.

Burningmace
14th Apr 2006, 09:11 AM
No problem, just glad I got it fixed :)