Author Topic: Mount an image to the head? (Still broken...)  (Read 498 times)

I'm trying to mount an image to the head of the player when a weapon is drawn. Here's my code:

Code: [Select]

function UberTanaHandsImage::onMount(%this, %obj, %slot)
{
%obj.hideNode(rhand);
%obj.hideNode(lhand);
%obj.mountImage(UberTanaHeadimage);
}

function UberTanaHandsImage::onUnMount(%this, %obj, %slot)
{
%obj.unHideNode(rhand);
%obj.unHideNode(lhand);
%obj.unMountImage(5, UberTanaHeadimage);
}

For some reason, this causes the hands image not to mount. Only the head image mounts. Commenting out the "%obj.mountimage" line makes the hands image mount. It's a bit baffling.

Help?
« Last Edit: April 07, 2013, 05:01:54 PM by takato14 »

Code: [Select]
playerObject.mountImage(imagename,$headSlot);

Code: [Select]
playerObject.mountImage(imagename,$headSlot);

*facedesk*

Thanks.

EDIT: That also doesn't work. Mounting it via the console doesn't work either, so I assume it's a problem with the image datablock(s):

Code: [Select]

datablock shapeBaseImageData(ubertanaheadImage)
{
   shapeFile = "./UberTana_Head.dts";
   emap = true;
   mountPoint = 0;
   offset = "0 0 0";
   correctMuzzleVector = false;
   className = "Image";
   ammo = " ";
   doRetraction = false;

   doColorShift = false;
   colorShiftColor = "0.471 0.471 0.471 1.000";
};

datablock shapeBaseImageData(ubertanaImage)
{
   shapeFile = "./UberTana_Hands.dts";
   emap = true;
   mountPoint = 0;
   offset = "0 0 0";
   correctMuzzleVector = false;
   className = "WeaponImage";
   item = ubertanaItem;
   ammo = " ";
   projectile = ubertanaProjectile;
   projectileType = Projectile;
   melee = true;
   doRetraction = false;
 
   armReady = true;

   doColorShift = false;
   colorShiftColor = "0.471 0.471 0.471 1.000";

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

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "prepswing";
stateAllowImageChange[1]         = true;
stateSequence[1] = "root";

stateName[2] = "prepSwing";
stateScript[2]                  = "onprepSwing";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.55;
stateTransitionOnTimeout[2]     = "swing";
stateTransitionOnMouseUp[2] = "Ready";
stateSequence[2] = "prepare";

stateName[3]                    = "swing";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.05;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;
stateSequence[3] = "SWINGMOTHERforgetER";

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

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

Here's the new set of functions.

Code: [Select]
function ubertanaImage::onMount(%this, %obj, %slot)
{
%obj.hideNode(rhand);
%obj.hideNode(lhand);
%obj.mountImage(ubertanaheadimage, $headSlot);
}

function ubertanaImage::onUnMount(%this, %obj, %slot)
{
%obj.unHideNode(rhand);
%obj.unHideNode(lhand);
%obj.unMountImage(5);
}

« Last Edit: April 07, 2013, 05:05:08 PM by takato14 »


In the image datablock, do
mountPoint = $headslot;

Then to mount the image, do
player.mountimage(ubertanaheadimage,2);
Or instead of 2 try 1 or 3 until you find a slot that works

I use the 0 slot for my emitters on a player.

In the image datablock, do
mountPoint = $headslot;

Then to mount the image, do
player.mountimage(ubertanaheadimage,2);
Or instead of 2 try 1 or 3 until you find a slot that works

Excellent. Thanks.