Author Topic: An oil lamp.  (Read 3401 times)

I'll finish the script for this once he gives me the new model.

I'll finish the script for this once he gives me the new model.
Oh darnit I forgot :S

But anyhow, you could probably do with the current one too.

EDIT: Files sent, done.
« Last Edit: September 22, 2011, 05:16:43 PM by Barakuda »

ahhhh why can't the fire just go to the right spot already :(

ahhhh why can't the fire just go to the right spot already :(
alright i guess i need help. it mounts and everything but not in the right spot, what is going on ? :(

Code: [Select]
function OilLampImage::onReady(%this, %obj, %slot)
{
%this.Oilslot = %slot;
if($OilLamp::Explode)
{
if(%this.wantsOilLight)
{
if($OilLamp::LightSource)
{
mountOilLampLight(%this);
return parent::onReady(%this, %obj, %slot);
}
else
{
//No Light
}
}
else
{
//No Light
}
}
else
{
%obj.mountImage(OilLampNoEXPImage, 0);
}
}

function toggleOilLight(%client)
{
%obj = %client.player;
if(%obj.wantsOilLight)
{
%obj.wantsOilLight = 0;
unMountOilLampLight(%obj);
}
else if($OilLamp::LightSource)
{
%obj.wantsOilLight = 1;
mountOilLampLight(%obj);
}
}

function mountOilLampLight(%obj)
{
%image = %obj.getMountedImage(%obj.oilslot);
%image.mountImage(OilLampLightImage,0);
%image.mountImage(OilLampFireImage,0);
}

function unMountOilLampLight(%obj)
{
%image = %this.getMountedImage(%obj.oilslot);
if(%image.getMountedImage !$= OilLampFireImage)
{
%obj.unMountImage(0);
%obj.unMountImage(0);
}
}

//Emitter

datablock fxLightData(OilLampLight : RedLightSmall)
{
uiName = "Oil Lamp Light";
color = "0.93 0.92 0.60 1";
};

datablock ParticleData(OilLampCandleParticle)
{
textureName          = "base/data/particles/cloud";
dragCoefficient      = 1.0;
gravityCoefficient   = -7.0;
inheritedVelFactor   = 0.0;
windCoefficient      = 0.0;
constantAcceleration = 0.0;
lifetimeMS           = 200;
lifetimeVarianceMS   = 0;
spinSpeed     = 0;
spinRandomMin = -90.0;
spinRandomMax =  90.0;
useInvAlpha   = false;

colors[0] = "0.0 0.0 0.0 0.0";
colors[1] = "1   1   0.3 0.0";
colors[2] = "1   1   0.3 1.0";
colors[3] = "0.6 0.0 0.0 0.0";

sizes[0] = 0.0;
sizes[1] = 0.0;
sizes[2] = 0.09;
sizes[3] = 0.01;

times[0] = 0.0;
times[1] = 0.5;
times[2] = 0.51;
times[3] = 0.7;
};

datablock ParticleEmitterData(OilLampCandleEmitter)
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 0;
   ejectionVelocity = 0.0;
   ejectionOffset   = 0.0;
   velocityVariance = 0.0;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;

   //lifetimeMS = 5000;
   particles = OilLampCandleParticle;   

};


datablock ShapeBaseImageData(OilLampFireImage)
{
   shapeFile = "./empty.dts";
emap = false;

mountPoint = 0;
   rotation = "1 0 0 180";

stateName[0] = "Ready";
stateTransitionOnTimeout[0] = "FireA";
stateTimeoutValue[0] = 0.01;

stateName[1] = "FireA";
stateTransitionOnTimeout[1] = "Done";
stateWaitForTimeout[1] = True;
stateTimeoutValue[1] = 10000;
stateEmitter[1] = OilLampCandleEmitter;
stateEmitterTime[1] = 10000;

stateName[2] = "Done";
stateScript[2] = "onDone";
};

datablock ShapeBaseImageData(OilLampLightImage)
{
   shapeFile = "./empty.dts";
emap = false;

mountPoint = 0;
   rotation = "1 0 0 180";

stateName[0] = "Ready";
stateTransitionOnTimeout[0] = "FireA";
stateTimeoutValue[0] = 0.01;

stateName[1] = "FireA";
stateTransitionOnTimeout[1] = "Done";
stateWaitForTimeout[1] = True;
stateTimeoutValue[1] = 10000;
stateLight[1] = OilLampLight;
stateLightTime[1] = 10000;

stateName[2] = "Done";
stateScript[2] = "onDone";
};