Welcome Guest ( Login | Register )


All times are UTC - 5 hours



Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Sep 03, 2003 5:29 am   Post subject: Shockwave trials

Joined: Mar 05, 2003
Posts: 356
Does anyone know how to make shockwave trails like the bullets from
the matrix??. I want to add this effect to my rifle Ive seen something simalr in Lt mech mod i beleive. He had a gun that made huge shockwaves trails around the missile when u fired it. i must say it looked cool As Hell. :twisted:


Top
 Profile  
 
PostPosted: Wed Sep 03, 2003 11:06 am
User avatar

Joined: Jan 05, 2003
Posts: 216
Location: BEHIND YOU
Umm... wild guess...
Spawn a short-lived projectile every few moments that has a shockwave!

_________________
i don''t know why i posted that.


Top
 Profile  
 
PostPosted: Wed Sep 03, 2003 12:44 pm
AVM Founder
User avatar
 

Joined: Nov 09, 2002
Posts: 3759
Location: Milford, MA
Yep, that's how you do it really. If you have the latest function library, there IS one in there. Idk how much different they can really be. But here's one:

function ShockwaveFunction(%obj,%proj)
{
   if(isobject(%proj))
   {
      %fake = new (linearprojectile)()
      {
      dataBlock        = "YourShortLifeProjectile";
      initialDirection = %proj.MuzVec;
      initialPosition  = %proj.position;
      sourceSlot       = %obj;
      };
      %fake.sourceobject = %obj;
      MissionCleanup.add(%fake);

      %proj.ShockwaveSchedule = schedule( 80,0, "ShockwaveFunction" ,%obj,%Proj);
   }
}


//This just an exampler onFire but you need the vars the same and the 2 lines of code
function YourWeaponImage::onFire(%data,%obj,%slot)
{
    //Blah blah
    // Code up here (maybe)
   
   %proj.MuzVec = %obj.getMuzzleVector(%slot);
   schedule( 100,0, "ShockwaveFunction" ,%obj,%Proj);
}

function YourProjectile::onExplode(%data, %proj, %pos, %mod)
{
parent::onexplode(%data, %proj, %pos, %mod);
cancel(%proj.ShockwaveSchedule);

}


You will still need to make a projectile (linear in this case) and make a shockwave for it (make it's explosion JUST a shockwave, so you don't see the whole... ya konw... explosion ;) )

And there ya go. Just make sure to replace all the YourWeaponImage, and YourProjectile. or w/e in the code

_________________
"Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live."


Top
 Profile WWW  
 
PostPosted: Thu Sep 04, 2003 3:01 am

Joined: Mar 05, 2003
Posts: 356
Alright i tried adding this to charles m1 garand rifle. tested it but no dice so far take a look maybe u can point out my fault.
//--------------------------------------
// M1 Garand (USA)
//Caliber: .30-06 (7.62x63 mm)
//Action: Gas operated, rotating bolt
//Overall length: 1103 mm
//Barrel length: 610 mm
//Weight: 4.32 kg
//Feeding: non-detachable, clip-fed only magazine, 8 rounds
//The story of the first semi-automatic rifle ever widely-adopted as standard military arm began after the start of the First World War, when American inventor John C. Garand began to develop a semi-automatic (or self-loading) rifles. He worked at the government-owned Springfield armory and during the
//1920s and early 1930 developed a number of design. Early rifles were built using somewhat rare system of the cartridge primer blowback, but due to some reasons this system was unsuitable for a military rifle, so he switched to the more common gas-operated system. He filed a patent for his semiautomatic, gas operated, clip-fed rifle in 1930, and received an US patent for his design late in 1932.
//This rifle was built around then-experimental .276 caliber (7mm) cartridge. At the same time, his rifle was tested by the US Military against its main competitor, a .276 caliber Pedersen rifle, and was eventually recommended for adoption by US Army early in the 1932. But a little bit later an US general MacArthur stated that the US Military should stick to the old .30-06 cartridge. Foreseeing that,
//Garand already had a variation of his design chambered for 30-06. Finally, at the 6th January, 1936, the Garands' rifle was adopted by the US Army as an "rifle, .30 caliber, M1". Early issue rifles, however,
//showed a quite poor characteristics, jamming way too often for a decent military arm, so a lot of noise was raised that eventually reached the US Congress. In the 1939, the major redesign was ordered, and Garand quickly redesigned a gas port system, which greatly improved the reliability. */
//--------------------------------------

