UTX wrote:Because you made it so it will collide with projectiles.
This should work better, remember to replace "QWERY" with the projectile class you're making.
Oh! I see. Thank you for clarifying this. It didn't seem that obvious. Sometimes the scripts for UT can be a bit complicated to the point it's confusing. I miss took what it said.
Edit:It seems they don't collide anymore but they still explode.((Edit3: I don't even know if they aren't colliding...I'm not sure what's making them explode. The code should make it impossible to hit the instigator.)) Meaning it's hitting me (the gun user) Unless it's something else? Also I can't seem to get my projectiles to spread like the UT_Chunk's. The random direction code is there so I'm not sure if it's placement or just something I'm doing wrong.(I think I might know what's up...I pointed it out in the code. Tell me if I'm wrong)
Edit2:I'm wrong....
Code: Select all
//=============================================================================
// SuperShock4.
//=============================================================================
class SuperShock4 expands ShockProj;
var int NumWallHits;
var bool bCanHitInstigator, bHitWater;
simulated function PostBeginPlay()
{
local rotator RandRot;
if ( Level.NetMode != NM_DedicatedServer )
{
if ( !Region.Zone.bWaterZone )
SetTimer(0.1, true);
}
if ( Role == ROLE_Authority )
{
RandRot = Rotation;
RandRot.Pitch += FRand() * 2000 - 1000;
RandRot.Yaw += FRand() * 2000 - 1000;
RandRot.Roll += FRand() * 2000 - 1000;
Velocity = Vector(RandRot) * (Speed + (FRand() * 200 - 100));
if (Region.zone.bWaterZone)
Velocity *= 0.65;
}
Super.PostBeginPlay();
}
/////////////////////////////////////////////////////
auto state flying
{
simulated function HitWall (vector HitNormal, actor Wall)
{
local vector Vel2D, Norm2D;
bCanHitInstigator = true;
PlaySound(ImpactSound, SLOT_Misc, 2.0);
LoopAnim('Spin',1.0);
if ( (Mover(Wall) != None) && Mover(Wall).bDamageTriggered )
{
if ( Role == ROLE_Authority )
Wall.TakeDamage( Damage, instigator, Location, MomentumTransfer * Normal(Velocity), MyDamageType);
Destroy();
return;
}
NumWallHits++;
SetTimer(0, False);
MakeNoise(0.3);
if ( NumWallHits > 15 )
Destroy();
if ( NumWallHits == 1 )
{
Spawn(class'WallCrack',,,Location, rotator(HitNormal));
Vel2D = Velocity;
Vel2D.Z = 0;
Norm2D = HitNormal;
Norm2D.Z = 0;
Norm2D = Normal(Norm2D);
Vel2D = Normal(Vel2D);
if ( (Vel2D Dot Norm2D) < -0.999 )
{
HitNormal = Normal(HitNormal + 0.6 * Vel2D);
Norm2D = HitNormal;
Norm2D.Z = 0;
Norm2D = Normal(Norm2D);
if ( (Vel2D Dot Norm2D) < -0.999 )
{
if ( Rand(1) == 0 )
HitNormal = HitNormal + vect(0.05,0,0);
else
HitNormal = HitNormal - vect(0.05,0,0);
if ( Rand(1) == 0 )
HitNormal = HitNormal + vect(0,0.05,0);
else
HitNormal = HitNormal - vect(0,0.05,0);
HitNormal = Normal(HitNormal);
}
}
}
Velocity -= 2 * (Velocity dot HitNormal) * HitNormal;
}
function SetUp() //<<<This is causeing the random rotation to not work. ? will test anyway. Thought I'd post before I recompile for the 80th time...this is fun
{
local vector X;
X = vector(Rotation);
Velocity = Speed * X; // Impart ONLY forward vel
if (Instigator.HeadRegion.Zone.bWaterZone)
bHitWater = True;
}
function ProcessTouch (Actor Other, vector HitLocation)
{
If ( (Other!=Instigator) && (!Other.IsA('Projectile') || (Other.CollisionRadius > 0)) && Other.Class != Class 'SuperShock4')
Explode(HitLocation,Normal(HitLocation-Other.Location));;
}
function BeginState()
{
Velocity = vector(Rotation) * speed;
}
}
defaultproperties
{
speed=2800.000000
MaxSpeed=200000.000000
bBounce=True
}
EDIT70:ok. I'm an idiot. I placed the "chunks" in the wrong part of the flack code.
They do not collide or explode anymore. Now I need to figure how how to get them to spread like the flack chunks themselves.
I'll continue to investigate. But if someone knows the answer please let me know. (I would like to avoid making a whole new topic for something as small as this when It's sorta related to my custom weapon in this thread. Let me know if I'm wrong there.) Thanks all!
Edit5: So I did a little snooping on the codes and I noticed something the chunks don't have that the shockproj does. An auto state "flying"
This leads me to believe that this state is what's keeping the projectiles from actually flying in a scatter pattern until they are in physics falling. I'll quickly check to make sure this is the case. (Looks as though it was indeed the reason! Nice. A fun experience.