Could be asleep, typing random messages instead.

Projectile Code Explosion Radius

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

User avatar Jet v4.3.5
Skaarj Elder Skaarj Elder
Posts: 1247
Joined: 24 Dec 2007, 17:40
Contact:

Subject: Projectile Code Explosion Radius

Post Posted: 05 Mar 2010, 22:48

I want to know how to take this terrible code and make it good, and I want to know generally how you did it. The damage radius is what I'm worried about on the whole, as it uses the default brute projectile radius, but I want that about trippled. The first bit was copied from flakproj to make it compatible with falling, as it sticks to the floor for a certain amount of time and then explodes when I wanted it to explode on any surface immediately. The second was meant to change the radius but it didn't work. Noob at scripting warning, BTW.

The code:

Code: Select all

//=============================================================================
// BoomBallofdeath.
//=============================================================================
class BoomBallofdeath expands BruteProjectile;

simulated function Landed( vector HitNormal )
{
   local DirectionalBlast D;

   if ( EffectIsRelevant(Location) )
   {
      D = Spawn(class'DirectionalBlast',self);
      if ( D != None )
         D.DirectionalAttach(vector(rotation), HitNormal);
   }
   Explode(Location,HitNormal);
}

function Explode(vector HitLocation, vector HitNormal)
{
   HurtRadiusProj(Damage,300.0, 'exploded', MomentumTransfer, HitLocation );
   Spawn(class'SpriteBallExplosion',,,HitLocation);
   Destroy();
}
Image
ModDb Portfolio
"Bear," she cried. "I love you. Pull my head off."

User avatar UArchitect
Skaarj Lord Skaarj Lord
Posts: 182
Joined: 18 Nov 2007, 21:22

Subject:

Post Posted: 06 Mar 2010, 00:33

your problem here is that you define explode outside of state flying, so when exploded is called by the projectiles its going to be calling the local explode inside state flying and not your global explode outside

Code: Select all


auto state Flying
{
   simulated function Landed( vector HitNormal )
   {
      local DirectionalBlast D;

      if ( EffectIsRelevant(Location) )
      {
         D = Spawn(class'DirectionalBlast',self);
         if ( D != None )
            D.DirectionalAttach(vector(rotation), HitNormal);
      }
      Explode(Location,HitNormal);
   }

   function BlowUp(vector HitLocation)
   {
      HurtRadius(damage, 300, 'exploded', MomentumTransfer, HitLocation);
      MakeNoise(1.0);
      PlaySound(ImpactSound);
   }
}


questions you might ask about this code:

q) why havent i defined exploded?
a) its already defined in bruteprojectile and we dont do anything different, so no point redefining it

q) why dont you have destroy() or spawn(class'spriteballexplosion') ?
a) already defined in bruteprojectile.exploded

User avatar Jet v4.3.5
Skaarj Elder Skaarj Elder
Posts: 1247
Joined: 24 Dec 2007, 17:40
Contact:

Subject:

Post Posted: 06 Mar 2010, 01:02

Thanks, that worked perfectly. I'm basically trying to make simple things to learn basic scripting stuff like what you had there. Thanks for your explanation to.
Image
ModDb Portfolio
"Bear," she cried. "I love you. Pull my head off."


Who is online

Users browsing this forum: No registered users and 36 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited