Adding an (ambient) emitter to a mounted object - How to?

Author Topic: Adding an (ambient) emitter to a mounted object - How to?  (Read 7623 times)

So I have a model that mounts to the player, but I want it to have an ambient emitter that plays constantly.
I have no idea how that code would look.

Would somebody be so kind as to show me exactly how to get it to work?
« Last Edit: November 15, 2014, 09:41:52 PM by Mr.Noßody »

BlahBlahImageName::onMount(%this,%obj,%node)

I may be wrong with the parameters.

So that would take any node named just "node" and put an emitter on it?
What specifies what emitter?

Okay I lied, ignore that.
If what you have is technically classified as a weapon (or item or w/e) then on the shapeBaseImageData just add stateEmmiter[1]=youremmiter; and so long as state 1 is the "ready" state, it should work.

Alright, how would I properly link an emitter?
Just reference the name?

Here's a bit from Pass's Spells:
Code: [Select]
datablock ParticleData(IceBlastAmbient)
{
dragCoefficient = 5;
windCoefficient = 0.0;
gravityCoefficient = 0;
inheritedVelFactor = 0;
constantAcceleration = 10.0;
lifetimeMS = 600;
lifetimeVarianceMS = 0;
spinSpeed = 100.0;
spinRandomMin = 50.0;
spinRandomMax = 150.0;
useInvAlpha = false;
animateTexture = false;

textureName = "base/data/particles/chunk";

//Interpolation variables
colors[0] = "0.5 0.5 0.9 1";
colors[1] = "0.3 0.3 0.7 1";
colors[2] = "0.3 0.3 0.6 1";

sizes[0] = 0.5;
sizes[1] = 0.3;
sizes[2] = 0.00;
times[0] = 0.0;
times[1] = 0.1;
times[2] = 1.0;
};
datablock ParticleEmitterData(IceBlastAmbientEmitter)
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 1;
   ejectionVelocity = 0.4;
   ejectionOffset   = 0;
   velocityVariance = 0.0;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = IceBlastAmbient;
   useEmitterColors = false;
   uiName = "IceBlast Normal";
};
//--sniparoo--//

datablock ShapeBaseImageData(IceBlastImage)
{
    //lots and lots of variables//

   // Initial start up state
stateName[0]                    = "Activate";
stateTimeoutValue[0]            = 0.5;
stateTransitionOnTimeout[0]     = "Ready";

stateAllowImageChange[0] = true;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;
stateEmitter[1]                = IceBlastAmbientEmitter;
stateEmitterTime[1]            = 300;

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Pause1";
    //more states and stuff//
};
//-blah-

Would I only need this part here?
Code: [Select]
datablock ParticleData(IceBlastAmbient)
{
dragCoefficient = 5;
windCoefficient = 0.0;
gravityCoefficient = 0;
inheritedVelFactor = 0;
constantAcceleration = 10.0;
lifetimeMS = 600;
lifetimeVarianceMS = 0;
spinSpeed = 100.0;
spinRandomMin = 50.0;
spinRandomMax = 150.0;
useInvAlpha = false;
animateTexture = false;

textureName = "base/data/particles/chunk";

//Interpolation variables
colors[0] = "0.5 0.5 0.9 1";
colors[1] = "0.3 0.3 0.7 1";
colors[2] = "0.3 0.3 0.6 1";

sizes[0] = 0.5;
sizes[1] = 0.3;
sizes[2] = 0.00;
times[0] = 0.0;
times[1] = 0.1;
times[2] = 1.0;
};
datablock ParticleEmitterData(IceBlastAmbientEmitter)
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 1;
   ejectionVelocity = 0.4;
   ejectionOffset   = 0;
   velocityVariance = 0.0;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = IceBlastAmbient;
   useEmitterColors = false;
   uiName = "IceBlast Normal";
};



Anyways, what I'm trying to do is add an ambient emitter to a Hatmod hat.
But looking at how hats are packaged, they don't have their own cs file dictating anything. The server mod does the work.
Is there any way to add a bit of code to a specific hat to add an emitter to it without needing to edit the server mod?
« Last Edit: November 16, 2014, 01:56:42 PM by Mr.Noßody »

If it's a hat you'll either have to package the server code for when hats are mounted, or modify the server.cs

If it's a hat you'll either have to package the server code for when hats are mounted, or modify the server.cs

I'm leaning toward packaging the server code in the specific hatpack I want with emitters.
However, I have no idea how that should be...

And going back to the emitter on the image thing, is there any way to specify a node name?
Or does it use any node available?


Also, I tried to get the code to work for the /hattest emote just to test.
It didn't work. This is what my code looks like as a test.

Code: [Select]
datablock ShapeBaseImageData(HatTestImage)
{
shapeFile = "./Cigar.dts";
emap = true;
mountPoint = $HeadSlot;
offset = "0 0 0";
eyeOffset = "-1 0 0.4";
rotation = eulerToMatrix("0 0 0");
scale = "0.1 0.1 0.1";
doColorShift = true;
colorShiftColor = "0.392 0.196 0.0 1.000";

stateEmmiter[1]=IceBlastAmbient;
};

datablock ParticleData(IceBlastAmbient)
{
dragCoefficient = 5;
windCoefficient = 0.0;
gravityCoefficient = 0;
inheritedVelFactor = 0;
constantAcceleration = 10.0;
lifetimeMS = 600;
lifetimeVarianceMS = 0;
spinSpeed = 100.0;
spinRandomMin = 50.0;
spinRandomMax = 150.0;
useInvAlpha = false;
animateTexture = false;

textureName = "base/data/particles/chunk";

//Interpolation variables
colors[0] = "0.5 0.5 0.9 1";
colors[1] = "0.3 0.3 0.7 1";
colors[2] = "0.3 0.3 0.6 1";

sizes[0] = 0.5;
sizes[1] = 0.3;
sizes[2] = 0.00;
times[0] = 0.0;
times[1] = 0.1;
times[2] = 1.0;
};
datablock ParticleEmitterData(IceBlastAmbientEmitter)
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 1;
   ejectionVelocity = 0.4;
   ejectionOffset   = 0;
   velocityVariance = 0.0;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = IceBlastAmbient;
   useEmitterColors = false;
   uiName = "IceBlast Normal";
};



function serverCmdHatTest(%client)
{
%player = %client.player;

if(isObject(%player))
{
if(%player.getMountedImage(2) $= nametoID(HatTestImage))
{
%player.unmountImage(2);
%client.applyBodyParts();
%client.applyBodyColors();
}
else
{
%player.unmountImage(2);
%player.mountImage(HatTestImage,2);

for(%i = 0;$hat[%i] !$= "";%i++)
{
%player.hideNode($hat[%i]);
%player.hideNode($accent[%i]);
}
}
}
}
« Last Edit: November 16, 2014, 03:18:42 PM by Mr.Noßody »

shapeFile = "./Cigar.dts"; do you have that /cigar add-on? If so I can tell you exactly how to add an emitter to an image. The problem that you're doing now is that only weapons have the defined states (iirc) not just normal images. I may be wrong though.

shapeFile = "./Cigar.dts"; do you have that /cigar add-on? If so I can tell you exactly how to add an emitter to an image. The problem that you're doing now is that only weapons have the defined states (iirc) not just normal images. I may be wrong though.

I don't have the /cigar addon your thinking of. More or less, Im trying to make my own as a hatmod hat.

Can anyone help me add my own .cs file to the hatmod hat files to add an emitter to a node or my specifications?

Anyone?
I have no idea what Im doing.

You don't need to add a .cs file to anything, just add add the beforementioned stateEmitter, stateEmitterTime and stateEmitterNode clauses to your ShapeBaseImageData state system.

You don't need to add a .cs file to anything, just add add the beforementioned stateEmitter, stateEmitterTime and stateEmitterNode clauses to your ShapeBaseImageData state system.

If I knew what that meant, I would.
A packaged hat has no code to it. The server mod specifies what to do with hats. I'd have to edit the servermod directly and id rather not if possible.

The code I posted was for the /hattest emote and as far as I know, the test should be emitting the ice particles as a placeholder.