For my upcomming helmet, I need to know what this line does.
%client.player.mountimage(Helmet2image, 5);
What does that 5 at the end mean? I thought it meant which slot it is mounted to. Here is the whole script, when i put on the helmet, it doesn't acutally appear on your head.
datablock ItemData(HelmetItem)
{
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 = "Helmet";
iconName = "./Helmet";
doColorShift = false;
colorShiftColor = "0.200 0.200 0.200 1.000";
// Dynamic properties defined by the scripts
image = HelmetImage;
canDrop = true;
};
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(HelmetImage)
{
// 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 = HelmetItem.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 = HelmetItem;
//melee particles shoot from eye node for consistancy
melee = true;
//raise your arm up or not
armReady = false;
doColorShift = true;
colorShiftColor = HelmetItem.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(Helmet1Image)
{
// 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 0 0";
eyeOffset = 0; //"0.7 1.2 -0.5";
rotation = eulerToMatrix("0 0 0");
eyeRotation = eulerToMatrix("0 0 0");
doColorShift = False;
colorShiftColor = HelmetItem.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 = HelmetItem;
//melee particles shoot from eye node for consistancy
melee = false;
//raise your arm up or not
armReady = true;
doColorShift = true;
colorShiftColor = HelmetItem.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";
};
datablock ShapeBaseImageData(Helmet2Image)
{
// Basic Item properties
shapeFile = "./Bodyarmor.dts";
emap = true;
// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 5;
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 = HelmetItem.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 = HelmetItem;
//melee particles shoot from eye node for consistancy
melee = false;
//raise your arm up or not
armReady = false;
doColorShift = true;
colorShiftColor = HelmetItem.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";
};
//called when you click with it on.
function HelmetImage::onFire(%this, %obj, %slot)
{
%client = %obj.client;
if(%client.player.HelmOn == 0)
{
//set your datablock to parachuting
//%client.player.setDataBlock("PlayerHelmet");
//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 Helmet",3);
//mount the Body Armor and unmount the un-Body Armoring Armor (confusing, I know)
%client.player.unmountimage(5);
%client.player.mountimage(Helmet2image, 5);
%client.player.HelmOn = 1;
}else{
%client.player.HelmOn = 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(5);
//Re-mount the FakeArmor
%client.player.mountImage(Helmet1Image, 5);
//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 Helmet",3);
}
}
//Old method
//Armor Player datablock
//datablock PlayerData(PlayerHelmet : PlayerStandardArmor)
//{
// canJet = 0;
// maxDamage = 130;
// uiname = "Helmet Player";
//};
//mounts the Armor when you equip it
function Helmetimage::onMount(%this,%user)
{
%user.playthread(1,root);
if(%user.HelmOn)
{
return;
}
%user.mountimage(Helmet0image, 5);
%obj = %user;
%obj.hidenode(cape);
%obj.hidenode(pack);
%obj.hidenode(quiver);
%obj.hidenode(tank);
%obj.hidenode(armor);
%obj.hidenode(bucket);
}
function Helmetimage::onUnMount(%this,%user)
{
if(%user.HelmOn)
{
return;
}
%user.unmountimage(5);
%user.client.applybodyparts();
}
package Helmd
{
function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
if(%obj.HelmOn)
{
%damage *= 0.75; //Half the damage
}
Parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
}
};
activatePackage(Helmd);