Game Development Community

dev|Pro Game Development Curriculum

Magneto unique skill - [ MAGNETIC SHOCKWAVE ] !!!!

by Sgfreeman · 03/30/2016 (3:13 am) · 2 comments

Setup

Shockwave mesh: You can make any cylinder, glow skin, UV scroll animation(Make its position mark at the bottom, make it as a staticshape)
Decal: Make some damage effect to the ground(e.g.: Walldamage decal)
Explosion: Make the explosion(e.g.: default water explosion)
Animation: Make the shockwave animation of your character(If you don't like melee, you may choose it as a explosion for any projectile. It's up to you!)

datablock StaticShapeData(Explolight)
{
   shapeFile = "art/shapes/weapons/Ballattack/Explolight.dae";
   category = "Beam";
   Lock = "0";
};

datablock ExplosionData(ShockwaveExplosion)
{
   soundProfile = TurretDestroyed;
   lifeTimeMS = 500; // I want a quick bang and dissipation, not a slow burn-out

   emitter[0] = ElectricEmitter;
   emitter[1] = RLWaterExpSparkEmitter;
   emitter[2] = RLWaterExpSmokeEmitter;
   //emitter[3] = RLWaterExpBubbleEmitter;

   shakeCamera = true;
   camShakeFreq = "6.0 7.0 5.0";
   camShakeAmp = "10.0 10.0 10.0";
   camShakeDuration = 0.8;
   camShakeRadius = 6.0;

   lightStartRadius = 10.0;
   lightEndRadius = 0.0;
   lightStartColor = "0.9 0.9 0.8";
   lightEndColor = "0.6 0.6 1.0";
   lightStartBrightness = 5.0;
   lightEndBrightness = 0.0;
};

Code
// Magnetic shockwave call function
            for(%i=300; %i <= 3700; %i = %i + 200)
    {
         if(%i == 300)
            %dist = 1;
       else
            %dist = 3;
        %pos = VectorAdd(%startPos, VectorScale(%eyeVec, %i/100 + %dist));
        %pos = setWord(%pos, 2, getWord(%obj.getPosition(), 2));
        %this.schedule(%i, "Shockwave", %obj, %pos);
    }

//////// Shockwave ////////
function WeaponImage::Shockwave(%this, %obj, %pos)  
{
            %Expolight = "Explolight";
            %Expo = ShockwaveExplosion;
            %lcolor = "0 0.835294 1 0.867";

%lighting = new PointLight() {
      radius = "6";
      isEnabled = "1";
      color = %lcolor;
      brightness = "1";
      castShadows = "0";
      priority = "1";
      animate = "1";
      animationType = "FireLightAnim";
      animationPeriod = "1";
      animationPhase = "1";
      flareType = "LightFlareExample1";
      flareScale = "16";
      attenuationRatio = "0 1 1";
      shadowType = "DualParaboloidSinglePass";
      texSize = "512";
      overDarkFactor = "2000 1000 500 100";
      shadowDistance = "400";
      shadowSoftness = "0.15";
      numSplits = "1";
      logWeight = "0.91";
      fadeStartDistance = "0";
      lastSplitTerrainOnly = "0";
      representedInLightmap = "0";
      shadowDarkenColor = "0 0 0 -1";
      includeLightmappedGeometryInShadow = "0";
      position = %pos;
      rotation = "1 0 0 0";
      canSave = "1";
      canSaveDynamicFields = "1";
   };
      %lighting.schedule(500, "delete");

   %KiExplo = new explosion() {
      dataBlock        = %Expo;
      position         = %pos;
      sourceObject     = %obj;
   };
   MissionCleanup.add(%KiExplo);

      %Kilight = new StaticShape() // Explosion Light
     {
         isAIControlled = "0";
         dataBlock = %Expolight;
         position = %pos;
         rotation = %obj.rotation;
         scale = "0 0 0";
         canSave = "1";
         canSaveDynamicFields = "1";
         Lock = "0";
     };

     %sobj = %Kilight;
     %snumx = 0.1;
     %snumy = 0.1;
     %snumz = 0.1;
    for(%i=5; %i <= 5000; %i = %i + 5)
    {
     if (%i > 50 && %i <= 500)
       {
        %snumx = 0;
        %snumy = 0;
        %snumz = 0.1;
       }

     if (%i > 500)
       {
        %snumx = -0.05;
        %snumy = -0.05;
       }
     %this.schedule(%i, "Shape_Scale", %sobj, %snumx, %snumy, %snumz);
    }

   %Decalposition = %pos;   
   %normal = "0.0 0.0 0.5";
   %decalObj = decalManagerAddDecal(%Decalposition, %normal, getRandom(360), 3, wallDamage1, false);

 // ShaveWave Impact damage
    radiusDamage( %obj, %pos, 6, 400, "BallattackBeamDamage", 600 );
    serverPlay3D(ShockwaveSound, %pos);
}

//Scale up the beam
function WeaponImage::Shape_Scale(%this, %sobj, %snumx, %snumy, %snumz)
{
 if (!isObject(%sobj))
     return;

    %sx = getWord(%sobj.scale, 0) + (%snumx);
    %sy = getWord(%sobj.scale, 1) + (%snumy);
    %sz = getWord(%sobj.scale, 2) + (%snumz);
 if (%sx < 0 || %sy < 0 || %sz < 0)
   {
     %sobj.delete();
     return;
   }
else
    %sobj.setScale(%sx SPC %sy SPC %sz);
}

Well, that's all. Enjoy!

Legend of G' trailer

You can see it at 1:28 in my trailer

For more details, please see...
Legend of G' indiegogo campaign:www.indiegogo.com/projects/legend-of-g/x/11972201#/
Legend of G' Youtube channel:www.youtube.com/channel/UCe59giuiHuAvSa79n6yT1Pw

#1
03/31/2016 (5:25 pm)
Thank you for submitting this, I can't wait to try it out.
#2
03/31/2016 (7:07 pm)
Sorry! Missing 2 lines at the beginning in Call function.

%eyeVec = %obj.getEyeVector();
%startPos = %obj.getEyePoint();

Enjoy!