Originally posted by tegleg
View Post

/** * Created using Unreal Script Wizard by RyanJon2040 * Visit: www.dynamiceffects.net * Meet me on Facebook: www.facebook.com/satheeshpv */ class PlasmaRifleV3 extends UTWeapon; var int ClipCount; var int clips; var int MaxClips; //Maximum number of clips supported by this weapon var bool bIsReloading; //Boolean to check if the weapon is reloading var float ReloadTime; //Reload Time var (Animations) name WeaponReload; //Animation sequence name to play when weapon is reloading var(FirstPerson) vector IronSightViewOffset; var(FirstPerson) vector IronSightViewOffset1; var bool bHasIronSights; var bool bUsingIronSights; var bool bExitISAfterShots; simulated function WeaponEmpty() { //If the clips is greater than 0 and the weapon is not reloading then... if(clips > 0 && !bIsReloading) { bIsReloading = true; //Set bIsReloading to true PlayReloadAnim(); //Call reload animation function SetTimer(ReloadTime, false, 'Reload'); //Set Timer for the reload animation return; //Exit this function } super.WeaponEmpty(); } simulated function PlayReloadAnim() { PlayWeaponAnimation(WeaponReload, ReloadTime); } //The function that we will call in MyInventoryManager.uc file simulated function AddClip(int clip) { //If clips is lesser than Maxclips then... if(clips < Maxclips) { clips = clips + clip; //Add a clip ClearTimer(); } else { return; } } simulated function int IncreaseAmmo( int Amount ) { AmmoCount = Clamp(AmmoCount + Amount,0,49); return AmmoCount; } //The function that will reload this weapon simulated function Reload() { bIsReloading = false; //Set bIsReloading to false clips = clips - 1; //Reduce 1 clip IncreaseAmmo(49); //Add the amount of ammo you want in your weapon ClearTimer(); } simulated function StartFire(byte FireModeNum) { local PlayerController plr; plr = PlayerController(Instigator.Controller); if(plr == none || bIsReloading) //You can't shoot while reloading return; super.StartFire(FireModeNum); } simulated function ExitIronSights() { PlayerViewOffset.Y = default.PlayerViewOffset.Y; PlayerViewOffset.Z = default.PlayerViewOffset.Z; PlayerViewOffset.X = default.PlayerViewOffset.X; bUsingIronSights = False; WeaponIdleAnims[0] = 'WeaponIdle'; BobDamping = default.BobDamping; UTPawn(Owner).GroundSpeed = UTPawn(Owner).default.GroundSpeed; } simulated function EnterIronSights1() { WeaponIdleAnims[0] = 'WeaponIronSight_Idle'; bUsingIronSights = True; PlayerViewOffset.Y = IronSightViewOffset1.Y; PlayerViewOffset.Z = IronSightViewOffset1.Z; PlayerViewOffset.X = IronSightViewOffset1.X; UTPawn(Owner).GroundSpeed = UTPawn(Owner).default.GroundSpeed; UTPawn(Owner).GroundSpeed *= 0.5; BobDamping = 0.8; } simulated function PutDownWeapon() { if (bIsReloading || bUsingIronSights) { return; } else { GotoState('WeaponPuttingDown'); } } simulated function bool ShouldLagRot() { if (!bUsingIronsights) { return true; } return false; } defaultproperties { //bIsReloading = false clips = 3 //The number of clips that the player will have MaxClips = 8 //Maximum number of magazines that this weapon supports Begin Object class=AnimNodeSequence Name=MeshSequenceA bCauseActorAnimEnd=true End Object Begin Object Name=FirstPersonMesh SkeletalMesh=SkeletalMesh'WP_PlasmaRifle.skelmeshes.PlasmaRifle' FOV=70 Animations=MeshSequenceA AnimSets(0)=AnimSet'WP_PlasmaRifle.skelmeshes.PlasmaRifle_Anims' bForceUpdateAttachmentsInTick=True Scale=0.900000 End Object WeaponReload =WeaponReload ReloadTime=2.5 MaxAmmoCount=49 //IT IS VERY IMPORTANT TO SET THIS VALUE GREATER THAN AmmoCount AmmoCount=45 Mesh=FirstPersonMesh //Other Misc Codes Begin Object Name=PickupMesh SkeletalMesh=SkeletalMesh'WP_PlasmaRifle.skelmeshes.PlasmaRifle' Scale=1.6 End Object WeaponEquipSnd=SoundCue'GshipV2.musicbitz.PlasmaRifleFirePikupC' WeaponPutDownSnd=SoundCue'GshipV2.musicbitz.PlasmaRiflePutD' WeaponFireSnd(0)=SoundCue'GshipV2.musicbitz.PlasmaRifleFireC' WeaponFireSnd(1)=SoundCue'A_Weapon_RocketLauncher.Cue.A_Weapon_RL_GrenadeFire_Cue' PickupSound=SoundCue'A_Pickups.Weapons.Cue.A_Pickup_Weapons_Shock_Cue' PivotTranslation=(Y=0.0) MuzzleFlashPSCTemplate=ParticleSystem'GshipV2.Particles.P_FX_Prifle_Primary_MF' MuzzleFlashLightClass=Class'UTLinkGunMuzzleFlashLight' InventoryGroup=5 bInstantHit=True InstantHitDamage(0)=22 InstantHitDamage(1)=0 InstantHitMomentum(0)=22 InstantHitMomentum(1)=0 InstantHitDamageTypes(0)=Class'PlasmaRifleV3_Damage' InstantHitDamageTypes(1)=none WeaponFireTypes(1)=EWFT_None IronSightViewOffset1=(X=-5.5,Y=-8,Z=0.7) PlayerViewOffset=(X=0.300000,Y=0.00000,Z=0.000000) CrosshairImage=none CrossHairCoordinates=(U=384,V=0,UL=64,VL=64) FireInterval(0)=0.1 FireInterval(1)=1 //<DO NOT MODIFY> ArmsAnimSet=AnimSet'WP_PlasmaRifle.skelmeshes.PlasmaRifle_Anims' DroppedPickupMesh=PickupMesh PickupFactoryMesh=PickupMesh AttachmentClass=Class'PlasmaRifleV3_Attach' //bReloadable=True bHasIronSights=True
if (FireModeNum == 1 && bHasIronSights && PlayerViewOffset.Y >= default.PlayerViewOffset.Y) { EnterIronSights1(); } simulated function EndFire( Byte FireModeNum ) { if (FireModeNum == 1 && bUsingIronSights || (bReloadable && ClipCount == 0 && bUsingIronSights)) { ExitIronSights(); } Super.EndFire(FireModeNum); }
Comment