Author Topic: Giving a weapon sights?  (Read 2917 times)

So what do I do to the script?
Edit: How do I create a AK47SightsImage?
The same way you created the AK47Image.

The same way you created the AK47Image.
I don't see it in the HK weird...


By simply creating a second AK47 (copy paste), giving the correct new names and then change the eyeoffset to whatever the eyeoffset has to be to let you look through the scope.
I don't see it in the HK weird...
Oh really?
Quote from: HKscript
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(HK417Image)
{
   // Basic Item properties
   shapeFile = "./Models/HK.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset = 0; //"0.7 1.2 -0.5";
   rotation = eulerToMatrix( "0 0 0" );

   // 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 = true;

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

   // Projectile && Ammo.
   item = HK417Item;
   ammo = " ";
   projectile = HK417projectile;
   projectileType = Projectile;

   casing = gunShellDebris;
   shellExitDir        = "1.0 -1.3 1.0";
   shellExitOffset     = "0 0 0";
   shellExitVariance   = 15.0;   
   shellVelocity       = 7.0;

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

   doColorShift = true;
   colorShiftColor = HK417Item.colorShiftColor;//"0.400 0.196 0 1.000";

   //casing = " ";

   // 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.

   //  NAMES   | FUNCTIONS
   // use      | pull the gun out
   // pullback | rooster the gun
   // fire     | fire
   // clipoutid| clip out idle
   // Clipout  | pull the clip out
   // Clipin   | put the clip in
   
   // Initial start up state - Ammo mod by Space Guy, base states taken from L4Pistol by Bushido!
   stateName[0]                    = "Activate";
   stateTimeoutValue[0]            = 0.01;
   stateTransitionOnTimeout[0]     = "LoadCheckA";

   stateName[1]                    = "Ready";
   stateTransitionOnNoAmmo[1]   = "ClipOut";
   stateTransitionOnTriggerDown[1] = "Fire";
   stateAllowImageChange[1]        = true;
   stateSequence[1]           = "ready";

   stateName[2]                    = "Fire";
   stateTimeoutValue[2]            = 0.0604;
   stateTransitionOnTimeout[2]     = "Smoke";
   stateFire[2]                    = true;
   stateAllowImageChange[2]        = false;
   stateScript[2]                  = "onFire";
   stateSequence[2]      = "fire";
   stateWaitForTimeout[2]      = true;
   stateEmitter[2]         = HK417flashEmitter;
   stateEmitterTime[2]      = 0.05;
   stateEmitterNode[2]      = "muzzleNode";
   stateSound[2]         = HK417shot1Sound;
   stateEjectShell[2]              = true;

   stateName[3]          = "Smoke";
   stateEmitter[3]         = gunSmokeEmitter;
   stateEmitterTime[3]      = 0.1;
   stateTimeoutValue[3]   = 0.03;
   stateEmitterNode[3]      = "muzzleNode";
   stateTransitionOnTimeout[3]   = "FireLoadCheckA";

   stateName[4]         = "Wait";
   stateTimeoutValue[4]      = 0.05;
   stateScript[4]                  = "";
   stateTransitionOnTimeout[4]   = "Fire";
   stateTransitionOnTriggerUp[4] = "Delay";
   
   //Torque switches states instantly if there is an ammo/noammo state, regardless of stateWaitForTimeout
   stateName[5]            = "LoadCheckA";
   stateScript[5]            = "onLoadCheck";
   stateTimeoutValue[5]         = 0.01;
   stateTransitionOnTimeout[5]      = "LoadCheckB";
   
   stateName[6]            = "LoadCheckB";
   stateTransitionOnAmmo[6]      = "ReadyWeap";
   stateTransitionOnNoAmmo[6]      = "ReloadWait";
   
   stateName[7]            = "ReloadWait";
   stateTimeoutValue[7]         = 0.3;
   stateScript[7]            = "";
   stateTransitionOnTimeout[7]      = "ClipOut";
   stateWaitForTimeout[7]         = true;
   //Reloading
   stateName[8]            = "ClipOut";
   stateTimeoutValue[8]         = 0.9;
   stateScript[8]            = "onReloadStart";
   stateSequence[8]      = "clipOut";
   stateAllowImageChange[8]        = false;
   stateTransitionOnTimeout[8]      = "ClipIn";
   stateWaitForTimeout[8]         = true;
   stateSound[8]            = HK417clipOutSound;
   
   stateName[9]            = "ClipIn";
   stateTimeoutValue[9]         = 1.2;
   stateScript[9]            = "";
   stateSequence[9]      = "clipIn";
   stateAllowImageChange[9]        = false;
   stateTransitionOnTimeout[9]      = "reloadFinish";
   stateSound[9]            = HK417clipInSound;
   
   stateName[10]            = "reloadFinish";
   stateTimeoutValue[10]         = 0.25;
   stateScript[10]            = "onReloaded";
   stateAllowImageChange[10]        = false;
   stateTransitionOnTimeout[10]      = "Ready";
   
   stateName[11]            = "FireLoadCheckA";
   stateScript[11]            = "onLoadCheck";
   stateTimeoutValue[11]         = 0.01;
   stateTransitionOnTimeout[11]      = "FireLoadCheckB";
   
   stateName[12]            = "FireLoadCheckB";
   stateTransitionOnAmmo[12]      = "Wait";
   stateTransitionOnNoAmmo[12]      = "ReloadWait";
   
   stateName[13]            = "Delay";
   stateTransitionOnTimeout[13]      = "Ready";
   stateTimeoutValue[13]          = 0.00001;
   
   stateName[14]            = "ReadyWeap";
   stateSequence[14]         = "Use";
   stateTimeoutValue[14]          = 1;
   stateSound[14]         = HK417deploy1Sound;
   stateTransitionOnTimeout[14]      = "Ready";
};