datablock ShockwaveData(GarandRifleShockwave)
{
   width = 5.0;
   numSegments = 20;
   numVertSegments = 2;
   velocity = 5;
   acceleration = 10.0;
   lifetimeMS = 1000;
   height = 1.0;
   is2D = true;

   texture[0] = "special/shockwave4";
   texture[1] = "special/gradient";
   texWrap = 6.0;

   times[0] = 0.0;
   times[1] = 0.5;
   times[2] = 1.0;

   colors[0] = "0.8 0.8 1.0 1.00";
   colors[1] = "0.8 0.5 1.0 0.20";
   colors[2] = "0.2 0.8 1.0 0.0";
};

datablock ExplosionData(GarandRifleExplosion)
{
   explosionShape = "energy_explosion.dts";
   soundProfile   = sniperExpSound;

   particleEmitter = GarandRifleShockwave;
   particleDensity = 150;
   particleRadius = 0.25;

   faceViewer           = false;
};


//--------------------------------------
//Mounts
//--------------------------------------

//Scope
//datablock ShapeBaseImageData(ScopeImage) : SniperScopeImage
//{
//shapeFile = "turret_belly_barrell.dts";
//offset = "0 0.45 0.25";
//rotation = "1 0 0 180";
//};

//Scope
datablock ShapeBaseImageData(ScopeImage)
{
shapeFile = "turret_belly_barrell.dts";
offset = "0 0.45 0.25";
rotation = "1 0 0 180";
};


//--------------------------------------------------------------------------
// Ammo
//--------------------------------------

datablock ItemData(GarandRifleAmmo) // changed from GarandAmmo
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some Garand ammo";

computeCRC = true;

};

//---------------------

datablock LinearProjectileData(Matrix)
{
   projectileShapeName = "weapon_missile_projectile.dts";
   scale               = "1 1 1";
   directDamage        = 0.8;
   hasDamageRadius     = true;
   indirectDamage      = 0;
   damageRadius        = 30;
   radiusDamageType    = $DamageType::Garand;
   kickBackStrength    = 3000;

   //sound             = discProjectileSound;
   explosion           = "GarandRifleExplosion";
   //underwaterExplosion = "UnderwaterMortarExplosion";
   //splash              = DiscSplash;

   //baseEmitter         = ClusterMissileCaseEmitter;

   dryVelocity       = 40;
   wetVelocity       = 10;
   velInheritFactor  = 0.2;
   fizzleTimeMS      = 2500;
   lifetimeMS        = 2500;
   explodeOnDeath    = true;
   reflectOnWaterImpactAngle = 0;
   explodeOnWaterImpact      = false;
   deflectionOnWaterImpact   = 0.0;
   fizzleUnderwaterMS        = 2500;

   hasLight    = true;
   lightRadius = 6.0;
   lightColor  = "0.175 0.175 0.5";
};

//--------------------------------------------------------------------------
// Projectile
//--------------------------------------


datablock TracerProjectileData(GarandBullet)
{
doDynamicClientHits = true;

directDamage = 0.6; // z0dd - ZOD, 9-27-02. Was 0.0825
directDamageType = $DamageType::Garand;
explosion = "ChaingunExsplosion";
splash = ChaingunSplash;
rifleHeadMultiplier = 15.0;

kickBackStrength = 5.0;
sound = ChaingunProjectile;

//dryVelocity = 425.0;
dryVelocity = 5000.0; // z0dd - ZOD, 8-12-02. Was 425.0
wetVelocity = 4500.0;
velInheritFactor = 0.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;

tracerLength = 30.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.10;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;

decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
};

