Why does this...
if(isObject(%pl.light))
{
%pl.light.delete();
}
...refuse to work anywhere I put it? And why does my right hand show up again after I turn on the lamp when it was fine before I added the light?
function lantern_OFF_Image::onMount(%data, %obj, %slot)
{
%obj.hideNode(RHand);
%obj.hideNode(RHook);
if(isObject(%pl.light))
{
%pl.light.delete();
}
}
function lantern_OFF_Image::onUnMount(%data, %obj, %slot)
{
if(isObject(%client = %obj.client))
{
%client.applyBodyParts();
}
else
{
%obj.unHideNode(RHand);
%obj.unHideNode(RHook);
}
}
function lantern_EQUIP_Image::onMount(%data, %obj, %slot)
{
%obj.hideNode(RHand);
%obj.hideNode(RHook);
if(isObject(%pl.light))
{
%pl.light.delete();
//%pl.schedule(1,mountImage,lantern_OFF_Image,1);
//%pl.playThread(3,plant);
}
}
function lantern_EQUIP_Image::onUnMount(%data, %obj, %slot)
{
if(isObject(%client = %obj.client))
{
%client.applyBodyParts();
}
else
{
%obj.unHideNode(RHand);
%obj.unHideNode(RHook);
}
}
function lantern_ON_Image::onMount(%db, %pl, %data, %obj, %slot)
{
%obj.hideNode(RHand);
%obj.hideNode(RHook);
%pl.light = new fxLight()
{
datablock = lanternLightOn;
};
missionCleanup.add(%pl.light);
%pl.light.setTransform(%pl.getPosition());
%pl.light.attachToObject(%pl);
%pl.light.player = %pl;
}
function lantern_ON_Image::onUnMount(%data, %obj, %slot)
{
if(isObject(%client = %obj.client))
{
%client.applyBodyParts();
}
else
{
%obj.unHideNode(RHand);
%obj.unHideNode(RHook);
}
if(isObject(%pl.light))
{
%pl.light.delete();
}
}
function lantern_EQUIP_Image::onLight(%this, %obj, %slot)
{
%obj.unMountImage(0);
%obj.mountimage(lantern_ON_Image, 0);
}
function lantern_OFF_Image::onFire(%this, %obj, %slot)
{
%obj.unMountImage(0);
%obj.mountimage(lantern_ON_Image, 0);
}
function lantern_ON_Image::onFire(%this, %obj, %slot)
{
%obj.unMountImage(0);
%obj.mountimage(lantern_OFF_Image, 0);
if(isObject(%pl.light))
{
%pl.light.delete();
//%pl.schedule(1,mountImage,lantern_OFF_Image,1);
%pl.playThread(3,plant);
}
}