Author Topic: Creating Emitters on Vehicles  (Read 815 times)

Ace

I've been looking at scripts for varying vehicles but I still cannot figure out how to put emitters on vehicles, such as a flame when it starts moving. I want to put four on this thing I'm working on, but I don't know how to go about doing this.

If you give me the link for the warthog I will tell you.

Make a mount point(ex. mount3) on the vehicle for where you want the contrail to be. Then in the script, make a particle that you want to use and add this.

Code: [Select]
datablock ShapeBaseImageData(ContrailImage)
{
   shapeFile = "base/data/shapes/empty.dts";
emap = false;

mountPoint = 3;//-----------------------Mounts at mount3
   rotation = "1 0 0 -90";

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

stateName[1] = "FireA";
stateTransitionOnTimeout[1] = "Done";
stateWaitForTimeout[1] = True;
stateTimeoutValue[1] = 10000;
stateEmitter[1] = ArwingEmitter;//--------Instert emitter datablock here
stateEmitterTime[1] = 10000;

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

function ContrailImage::onDone(%this,%obj,%slot)
{
%obj.unMountImage(%slot);
}

Add a
Code: [Select]
function Arwingvehicle::onadd(%this,%obj)
{

parent::onadd(%this,%obj);

ContrailCheck(%obj);
   
}

so it checks the speed of when the emitter will appear when vehicle is created.

Lastly, Add this
Code: [Select]
function ContrailCheck(%obj)
{
// return;
if(!isObject(%obj))
return;

%speed = vectorLen(%obj.getVelocity());
if(%speed < %obj.dataBlock.min[INSTERT VEHICLE NAME]Speed)//---remove the brackets and put in the vehicle name
{
if(%obj.getMountedImage(3) !$= "")
{

%obj.unMountImage(3);
}
}
else
{
if(%obj.getMountedImage(3) $= 0)
{

%obj.mountImage(contrailImage,3);
}
}



schedule(2000,0,"ArwingCheck",%obj);
}


If you give me the link for the warthog I will tell you.

Get a life, make your own and stop spamming about wanting it.

Ace

That was very helpful, Stratofortress. Thank you.

But if i want to put, say, four engine emitters on the back of this, what would I do at this part?

Code: [Select]
function ContrailCheck(%obj)
{
// return;
if(!isObject(%obj))
return;

%speed = vectorLen(%obj.getVelocity());
if(%speed < %obj.dataBlock.min[INSTERT VEHICLE NAME]Speed)//---remove the brackets and put in the vehicle name
{
if(%obj.getMountedImage(3) !$= "")
{

%obj.unMountImage(3);
}
}
else
{
if(%obj.getMountedImage(3) $= 0)
{

%obj.mountImage(contrailImage,3);
}
}



schedule(2000,0,"ArwingCheck",%obj);
}

Hmm.. Make as many points as you need then


Code: [Select]
function ContrailCheck(%obj)
{
// return;
if(!isObject(%obj))
return;

%speed = vectorLen(%obj.getVelocity());
if(%speed < %obj.dataBlock.min[INSTERT VEHICLE NAME]Speed)//---remove the brackets and put in the vehicle name
{
if(%obj.getMountedImage(3) !$= "")
{

%obj.unMountImage(3);
%obj.unMountImage(4);
%obj.unMountImage(5);
%obj.unMountImage(6);//-------add another one of these; the number is where it will mount
}
}
else
{
if(%obj.getMountedImage(3) $= 0)
{

%obj.mountImage(contrailImage,3);
%obj.mountImage(contrail2Image,4);//--the contrail#image represents the datablocks below
%obj.mountImage(contrail3Image,5);
%obj.mountImage(contrail4Image,6);//--------same here

}
}



schedule(2000,0,"ArwingCheck",%obj);
}


Then,
add 3 more of these witch makes 4 emitters. Dont forget to rename the ContrailImage to Contrail2Image for the 2nd emitter. Contrail3Image for third, and for Contrail4Image



Code: [Select]
function ContrailImage1::onDone(%this,%obj,%slot)
{
%obj.unMountImage(%slot);
}
datablock ShapeBaseImageData(ContrailImage2)
{
   shapeFile = "base/data/shapes/empty.dts";
emap = false;

mountPoint = 4;//-----where to mount it dont forget to change this too
   rotation = "1 0 0 -90";

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

stateName[1] = "FireA";
stateTransitionOnTimeout[1] = "Done";
stateWaitForTimeout[1] = True;
stateTimeoutValue[1] = 10000;
stateEmitter[1] = ContrailEmitter;//---use same emitter
stateEmitterTime[1] = 10000;

stateName[2] = "Done";
stateScript[2] = "onDone";
};
function Contrail2Image::onDone(%this,%obj,%slot)
{
%obj.unMountImage(%slot);
}


« Last Edit: March 26, 2009, 12:52:48 AM by Stratofortress »

If you give me the link for the warthog I will tell you.

I will laugh when you die by warthog bitch.


I also have this problem. I wish for an emitter to go off at a node (ventNode) on an item I am making it it fails something. I know I can made it show an emitter via the state system, however I can't make what I want using this. How do I do this?

EG:
Code: [Select]
if(%obj.getWaterCoverage() > 0.75)
{     
%obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%obj.client.player.getEyeVector(),"2")));
Want the emitter to show up here
}
else
{
Want another emitter to show up here
}
return;