//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(GarandImage)
{
className = WeaponImage;
shapeFile = "weapon_sniper.dts";
item = GarandRifle;
ammo = GarandRifleAmmo;
projectile = GarandBullet;
projectileType = TracerProjectile;
emap = true;
armThread = looksn;

casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;

projectileSpread = 1.0 / 10000.0;

//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = ChaingunSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";

//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";

//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";

//--------------------------------------
stateName[3] = "Spinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = ChaingunSpinupSound;
//
stateTimeoutValue[3] = 0.0001;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";

//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = AssaultMortarFireSound;
//stateRecoil[4] = LightRecoil;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
//
stateTimeoutValue[4] = 2.0;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";

//--------------------------------------
stateName[5] = "Spindown";
stateSound[5] = ChaingunSpinDownSound;
stateSpinThread[5] = SpinDown;
//
stateTimeoutValue[5] = 0.01;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";

//--------------------------------------
stateName[6] = "EmptySpindown";
stateSound[6] = ChaingunSpinDownSound;
stateSpinThread[6] = SpinDown;
//
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";

//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 1.0;
stateTransitionOnTimeout[7] = "NoAmmo";
};

datablock ItemData(GarandRifle)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_sniper.dts";
image = GarandImage;
mass = 2;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "Garand Rifle";

computeCRC = true;
emap = true;
};

function GarandImage::onMount(%this, %obj, %slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(ScopeImage, 4);

}

function GarandRifleImage::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data,%obj,%slot);
CreateShockwave(%p, "0 0 -1", "IonShockwaveTrail", 100);
}

function ShockwaveFunction(%obj,%proj)
{
   if(isobject(%proj))
   {
      %fake = new (linearprojectile)()
      {
      dataBlock        = "Matrix";
      initialDirection = %proj.MuzVec;
      initialPosition  = %proj.position;
      sourceSlot       = %obj;
      };
      %fake.sourceobject = %obj;
      MissionCleanup.add(%fake);

      %proj.ShockwaveSchedule = schedule( 80,0, "ShockwaveFunction" ,%obj,%Proj);
   }
}

function Matrix::onExplode(%data, %proj, %pos, %mod)
{
parent::onexplode(%data, %proj, %pos, %mod);
cancel(%proj.ShockwaveSchedule);

}

function GarandImage::onUnmount(%this, %obj, %slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(4);
}






Top
 Profile  
 
PostPosted: Thu Sep 04, 2003 12:57 pm
AVM Founder
User avatar
 

Joined: Nov 09, 2002
Posts: 3759
Location: Milford, MA
Umm, you didn't add the onFire part.

Dude who's code is this?

function Matrix::onExplode(%data, %proj, %pos, %mod)

what's matrix?

And you have like IonShockwave or something.....


and then you have CreateShockwave or something. idk.....

Unless your not following what I said above, you need to fix a few things ;)

_________________
"Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live."


Top
 Profile WWW  
 
PostPosted: Thu Sep 04, 2003 11:51 pm

Joined: Feb 04, 2003
Posts: 474
Location: Canada
:D u guys do no theres a way to spawn shockwaves right like with out the projectile im not on the right comp right now so i dont have it right now sorry but ya that whoud not be to hard to make

_________________
[flash width=468 height=60 loop=true]http://img.photobucket.com/albums/v227/shadow66/flashlogomcs.swf[/flash]


Top
 Profile WWW  
 
PostPosted: Fri Sep 05, 2003 1:15 am

Joined: Mar 05, 2003
Posts: 356
Really!!!! yo bro if you could share this info it would be greatly apreciated.
When u get a chance to post it definetley do so!!! :D


Top
 Profile  
 
PostPosted: Fri Sep 05, 2003 6:13 pm

Joined: Feb 04, 2003
Posts: 474
Location: Canada
ya i well just a sec let me dig it up its got to be on this comp some where....... here it is
%Shock = new shockwave()
         {
         pos = %obj.getPosition();//u can chage this
         normal = //no idea what gose here;
         scale = "0 0 0";
         datablock = //ShockwaveDatablock;
            };

_________________
[flash width=468 height=60 loop=true]http://img.photobucket.com/albums/v227/shadow66/flashlogomcs.swf[/flash]


Top
 Profile WWW  
 
PostPosted: Sat Sep 06, 2003 2:46 am

Joined: Mar 05, 2003
Posts: 356
function spawnShockwaveTrail(%obj, %time, %data)
{
if(isObject(%obj))
{
%pos = %obj.position;

if(vectorCompare(%pos, %obj.lastShockBlinkPos)) //same position...BUG!
return;

%wave = spawnShockwave(%data, %pos, %obj.initialDirection);

schedule(%time, 0, spawnShockwaveTrail, %obj, %time, %data);
%obj.lastShockBlinkPos = %pos;
}
}



