Author Topic: Scripting Easiest Program/need help  (Read 3185 times)

So im guessing torque script is readable through notepad then?

yes

//Credits go to Azerath For the Main Script from his tutorial.

//G18.cs

//audio
datablock AudioProfile(G18Shot1Sound)
{
   filename    = "./G18.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(bulletHitSound)
{
   filename    = "./bulletHit.wav";
   description = AudioClose3d;
   preload = true;
};


//shell
datablock DebrisData(G18ShellDebris)
{
   shapeFile = "./gunShell.dts";
   lifetime = 2.0;
   minSpinSpeed = -400.0;
   maxSpinSpeed = 200.0;
   elasticity = 0.5;
   friction = 0.2;
   numBounces = 3;
   staticOnMaxBounce = true;
   snapOnMaxBounce = false;
   fade = true;

   gravModifier = 2;
};


//muzzle flash effects
datablock ParticleData(G18FlashParticle)
{
   dragCoefficient      = 3;
   gravityCoefficient   = -0.5;
   inheritedVelFactor   = 0.2;
   constantAcceleration = 0.0;
   lifetimeMS           = 25;
   lifetimeVarianceMS   = 15;
   textureName          = "base/data/particles/Cloud";
   spinSpeed      = 10.0;
   spinRandomMin      = -500.0;
   spinRandomMax      = 500.0;
   colors[0]     = "0.9 0.9 0.0 0.9";
   colors[1]     = "0.9 0.5 0.0 0.0";
   sizes[0]      = 0.5;
   sizes[1]      = 1.0;

   useInvAlpha = false;
};


This is torque script right? I found his on a Cs. File that i opened with notepad++
Edit:err part of it

That's torquescript, but just datablocks.

datablocks give objects their major aspects. Like player speed, health and stuff.

functions are more complicated things that change or add to how the game plays.

function G18Image::onFire(%this,%obj,%slot)
{
   if(%obj.getDamagePercent() < 1.0)
      %obj.playThread(2, plant);
   %projectile = %this.projectile;
   %spread = 0.0020;
   %shellcount = 1;

   for(%shell=0; %shell<%shellcount; %shell++)
   {
      %vector = %obj.getMuzzleVector(%slot);
      %objectVelocity = %obj.getVelocity();
      %vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
      %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
      %velocity = VectorAdd(%vector1,%vector2);
      %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
      %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
      %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
      %mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
      %velocity = MatrixMulVector(%mat, %velocity);

      %p = new (%this.projectileType)()
      {
         dataBlock = %projectile;
         initialVelocity = %velocity;
         initialPosition = %obj.getMuzzlePoint(%slot);
         sourceObject = %obj;
         sourceSlot = %slot;
         client = %obj.client;
      };
      MissionCleanup.add(%p);
   }
   return %p;
}
Then this si the funtion then? That means that the first part was How the weapon looked and the specs and stats of it. And the funtion is like the animations and How the gun is used when its in play?

An object-oriented function yes.

This is called when that specific weapon is fired.
%this is the datablock.
%obj is the player firing the weapon.
%slot will most likely be 0, for right hand slot.
%obj.playthread is the player playing an animation.
%projectile is the datablock's projectile value, which references a projectile datablock.
 for(%shell=0; %shell<%shellcount; %shell++) should only be in there for shotguns. The creator is an idiot.
All that vector stuff is creating spread.
%p = new (%this.projectileType)() is creating a projectile object, with the projectile datablock. The vectors determine the velocity, which includes the spread. The initial position gets the barrel point of the right hand weapon. sourceObject, slot, and client are all for damaging and killing functions, to know who did it.

you should probably start with something simpler like server commands, unless you're comfortable with making edits to guns.

you should probably start with something simpler like server commands, unless you're comfortable with making edits to guns.
YOu mean like console commands while your in a server. I used to know a few of those. If those would be better to help me start working up to stuff like the script/ Edits then i should prolly do that. But with that comes the fact that it will be serveral weeks before i get started. My computer broke and im not allowed to have blockland on this one.

You should start by trying to make some unique firing styles to guns, that would never actually be useful in combat, but give you an idea on how things are done, and to get used to the syntax.

ok.. ill try that.. but like i think i said, i wont have access to blockland for a while

Use Notepad++ its free and it makes reading scripts easier.

Use Notepad++ its free and it makes reading scripts easier.

Get on MSN, we use the same thing.

What can MSN help me out with?

What can MSN help me out with?
Nothing. MegaScience wants to talk to Plornt.
Also, Heedical tooks notes of Mr. Wallet's scripting class and you should learn a bit or two from them.
https://docs.google.com/View?id=dg9fk4gm_6dvwxqhc5
If Heedical or Wallet wants me to take this down I will.

I use Torquedev/Codeweaver, Best one in my opinion.

I thought that you had to purchase codeweaver.