News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 13th Apr 2006, 03:28 PM   #1
Burningmace
Banned
 
Burningmace's Avatar
 
Join Date: Feb. 18th, 2004
Location: 127.0.0.1
Posts: 59
ShottyShock Mutator

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?
__________________


"There are only two things which I think to be infinite, the universe and human stupidity, and I'm not sure about the universe." - Albert Einstein.
Burningmace is offline   Reply With Quote
Old 13th Apr 2006, 04:16 PM   #2
rich_zap
Registered User
 
rich_zap's Avatar
 
Join Date: Jul. 18th, 2004
Location: Dissapearing into the fog !
Posts: 133
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:

Code:
    DoTrace(StartTrace, R);
what you want to do is repeat that line 6 times so it looks like the following:

Code:
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.
__________________
Fear is the mindkiller

rich_zap is offline   Reply With Quote
Old 14th Apr 2006, 04:26 AM   #3
Burningmace
Banned
 
Burningmace's Avatar
 
Join Date: Feb. 18th, 2004
Location: 127.0.0.1
Posts: 59
Will the beams actually do damage? I thought DoFireEffect was simply for showing the beam on the screen, not for actually doing the damage...
__________________


"There are only two things which I think to be infinite, the universe and human stupidity, and I'm not sure about the universe." - Albert Einstein.
Burningmace is offline   Reply With Quote
Old 14th Apr 2006, 05:06 AM   #4
MonsOlympus
Registered User
 
MonsOlympus's Avatar
 
Join Date: May. 27th, 2004
Posts: 2,221
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.
__________________
MonsOlympus is offline   Reply With Quote
Old 14th Apr 2006, 05:09 AM   #5
Burningmace
Banned
 
Burningmace's Avatar
 
Join Date: Feb. 18th, 2004
Location: 127.0.0.1
Posts: 59
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...
Code:
    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.
__________________


"There are only two things which I think to be infinite, the universe and human stupidity, and I'm not sure about the universe." - Albert Einstein.

Last edited by Burningmace; 14th Apr 2006 at 05:20 AM.
Burningmace is offline   Reply With Quote
Old 14th Apr 2006, 05:57 AM   #6
Burningmace
Banned
 
Burningmace's Avatar
 
Join Date: Feb. 18th, 2004
Location: 127.0.0.1
Posts: 59
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
Code:
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
Code:
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
Code:
//=============================================================================
// 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
Code:
//=============================================================================
// 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.
__________________


"There are only two things which I think to be infinite, the universe and human stupidity, and I'm not sure about the universe." - Albert Einstein.
Burningmace is offline   Reply With Quote
Old 14th Apr 2006, 06:54 AM   #7
rich_zap
Registered User
 
rich_zap's Avatar
 
Join Date: Jul. 18th, 2004
Location: Dissapearing into the fog !
Posts: 133
Glad it worked . Oops, for some reason i thought the randomizer code was in DoTrace, my bad.
__________________
Fear is the mindkiller


Last edited by rich_zap; 14th Apr 2006 at 06:55 AM.
rich_zap is offline   Reply With Quote
Old 14th Apr 2006, 08:11 AM   #8
Burningmace
Banned
 
Burningmace's Avatar
 
Join Date: Feb. 18th, 2004
Location: 127.0.0.1
Posts: 59
No problem, just glad I got it fixed
__________________


"There are only two things which I think to be infinite, the universe and human stupidity, and I'm not sure about the universe." - Albert Einstein.
Burningmace is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:20 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer