Hello I've made a PoisonDartGun based on the ShockRifle which fires a custom projectile which spawns an Inventory item which damages the owner over time. Have got it all working but for some reason it is does not appear under WeaponPickUpFactory in the editor. I can't figure out what I've done wrong I've also made an edited version of rocket launcher which fires bouncy grenades and that shows up fine. Any Help would be greatly appreciated.
Here is the code for my weapon
Here is the code for my weapon
Code:
class UTWeap_PoisonDartGunBase extends UTWeapon
abstract;
defaultproperties
{
InventoryGroup=4
}
Code:
class UTWeap_PoisonDartGun extends UTWeapon;
// AI properties (for shock combos)
var UTProj_PoisonDart ComboTarget;
var bool bRegisterTarget;
var bool bWaitForCombo;
var vector ComboStart;
var bool bWasACombo;
var int CurrentPath;
//-----------------------------------------------------------------
// AI InterFface
function float GetAIRating()
{
local UTBot B;
B = UTBot(Instigator.Controller);
if ( (B == None) || (B.Enemy == None) || Pawn(B.Focus) == None )
return AIRating;
if ( bWaitForCombo )
return 1.5;
if ( !B.ProficientWithWeapon() )
return AIRating;
if ( B.Stopped() )
{
if ( !B.LineOfSightTo(B.Enemy) && (VSize(B.Enemy.Location - Instigator.Location) < 5000) )
return (AIRating + 0.5);
return (AIRating + 0.3);
}
else if ( VSize(B.Enemy.Location - Instigator.Location) > 1600 )
return (AIRating + 0.1);
else if ( B.Enemy.Location.Z > B.Location.Z + 200 )
return (AIRating + 0.15);
return AIRating;
}
/**
* Overriden to use GetPhysicalFireStartLoc() instead of Instigator.GetWeaponStartTraceLocation()
* @returns position of trace start for instantfire()
*/
simulated function vector InstantFireStartTrace()
{
return GetPhysicalFireStartLoc();
}
function float RangedAttackTime()
{
local UTBot B;
B = UTBot(Instigator.Controller);
if ( (B == None) || (B.Enemy == None) )
return 0;
if ( B.CanComboMoving() )
return 0;
return FMin(2,0.3 + VSize(B.Enemy.Location - Instigator.Location)/class'UTProj_PoisonDart'.default.Speed);
}
function float SuggestAttackStyle()
{
return -0.4;
}
simulated function StartFire(byte FireModeNum)
{
if ( bWaitForCombo && (UTBot(Instigator.Controller) != None) )
{
if ( (ComboTarget == None) || ComboTarget.bDeleteMe )
bWaitForCombo = false;
else
return;
}
Super.StartFire(FireModeNum);
}
simulated function rotator GetAdjustedAim( vector StartFireLoc )
{
local rotator ComboAim;
// if ready to combo, aim at shockball
if (UTBot(Instigator.Controller) != None && CurrentFireMode == 0 && ComboTarget != None && !ComboTarget.bDeleteMe)
{
// use bot yaw aim, so bots with lower skill/low rotation rate may miss
ComboAim = rotator(ComboTarget.Location - StartFireLoc);
ComboAim.Yaw = Instigator.Rotation.Yaw;
return ComboAim;
}
return Super.GetAdjustedAim(StartFireLoc);
}
simulated state WeaponFiring
{
/**
* Called when the weapon is done firing, handles what to do next.
*/
simulated event RefireCheckTimer()
{
if ( bWaitForCombo && (UTBot(Instigator.Controller) != None) )
{
if ( (ComboTarget == None) || ComboTarget.bDeleteMe )
bWaitForCombo = false;
else
{
StopFire(CurrentFireMode);
GotoState('Active');
return;
}
}
Super.RefireCheckTimer();
}
}
simulated function ImpactInfo CalcWeaponFire(vector StartTrace, vector EndTrace, optional out array<ImpactInfo> ImpactList, optional vector Extent)
{
local ImpactInfo II;
II = Super.CalcWeaponFire(StartTrace, EndTrace, ImpactList, Extent);
bWasACombo = (II.HitActor != None && UTProj_PoisonDart(II.HitActor) != none );
return ii;
}
function SetFlashLocation( vector HitLocation )
{
local byte NewFireMode;
if( Instigator != None )
{
if (bWasACombo)
{
NewFireMode = 3;
}
else
{
NewFireMode = CurrentFireMode;
}
Instigator.SetFlashLocation( Self, NewFireMode , HitLocation );
}
}
simulated function SetMuzzleFlashParams(ParticleSystemComponent PSC)
{
local float PathValues[3];
local int NewPath;
Super.SetMuzzleFlashparams(PSC);
if (CurrentFireMode == 0)
{
if ( !bWasACombo )
{
NewPath = Rand(3);
if (NewPath == CurrentPath)
{
NewPath++;
}
CurrentPath = NewPath % 3;
PathValues[CurrentPath % 3] = 1.0;
PSC.SetFloatParameter('Path1',PathValues[0]);
PSC.SetFloatParameter('Path2',PathValues[1]);
PSC.SetFloatParameter('Path3',PathValues[2]);
}
else
{
PSC.SetFloatParameter('Path1',1.0);
PSC.SetFloatParameter('Path2',1.0);
PSC.SetFloatParameter('Path3',1.0);
}
}
else
{
PSC.SetFloatParameter('Path1',0.0);
PSC.SetFloatParameter('Path2',0.0);
PSC.SetFloatParameter('Path3',0.0);
}
}
simulated function PlayFireEffects( byte FireModeNum, optional vector HitLocation )
{
if (FireModeNum>1)
{
Super.PlayFireEffects(0,HitLocation);
}
else
{
Super.PlayFireEffects(FireModeNum, HitLocation);
}
}
defaultproperties
{
// Weapon SkeletalMesh
Begin Object class=AnimNodeSequence Name=MeshSequenceA
End Object
// Weapon SkeletalMesh
Begin Object Name=FirstPersonMesh
SkeletalMesh=SkeletalMesh'WP_ShockRifle.Mesh.SK_WP_ShockRifle_1P'
AnimSets(0)=AnimSet'WP_ShockRifle.Anim.K_WP_ShockRifle_1P_Base'
Animations=MeshSequenceA
Rotation=(Yaw=-16384)
FOV=60.0
End Object
AttachmentClass=class'UTGameContent.UTAttachment_ShockRifle'
Begin Object Name=PickupMesh
SkeletalMesh=SkeletalMesh'WP_ShockRifle.Mesh.SK_WP_ShockRifle_3P'
End Object
WeaponFireTypes(0)=EWFT_Projectile
WeaponProjectiles(0)=class'UTProj_PoisonDart'
FireInterval(0)=+0.77
InstantHitDamageTypes(0)=None
WeaponFireSnd[0]=SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_FireCue'
WeaponEquipSnd=SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_RaiseCue'
WeaponPutDownSnd=SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_LowerCue'
PickupSound=SoundCue'A_Pickups.Weapons.Cue.A_Pickup_Weapons_Shock_Cue'
MaxDesireability=0.65
AIRating=0.65
CurrentRating=0.65
bInstantHit=true
bSplashJump=false
bRecommendSplashDamage=false
bSniping=true
ShouldFireOnRelease(0)=1
ShotCost(0)=1
FireOffset=(X=20,Y=5)
PlayerViewOffset=(X=17,Y=10.0,Z=-8.0)
AmmoCount=50
LockerAmmoCount=20
MaxAmmoCount=100
FireCameraAnim(0)=CameraAnim'Camera_FX.ShockRifle.C_WP_ShockRifle_Alt_Fire_Shake'
WeaponFireAnim(0)=WeaponAltFire
MuzzleFlashSocket=MF
MuzzleFlashPSCTemplate=WP_ShockRifle.Particles.P_ShockRifle_MF_Alt
MuzzleFlashAltPSCTemplate=WP_ShockRifle.Particles.P_ShockRifle_MF_Alt
MuzzleFlashColor=(R=200,G=120,B=255,A=255)
MuzzleFlashDuration=0.33
MuzzleFlashLightClass=class'UTGame.UTShockMuzzleFlashLight'
CrossHairCoordinates=(U=256,V=0,UL=64,VL=64)
LockerRotation=(Pitch=32768,Roll=16384)
IconCoordinates=(U=728,V=382,UL=162,VL=45)
WeaponColor=(R=160,G=0,B=255,A=255)
InventoryGroup=4
GroupWeight=0.5
IconX=400
IconY=129
IconWidth=22
IconHeight=48
Begin Object Class=ForceFeedbackWaveform Name=ForceFeedbackWaveformShooting1
Samples(0)=(LeftAmplitude=90,RightAmplitude=40,LeftFunction=WF_Constant,RightFunction=WF_LinearDecreasing,Duration=0.1200)
End Object
WeaponFireWaveForm=ForceFeedbackWaveformShooting1
}
Code:
class UTAttachment_PoisonDartGun extends UTWeaponAttachment;
var ParticleSystem BeamTemplate;
var class<UDKExplosionLight> ImpactLightClass;
var int CurrentPath;
simulated function SpawnBeam(vector Start, vector End, bool bFirstPerson)
{
local ParticleSystemComponent E;
local actor HitActor;
local vector HitNormal, HitLocation;
if ( End == Vect(0,0,0) )
{
if ( !bFirstPerson || (Instigator.Controller == None) )
{
return;
}
// guess using current viewrotation;
End = Start + vector(Instigator.Controller.Rotation) * class'UTWeap_PoisonDartGun'.default.WeaponRange;
HitActor = Instigator.Trace(HitLocation, HitNormal, End, Start, TRUE, vect(0,0,0),, TRACEFLAG_Bullet);
if ( HitActor != None )
{
End = HitLocation;
}
}
E = WorldInfo.MyEmitterPool.SpawnEmitter(BeamTemplate, Start);
E.SetVectorParameter('ShockBeamEnd', End);
if (bFirstPerson && !class'Engine'.static.IsSplitScreen())
{
E.SetDepthPriorityGroup(SDPG_Foreground);
}
else
{
E.SetDepthPriorityGroup(SDPG_World);
}
}
simulated function FirstPersonFireEffects(Weapon PawnWeapon, vector HitLocation)
{
local vector EffectLocation;
Super.FirstPersonFireEffects(PawnWeapon, HitLocation);
if (Instigator.FiringMode == 0 || Instigator.FiringMode == 3)
{
EffectLocation = UTWeapon(PawnWeapon).GetEffectLocation();
SpawnBeam(EffectLocation, HitLocation, true);
if (!WorldInfo.bDropDetail && Instigator.Controller != None)
{
UDKEmitterPool(WorldInfo.MyEmitterPool).SpawnExplosionLight(ImpactLightClass, HitLocation);
}
}
}
simulated function ThirdPersonFireEffects(vector HitLocation)
{
Super.ThirdPersonFireEffects(HitLocation);
if ((Instigator.FiringMode == 0 || Instigator.FiringMode == 3))
{
SpawnBeam(GetEffectLocation(), HitLocation, false);
}
}
simulated function bool AllowImpactEffects(Actor HitActor, vector HitLocation, vector HitNormal)
{
return (HitActor != None && UTProj_ShockBall(HitActor) == None && Super.AllowImpactEffects(HitActor, HitLocation, HitNormal));
}
simulated function SetMuzzleFlashParams(ParticleSystemComponent PSC)
{
local float PathValues[3];
local int NewPath;
Super.SetMuzzleFlashparams(PSC);
if (Instigator.FiringMode == 0)
{
NewPath = Rand(3);
if (NewPath == CurrentPath)
{
NewPath++;
}
CurrentPath = NewPath % 3;
PathValues[CurrentPath % 3] = 1.0;
PSC.SetFloatParameter('Path1',PathValues[0]);
PSC.SetFloatParameter('Path2',PathValues[1]);
PSC.SetFloatParameter('Path3',PathValues[2]);
// CurrentPath++;
}
else if (Instigator.FiringMode == 3)
{
PSC.SetFloatParameter('Path1',1.0);
PSC.SetFloatParameter('Path2',1.0);
PSC.SetFloatParameter('Path3',1.0);
}
else
{
PSC.SetFloatParameter('Path1',0.0);
PSC.SetFloatParameter('Path2',0.0);
PSC.SetFloatParameter('Path3',0.0);
}
}
defaultproperties
{
// Weapon SkeletalMesh
Begin Object Name=SkeletalMeshComponent0
SkeletalMesh=SkeletalMesh'WP_ShockRifle.Mesh.SK_WP_ShockRifle_3P'
End Object
DefaultImpactEffect=(ParticleTemplate=ParticleSystem'WP_ShockRifle.Particles.P_WP_ShockRifle_Beam_Impact', Sound=SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_AltFireImpactCue')
ImpactEffects(0)=(MaterialType=Water, ParticleTemplate=ParticleSystem'WP_LinkGun.Effects.P_WP_Linkgun_Beam_Impact_HIT', Sound=SoundCue'A_Weapon_Link.Cue.A_Weapon_Link_FireCue')
BulletWhip=SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_WhipCue'
MuzzleFlashSocket=MuzzleFlashSocket
// MuzzleFlashPSCTemplate=WP_ShockRifle.Particles.P_ShockRifle_MF_Primary
MuzzleFlashPSCTemplate=WP_ShockRifle.Particles.P_ShockRifle_3P_MF
MuzzleFlashAltPSCTemplate=WP_ShockRifle.Particles.P_ShockRifle_3P_MF
MuzzleFlashColor=(R=255,G=120,B=255,A=255)
MuzzleFlashDuration=0.33;
MuzzleFlashLightClass=class'UTGame.UTShockMuzzleFlashLight'
BeamTemplate=particlesystem'WP_ShockRifle.Particles.P_WP_ShockRifle_Beam'
WeaponClass=class'UTWeap_PoisonDartGun'
ImpactLightClass=class'UTShockImpactLight'
}