Author Topic: Changing item mount point  (Read 670 times)

I'm making some items and one of them needs to be on the chest (point 2) instead of the hand (point 0).
If I add the line 'mountpoint = 2;' to the datablock the item will not unequip unless dropped.
How do I make it unequip if the player changes items?

Try this.
Code: [Select]
package Blah
function BlahImage::onMount(%this, %obj, %slot)
{
parent::onMount(%this, %obj, %slot);

if(%obj.getMountedImage(2).getName() $= "BlahImage")
{
%obj.unMountImage(2);
}
}
};
activatePackage(Blah):
Replace the Blahs with the appropriate stuff.

Now it won't mount the image at all.

Also, you don't need to use {} if the if structure only runs one line:
if(%obj.getMountedImage(2).getName() $= "BlahImage")
         %obj.unMountImage(2);

Or even:
if(%obj.getMountedImage(2).getName() $= "BlahImage") %obj.unMountImage(2);


Now it won't mount the image at all.

Also, you don't need to use {} if the if structure only runs one line:
if(%obj.getMountedImage(2).getName() $= "BlahImage")
         %obj.unMountImage(2);

Or even:
if(%obj.getMountedImage(2).getName() $= "BlahImage") %obj.unMountImage(2);



Try dropping the parent under the code, and i'm sure jes knows about bracket structure idk why you brought that up, but whatever.

Try dropping the parent under the code, and i'm sure jes knows about bracket structure idk why you brought that up, but whatever.
Fixed:


package Blah_handleMount {
   function BlahHImage::onMount(%this, %obj, %slot)
   {
      %obj.MountImage(BlahImage, 2);      
      parent::onMount(%this, %obj, %slot);
   }
   function BlahHImage::onUnMount(%this, %obj, %slot)
   {
         %obj.unMountImage(2);
      parent::onUnMount(%this, %obj, %slot);
   }
};


where BlahHImage is stripped of any models, emitters, and firing functions.
« Last Edit: June 25, 2012, 07:49:56 AM by ThinkInvisible »

where BlahHImage is stripped of any models, emitters, and firing functions.
What?

What?

datablock ShapeBaseImageData(BlahHImage : BlahImage) {
 stateEmitter[any emitter number] = "";
 stateEmitterTime[any emitter number] = "";
 shapeFile = "base/data/shapes/empty.dts";
 armReady = false;
 mountPoint = 0;
 //etc.
};