Announcement

Collapse
No announcement yet.

Super simple shotgun!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Sorry for digging up such an old thread, btw.

    Leave a comment:


  • replied
    I get errors when I try to switch the mesh to the Rocket Launcher one. What might I be doing wrong?

    Leave a comment:


  • replied
    I'm having a problem with the instantfire projectiles not showing up as well. In my case, however, the FireEffects do not appear to show up at all for the InstantFire mode. Here is my source code:

    Code:
    class AutoShotgun extends Base_Shotgun;
    
    defaultproperties
    {
            /* WEAPON FIRE PROPERTIES! */
    	ShotCost(0)=0 // keep these for testing purpose!
    	ShotCost(1)=0
    	MaxAmmoCount=1
    	
    	/* CUSTOM CHECKS FOR SHOTGUN! */
    	bIsShotGun=true
            Shells=8 // We want 8 shells!
            
            /* WEAPON FIRING MODES! */
    	FiringStatesArray(0)=WeaponFiring
    	FiringStatesArray(1)=WeaponFiring
    	WeaponFireTypes(0)=EWFT_Projectile // First fire mode is a projectile
    	WeaponFireTypes(1)=EWFT_InstantHit // second is a instanthit!
    
    	WeaponProjectiles(0)=class'UTProj_AutoShotgun' // Same as UTProjMantaBolt, but with modified Damage and Scaling Settings
    	FireInterval(0)=+0.3 // Fire speed!
    	Spread(0)=0.2 // the spread of the bullets!
    	Spread(1)=0.2
    	InstantHitDamage(1)=25
    	InstantHitDamageTypes(1)=class'UTDmgType_ShockPrimary'
    
    	// Weapon SkeletalMesh
    	Begin Object class=AnimNodeSequence Name=MeshSequenceA
    	End Object
            AttachmentClass=class'UTAttachment_ShockRifle'
    
    	// 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'
    		AnimSets(1)=AnimSet'WP_ShockRifle.Anim.K_WP_ShockRifle_1P_Base'
    		Animations=MeshSequenceA
    		Rotation=(Yaw=-16384)
    		FOV=60.0
    	End Object
    
    	Begin Object Name=PickupMesh
    		SkeletalMesh=SkeletalMesh'WP_ShockRifle.Mesh.SK_WP_ShockRifle_3P' // either keep this or change to your 3rd person mesh.
    	End Object
    
    	FireOffset=(X=17,Y=0)
    	PlayerViewOffset=(X=14,Y=0,Z=-10.0) // Correction for Shockrifle
    And here is the Base_Shotgun Class:
    Code:
    Class Base_Shotgun extends UTWeapon;
    
    var bool bIsShotGun;
    var int Shells; // Amount of bullets to be shot!
    
    simulated function Projectile ProjectileFire()
    {
                 local int s;
    
     if (bIsShotGun == true)
     {
                for(s=0; s < Shells; s++)
                {
                    super.ProjectileFire(); //Here I changed it to keep looping instead of returning
                }
            }
            else 
            {
               return super.ProjectileFire();
            }
            return None;
    }
    Any help would be very greatly appreciated!

    Leave a comment:


  • replied
    Yes, true. I believe it's a mistake in my code!
    I will check it out!

    Leave a comment:


  • replied
    Actually, I think I fixed it. I changed the ProjectileFire() function so that in the for loop, it doesn't return and just calls super.ProjectileFire(), and instead of returning "projectile" at the end of the function, it returns "none". It seems to work now, which is good...

    Code:
    simulated function Projectile ProjectileFire()
    {
                 local int s;
    
     if(bIsShotGun == true && CurrentFireMode==0)
     {
                for(s=0; s < Shells; s++)
                {
                    super.ProjectileFire(); //Here I changed it to keep looping instead of returning
                }
            }
            else 
            {
               return super.ProjectileFire();
            }
            return None;
    }

    Leave a comment:


  • replied
    Originally posted by galerian View Post
    Thanks for the code. The only problem when using the instant hit shotgun is the fire effects (decal/bullet trace) can only be seen fully by the server, while clients can only see effect from one instantfire.
    Hmm... It could be a problem with instanthit replication...
    Could you post the error log and/or script you use? I could take a look at it and see if it's in the actual weapon code =)

    Leave a comment:


  • replied
    Originally posted by SolaceEternal View Post
    I'm actually having a bit of difficulty getting this to work right, though I suspect that's because of how I've got my own game set up, as it's using udk code and not ut. For example, having it return projectile actually won't compile, and there's no actual spread shot; it just shoots one rocket at a time and the accuracy of which varies slightly per shot. Also, altfire does nothing at all, and I'm getting a tremendous amount of logspam.

    But! I now have a working weapon I can build from, and more importantly, you have introduced me to the concept of a rocket shotgun, which is a rediculously fantastic idea. So you get a bump and my gratitude.

    Glad I could be of help!
    I believe the problem is because you're deriving from UDK and not UT as most functions used here are from UT classes. However if you post the error log & your code I am more than willing to see if I can help =)

    Leave a comment:


  • replied
    I am having the same problem as SolaceEternal...

    Leave a comment:


  • replied
    I'm actually having a bit of difficulty getting this to work right, though I suspect that's because of how I've got my own game set up, as it's using udk code and not ut. For example, having it return projectile actually won't compile, and there's no actual spread shot; it just shoots one rocket at a time and the accuracy of which varies slightly per shot. Also, altfire does nothing at all, and I'm getting a tremendous amount of logspam.

    But! I now have a working weapon I can build from, and more importantly, you have introduced me to the concept of a rocket shotgun, which is a rediculously fantastic idea. So you get a bump and my gratitude.

    Leave a comment:


  • replied
    I'm actually having a bit of difficulty getting this to work right, though I suspect that's because of how I've got my own game set up, as it's using udk code and not ut. For example, having it return projectile actually won't compile, and there's no actual spread shot; it just shoots one rocket at a time and the accuracy of which varies slightly per shot. Also, altfire does nothing at all.

    But! I now have a working weapon I can build from, and more importantly, you have introduced me to the concept of a rocket shotgun, which is a rediculously fantastic idea. So you get a bump and my gratitude.

    Leave a comment:


  • replied
    Thanks for the code. The only problem when using the instant hit shotgun is the fire effects (decal/bullet trace) can only be seen fully by the server, while clients can only see effect from one instantfire.

    Leave a comment:


  • replied
    ...never mind...

    Leave a comment:


  • replied
    VendorX,
    What you just linked is the secondary fire of the flak gun, which is a projectile that on impact explodes and spawns smaller projectile around the explosion. I am only doing the spawn part of it, and I am doing it only straight forward. =D

    Leave a comment:


  • replied
    Originally posted by ValleW View Post
    This is how the flakgun in UT3 does it...
    You're sure..?
    Code:
    // In UTWeap_FlakCannon...
    simulated function Projectile ProjectileFire()
    {
    	local vector		RealStartLoc;
    	local UTProj_FlakShell	SpawnedProjectile;
    
    	// tell remote clients that we fired, to trigger effects
    	IncrementFlashCount();
    
    	if( Role == ROLE_Authority )
    	{
    		// this is the location where the projectile is spawned.
    		RealStartLoc = GetPhysicalFireStartLoc();
    
    		// Spawn projectile
    		SpawnedProjectile = Spawn(class'UTProj_FlakShell',,, RealStartLoc);
    		if( SpawnedProjectile != None && !SpawnedProjectile.bDeleteMe )
    		{
    			SpawnedProjectile.Init( Vector(GetAdjustedAim( RealStartLoc )) );
    		}
    
    		// Return it up the line
    		return SpawnedProjectile;
    	}
    
    	return None;
    }
    
    // In UTProj_FlakShell...
    simulated function Explode(vector HitLocation, vector HitNormal)
    {
    	local vector SpawnPos, BaseChunkDir;
    	local actor HitActor;
    	local rotator rot;
    	local int i;
    	local UTProj_FlakShard NewChunk;
    
    	Super.Explode(HitLocation, HitNormal);
    
    	SpawnPos = Location + 10 * HitNormal;
    
    	HitActor = Trace(HitLocation, HitNormal, SpawnPos, Location, false);
    	if (HitActor != None)
    	{
    		SpawnPos = HitLocation;
    	}
    
    	if ( (Role == ROLE_Authority) && (UTVehicle(ImpactedActor) == None) )
    	{
    		BaseChunkDir = Normal(HitNormal + 0.8 * Normal(Velocity));
    		for (i = 0; i < 5; i++)
    		{
    			rot = rotator(4*BaseChunkDir + VRand());
    			NewChunk = Spawn(class 'UTProj_FlakShard',, '', SpawnPos, rot);
    			if (NewChunk != None)
    			{
    				NewChunk.bCheckShortRangeKill = false;
    				NewChunk.Init(vector(rot));
    			}
    		}
    	}
    }
    ...this is the best way.

    Leave a comment:


  • replied
    if(bIsShotGun == true) // Make the function check if our weapon actually is a shotgun.
    {
    // This is wrong approach - look in to UT3 how to do that right...
    for(s=0; s < Shells; s++) // Spawn the wanted amount of projectiles.
    {
    super.ProjectileFire();
    }
    }
    This is how the flakgun in UT3 does it, if there is another (better) approach feel free to post it. =)

    Leave a comment:

Working...
X