The images.
datablock ItemData(BodyArmorItem)
{
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 = "./BodyArmor.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
//gui stuff
uiName = "Body Armor";
iconName = "./BodyArmor";
doColorShift = false;
colorShiftColor = "0.200 0.200 0.200 1.000";
// Dynamic properties defined by the scripts
image = BodyArmorImage;
canDrop = true;
};
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(BodyarmorImage)
{
// Basic Item properties
shapeFile = "base/data/shapes/empty.dts";
emap = true;
// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 0;
offset = "0.13 0.2 -0.8";
rotation = eulerToMatrix("0 0 0");
eyeOffset = "0.13 0.2 -0.8";
eyeRotation = eulerToMatrix("0 0 0");
doColorShift = true;
colorShiftColor = BodyArmorItem.colorShiftColor;
// 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;
// Add the WeaponImage namespace as a parent, WeaponImage namespace
// provides some hooks into the inventory system.
className = "ToolImage";
// Projectile && Ammo.
item = BodyArmorItem;
//melee particles shoot from eye node for consistancy
melee = true;
//raise your arm up or not
armReady = false;
doColorShift = true;
colorShiftColor = BodyArmorItem.colorShiftColor; //"0.200 0.200 0.200 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";
stateName[1] = "Ready";
stateScript[1] = "onUse";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateName[2] = "Fire";
stateTransitionOnTriggerUp[2] = "Ready";
stateScript[2] = "onFire";
};
datablock ShapeBaseImageData(BodyArmor2Image)
{
// Basic Item properties
shapeFile = "./BodyArmor.dts";
emap = true;
// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 2;
offset = "0 0.05 -0.5";
rotation = eulerToMatrix("0 0 0");
eyeOffset = "0.65 1 5.1";
eyeRotation = eulerToMatrix("0 0 0");
doColorShift = true;
colorShiftColor = BodyArmorItem.colorShiftColor;
// 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;
// Add the WeaponImage namespace as a parent, WeaponImage namespace
// provides some hooks into the inventory system.
className = "ToolImage";
// Projectile && Ammo.
item = BodyArmorItem;
//melee particles shoot from eye node for consistancy
melee = false;
//raise your arm up or not
armReady = false;
doColorShift = true;
colorShiftColor = BodyArmorItem.colorShiftColor; //"0.200 0.200 0.200 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";
stateName[1] = "Ready";
};
function BodyArmorImage::onFire(%this, %obj, %slot)
{
%client = %obj.client;
if(%client.player.Armoron == 0)
{
//set your datablock to parachuting
//%client.player.setDataBlock("PlayerBodyArmor");
//hide any backpack items if you are wearing them
%obj.hidenode(cape);
%obj.hidenode(pack);
%obj.hidenode(quiver);
%obj.hidenode(tank);
%obj.hidenode(armor);
%obj.hidenode(bucket);
%obj.client.centerPrint("\c6You put on the Armor",3);
//mount the Body Armor and unmount the un-Body Armoring Armor (confusing, I know)
%client.player.unmountimage(2);
%client.player.mountimage(BodyArmor2image, 2);
%client.player.Armoron = 1;
}else{
%client.player.Armoron = 0;
//reset your datablock
//if(!isObject(%client.minigame))
//{
// %client.player.setDataBlock("PlayerStandardArmor");
//}else{
// %client.player.setdatablock(%client.minigame.playerDatablock);
//}
//unmount the Armor
%client.player.unmountimage(2);
//Re-mount the FakeArmor
%client.player.mountImage(BodyArmorImage, 2);
//and rehide this stuff here
%obj.hidenode(cape);
%obj.hidenode(pack);
%obj.hidenode(quiver);
%obj.hidenode(tank);
%obj.hidenode(armor);
%obj.hidenode(bucket);
%obj.client.centerPrint("\c6You took off the Armor",3);
}
}
//Old method
//Armor Player datablock
//datablock PlayerData(PlayerBodyArmor : PlayerStandardArmor)
//{
// canJet = 0;
// maxDamage = 130;
// uiname = "BodyArmor Player";
//};
//mounts the Armor when you equip it
function Armorimage::onMount(%this,%user)
{
%user.playthread(1,root);
if(%user.Armoron)
{
return;
}
%user.mountimage(BodyArmor0image, 2);
%obj = %user;
%obj.hidenode(cape);
%obj.hidenode(pack);
%obj.hidenode(quiver);
%obj.hidenode(tank);
%obj.hidenode(armor);
%obj.hidenode(bucket);
}
function BodyArmorimage::onUnMount(%this,%user)
{
if(%user.Armoron)
{
return;
}
%user.unmountimage(2);
%user.client.applybodyparts();
}
It crashes when I take it off and then attempt to put it on again.