Mount Points

Author Topic: Mount Points  (Read 1633 times)

How do you add a mount point to a model. The only thing I've known to do so far is make the object and texture it. Now I need to know everything you need to do afterwards, except export. I know how to export.

Also needs to be fast, my latest MS trial expires in 1 hour. :cookieMonster:

I did it! :D

The textures aren't appearing though, they're in the shapes folder and are .jpg

Halp pls  :panda:

http://img67.imageshack.us/my.php?image=blockland00008ij4.png

they need 2 be in a .png format...

They need to be a .png if you want transparency and colorshift to work. I'd make the hilt from the standard Blank, Black25, etc material.

For the blade, set the texture to "saber.base.png", copy blank.png and rename it that. Then, make a texture with half-transparent red and name it saber.red.png. Same with a blue and green.

You can then use a similar system to the v0002 Spray Can to mount a coloured lightsaber (check whether color ID table of current color is within a "tolerance" of 1 0 0 1, 0 1 0 1, etc)

The spraycan script is attached.

I am new to making weapons.... needs to be cave man talk to me Space.

What I got from that post:
Quote
They need to be a .png if you want transparency and colorshift to work. I'd make the hilt from the standard Blank, Black25, etc material.
They need to be .png if you want the blade to be transparent and changable. I would use the already existing materials from the Shapes folder.

Quote
For the blade, set the texture to "saber.base.png"", copy blank.png and rename it that.
Done.

Quote
Then, make a texture with half-transparent red and name it saber.red.png. Same with a blue and green.
How do you make a semi transparent texture. I can't even make a fully transparent one. =S
Also, I think I'm just going to do Red and Blue since two "good" colors would make the "bad" side look less to a player.

Quote
You can then use a similar system to the v0002 Spray Can to mount a coloured lightsaber (check whether color ID table of current color is within a "tolerance" of 1 0 0 1, 0 1 0 1, etc)
All I understood from that was it would be able to change color if I did so. (Check whether color ID is nearer Red or Blue to signify which color the lightsaber is?)

Quote
The spraycan script is attached.
I'm really bad at reading/writing scripts that are more than your average weapon. :panda:


Code: [Select]
datablock ShapeBaseImageData(blueSprayCanImage)
{
   // Basic Item properties
   shapeFile = "~/data/shapes/spraycan.dts";
   skinName = 'blue';
   projectile = bluePaintProjectile;
   ....stuff
};

datablock ShapeBaseImageData(redSprayCanImage : blueSprayCanImage){
skinName = 'red';
projectile = redPaintProjectile;
};
datablock ShapeBaseImageData(greenSprayCanImage : blueSprayCanImage){
skinName = 'green';
projectile = greenPaintProjectile;
};
You'll notice that each of the new images has a 'skin name' variable, but they all use the same model. (The copy datablocks bit) When you set a skin name for a weapon, Torque uses the texture with 'base' in it replaced with whatever the skin name is. For instance, I told you to set your model to "saber.base.png" and then make files "saber.red.png" and "saber.blue.png". So, for your script:

Code: [Select]
datablock ItemData(saberItem)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "./shapes/saber.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
        skinName = 'blue';
//gui stuff
uiName = "Lightsaber";
iconName = "./ItemIcons/sword";
doColorShift = true;
colorShiftColor = "0.471 0.471 0.471 1.000";

// Dynamic properties defined by the scripts
image = saberRedImage;
canDrop = true;
};

datablock ShapeBaseImageData(saberRedImage)
{
   // Basic Item properties
   shapeFile = "./shapes/saber.dts";
   skinName = 'red';
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   //eyeOffset = "0.1 0.2 -0.55";

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = false;

   eyeOffset = "0.7 1.2 -0.25";

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = swordItem;
   ammo = " ";
   projectile = swordProjectile;
   projectileType = Projectile;

   //melee particles shoot from eye node for consistancy
   melee = true;
   doRetraction = false;
   //raise your arm up or not
   armReady = true;

   //casing = " ";
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";

   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]      = "Ready";
stateSound[0]                    = swordDrawSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "PreFire";
stateAllowImageChange[1]         = true;

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.2;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;
//stateTransitionOnTriggerUp[3] = "StopFire";

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";


stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";


};

datablock ShapeBaseImageData(saberBlueImage : saberRedImage)
{
 skinName = 'blue';
};

package Saber
{
function saberItem::onUse(%this,%obj,%slot)
{
 if(vectorDist(getColorIDTable(%obj.client.curSprayCan),"0 0 1 1") < 0.5)
 {
  %this.image = saberBlueImage;
 }
 else
 {
  %this.image = saberRedImage;
 }
 Parent::onUse(%this,%obj,%slot);
}
function servercmdUseSprayCan(%client,%slot)
{
 Parent::servercmdUseSprayCan(%client,%slot);
 %client.curSprayCan = %slot;
}
};activatepackage(saber);

Basic sword code + stuff with spraycan. Basically, if the last spray color you used is close-ish to bright blue then your saber is blue, otherwise it is red.

Written on the spot and untested, might not work.

A partially transparent texture for the blade may not be required (try that Emissive thing for that part of the model if you are using Milkshape), try making it a solid texture.