I found this in the function library. Im wondering how this one works, and if it would work better.


Top
 Profile  
 
PostPosted: Sat Sep 06, 2003 8:09 am
User avatar

Joined: Feb 04, 2003
Posts: 3791
Location: Underground
kc_144 wrote:
ya i well just a sec let me dig it up its got to be on this comp some where....... here it is
%Shock = new shockwave()
         {
         pos = %obj.getPosition();//u can chage this
         normal = //no idea what gose here;
         scale = "0 0 0";
         datablock = //ShockwaveDatablock;
            };

It doesn't have a texture if you do it that way.
heres my function. More arguments, but more flexible
function CreateShockwaveTrails(%obj, %Projectile, %emitTime)
{
      if(isObject(%obj))
   {
      %p = new LinearProjectile()
         {
         datablock = %Projectile;
         initialPosition = %obj.getPosition();
         initialDirection = %obj.initialDirection;
         sourceObject = %obj.sourceObject;
         sourceSlot = 0;
         vehicleObject = 0;
            };
      MissionCleanup.add(%p);
      if(%emitTime > 0)
      {
         schedule(%emitTime,0, "CreateShockwaveTrails", %obj, %Projectile, %emitTime);
      }
   }
}

%obj is the projectile that you want shockwave trails to come from. %projectile is a LINEAR projectile datablock that has an explosion that uses a shockwave (it doesn't really have to has a shockwave, but it does for shockwave trails). %emit time is the number of milliseconds from each shocwave.

_________________
Making advances in Tribes2 physics for fun and profit!


Top
 Profile  
 
PostPosted: Sat Sep 06, 2003 12:41 pm
User avatar

Joined: Nov 17, 2002
Posts: 2066
Location: Buffalo, NY
i set mine up like this, and im getting consol spam like crazy..its not likeing line 785...did i do this right?

function CreateShockwaveTrails(%obj, %Projectile, %emitTime)
{
      if(isObject(%obj))
   {
      %p = new LinearFlareProjectile()
         {
         datablock = %Projectile;
         initialPosition = %obj.getPosition();
         initialDirection = %obj.initialDirection;
         sourceObject = %obj.sourceObject;
         sourceSlot = 0;
         vehicleObject = 0;
            };
      MissionCleanup.add(%p);
      if(%emitTime > 0)
      {
         schedule(%emitTime,0, "CreateShockwaveTrails", %obj, %Projectile, %emitTime);
      }
   }
}
//END

function ChaingunImage::onFire(%data, %obj, %slot)
{
  CreateShockwaveTrails("ChaingunBullet", "SWaveBolt", 100);
}

_________________
Image


Top
 Profile  
 
PostPosted: Sat Sep 06, 2003 1:08 pm
User avatar

Joined: Feb 04, 2003
Posts: 3791
Location: Underground
Lt Earthworm wrote:
%obj is the projectile that you want shockwave trails to come from

call it like this:
function ChaingunImage::onFire(%data, %obj, %slot)
{
      %p = Paren::onFire(%data, %obj, %slot);
      CreateShockwaveTrails(%p, %yourShockwave, %time);
}

or if you wanted to change things up a bit:
function ChaingunImage::onFire(%data, %obj, %slot)
{
      CreateShockwaveTrails(Parent::onFire(%data, %obj, %slot), %yourShockwave, %time);
}

Both will work equally as well.

_________________
Making advances in Tribes2 physics for fun and profit!


Top
 Profile  
 
PostPosted: Sat Sep 06, 2003 2:48 pm
User avatar

Joined: Nov 17, 2002
Posts: 2066
Location: Buffalo, NY
thanks, that worked

_________________
Image


Top
 Profile  
 
PostPosted: Sat Sep 06, 2003 5:47 pm
AVM Founder
User avatar
 

Joined: Nov 09, 2002
Posts: 3759
Location: Milford, MA
How does yours stop scheduling itself Lt?

_________________
"Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live."


Top
 Profile WWW  
 
PostPosted: Sun Sep 07, 2003 12:18 am
User avatar

Joined: Feb 04, 2003
Posts: 3791
Location: Underground
if(isObject(%obj))

the schedule is inside that if.

_________________
Making advances in Tribes2 physics for fun and profit!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to:  
cron