datablock ShapeBaseImageData(HK417SightsImage)
{
   shapeFile = "./Models/HK.dts";
   emap = true;

   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset = "1.22584 1.5 -0.52"; //-Left +Right, -Back +Front, -Down +Up
   rotation = eulerToMatrix( "0 0 0" );

   correctMuzzleVector = true;

   className = "WeaponImage";

   item = HK417Item;
   ammo = " ";
   projectile = HK417projectile;
   projectileType = Projectile;

   casing = gunShellDebris;
   shellExitDir        = "1.0 -1.3 1.0";
   shellExitOffset     = "0 0 0";
   shellExitVariance   = 15.0;
   shellVelocity       = 7.0;

   melee = false;
   armReady = true;

   doColorShift = true;
   colorShiftColor = HK417Item.colorShiftColor;
   
   stateName[0]                    = "Activate";
   stateTimeoutValue[0]            = 0.1;
   stateTransitionOnTimeout[0]     = "LoadCheckA";

   stateName[1]                    = "Ready";
   stateTransitionOnNoAmmo[1]   = "reloadSequence";
   stateTransitionOnTriggerDown[1] = "Fire";
   stateAllowImageChange[1]        = true;
   stateSequence[1]           = "ready";

   stateName[2]                    = "Fire";
   stateTimeoutValue[2]            = 0.08;
   stateTransitionOnTimeout[2]     = "Smoke";
   stateFire[2]                    = true;
   stateAllowImageChange[2]        = false;
   stateScript[2]                  = "onFire";
   stateSequence[2]      = "fire";
   stateWaitForTimeout[2]      = true;
   stateEmitter[2]         = HK417flashEmitter;
   stateEmitterTime[2]      = 0.05;
   stateEmitterNode[2]      = "muzzleNode";
   stateSound[2]         = HK417shot1Sound;

   stateName[3]          = "Smoke";
   stateEmitter[3]         = gunSmokeEmitter;
   stateEmitterTime[3]      = 0.1;
   stateTimeoutValue[3]      = 0.04;
   stateEmitterNode[3]      = "muzzleNode";
   stateTransitionOnTimeout[3] = "FireLoadCheckA";

   stateName[4]         = "Wait";
   stateEjectShell[2]              = true;
   stateTimeoutValue[4]      = 0.07;
   stateScript[4]                  = "";
   stateTransitionOnTimeout[4]   = "Fire";
   stateTransitionOnTriggerUp[4] = "Delay";
   
   stateName[5]            = "LoadCheckA";
   stateScript[5]            = "onLoadCheck";
   stateTimeoutValue[5]         = 0.01;
   stateTransitionOnTimeout[5]      = "LoadCheckB";
   
   stateName[6]            = "LoadCheckB";
   stateTransitionOnAmmo[6]      = "Ready";
   stateTransitionOnNoAmmo[6]      = "ReloadWait";
   
   stateName[7]            = "ReloadWait";
   stateTimeoutValue[7]         = 0.3;
   stateScript[7]            = "";
   stateTransitionOnTimeout[7]      = "reloadSequence";
   stateWaitForTimeout[7]         = true;
   
   stateName[8]            = "reloadSequence";
   stateScript[8]            = "setHKReN";
   
   stateName[9]            = "FireLoadCheckA";
   stateScript[9]            = "onLoadCheck";
   stateTimeoutValue[9]         = 0.01;
   stateTransitionOnTimeout[9]      = "FireLoadCheckB";
   
   stateName[10]            = "FireLoadCheckB";
   stateTransitionOnAmmo[10]      = "Wait";
   stateTransitionOnNoAmmo[10]      = "ReloadWait";
   
   stateName[11]            = "Delay";
   stateTransitionOnTimeout[11]      = "Ready";
   stateTimeoutValue[11]         = 0.106;
};
Notice how there are 2 shapebaseimagedata's?
« Last Edit: June 02, 2010, 06:11:04 AM by lordician »