Author Topic: Shield ain't working  (Read 1244 times)

I allowed it in the game n' all, but it doesn't show up on the list

Code: [Select]
//shield.cs

//shield item - protects you from something
// -possibly arrows to the legs
// -possibly you have to actively block


//////////
// item //
//////////

datablock ItemData(shield)
{
category = "Item";  // Mission editor category

equipment = true;

//its already a member of item namespace so dont break it
//className = "Item"; // For inventory system

// Basic Item Properties
shapeFile = "~/data/shapes/shield.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "Shield";
iconName = "./ItemIcons/shield";
doColorShift = false;

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


///////////
// image //
///////////
datablock ShapeBaseImageData(shieldImage)
{
// Basic Item properties
shapeFile = "~/data/shapes/shield.dts";
emap = true;

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

   className = "WeaponImage";
   item = shield;

   //raise your arm up or not
   armReady = false;

   doColorShift = false;

stateName[0] = "Activate";
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateSequence[0] = "activate";
stateSound[0] = swordDrawSound;

stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Block";
stateAllowImageChange[1] = true;
stateSequence[1] = "activate";

stateName[2] = "Block";
stateTransitionOnTimeout[2] = "UnBlock";
stateTimeoutValue[2] = 0.5;
stateScript[2] = "onBlock";
stateAllowImageChange[2] = false;
stateSequence[2] = "Block";

stateName[3] = "UnBlock";
stateTransitionOnTimeout[2] = "Ready";
stateTimeoutValue[3] = 0.5;
stateScript[3] = "onUnBlock";
stateAllowImageChange[3] = false;
stateSequence[3] = "unBlock";
};

function shieldImage::onBlock(%this, %obj, %slot)
{
echo("shield block");
}

function shieldImage::onMount(%this,%obj)
{
%rightImage = %obj.getMountedImage($RightHandSlot);

if(%rightImage)
{
if(%rightImage.armready)
{
%obj.playthread(1, armreadyboth);
return;
}
}
%obj.playthread(1, armReadyLeft);
}

function shieldImage::onUnmount(%this,%obj)
{
%rightImage = %obj.getMountedImage($RightHandSlot);

if(%rightImage)
{
if(%rightImage.armready)
{
%obj.playthread(1, armreadyright);
return;
}
}
%obj.playthread(1, root);
}


What's wrong with it?

It works automatically with the sword.
Please read the first post throughly before downloading the add on than asking stupid questions.

It's a shield i'm making, it's got a cool shield model

Oh, alright, I thought you were talking about the already made shield addon, my bad.

datablock ShapeBaseImageData(shieldImage)
{
// Basic Item properties
shapeFile = "~/data/shapes/shield.dts";
emap = true;

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

   className = "WeaponImage";
   item = shieldImage;

   //raise your arm up or not
   armReady = false;

   doColorShift = false;

stateName[0] = "Activate";
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateSequence[0] = "activate";
stateSound[0] = swordDrawSound;

stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Block";
stateAllowImageChange[1] = true;
stateSequence[1] = "activate";

stateName[2] = "Block";
stateTransitionOnTimeout[2] = "UnBlock";
stateTimeoutValue[2] = 0.5;
stateScript[2] = "onBlock";
stateAllowImageChange[2] = false;
stateSequence[2] = "Block";

stateName[3] = "UnBlock";
stateTransitionOnTimeout[2] = "Ready";
stateTimeoutValue[3] = 0.5;
stateScript[3] = "onUnBlock";
stateAllowImageChange[3] = false;
stateSequence[3] = "unBlock";
};

There you go.
« Last Edit: August 09, 2007, 09:27:27 AM by Night-Stalker »