Author Topic: Vehicle mount/emitter limit?  (Read 2795 times)

I created a vehicle with 4 different mounts that play emitters and only 3 of the four work. I've tried everything I can but the last emitter will not show up.
someone joined my server suggesting i use someones hacky script that adds bots to the mountpoints to play emitters but I have yet to find such script or said person.

can anyone help me with this? Please tell me if I should upload any code.

vehicles and players and staticshapes (?? not 100% sure on this one) can only mount maximum 4 images, slots 0 to 3. i presume you tried using slots 1 to 4 - the standard in coding is to start counting from 0, not 1.

if that's not the case, post your code.

Heres the code for the contrails. I have 4 mountpoints; 2 for afterburners and 2 for the contrails, and only one of the contrails appears.

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

mountPoint = 3;
   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] = F22AContrailEmitter;
stateEmitterTime[1] = 10000;

stateName[2] = "Done";
stateScript[2] = "onDone";
};
function F22AContrailImage1::onDone(%this,%obj,%slot)
{
%obj.unMountImage(%slot);
}
datablock ShapeBaseImageData(F22AContrailImage2)
{
   shapeFile = "base/data/shapes/empty.dts";
emap = false;

mountPoint = 4;
   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] = F22AContrailEmitter;
stateEmitterTime[1] = 10000;

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

function F22AContrailCheck(%obj)
{
// return;
if(!isObject(%obj))
return;

%speed = vectorLen(%obj.getVelocity());
if(%speed < %obj.dataBlock.minF22AContrailSpeed)
{
if(%obj.getMountedImage(3) !$= "")
{
%obj.unMountImage(3);
%obj.unMountImage(4);
}
}
else
{
if(%obj.getMountedImage(3) $= 0)
{
%obj.mountImage(F22AContrailImage1,3);
%obj.mountImage(F22AContrailImage2,4);
}
}
schedule(2000,0,"F22AContrailCheck",%obj);
}



Code: [Select]
function F22ASpeedCheck(%obj)
{
if(!isObject(%obj))
{
return;
}
%pos = %obj.getposition();
%typeMask = $TypeMasks::ProjectileObjectType;
InitContainerRadiusSearch(%pos, 10000, %typeMask);
//%threatdetection = containerFindFirst(%typeMask, %pos, 100000, 100000, 100000);
%obj.ECM="";
%threatDetection = ContainerSearchNext();
while(isobject(%threatDetection) && (%threatDetection.target $= %obj))
{
serverPlay3d(F22AtargetSound,%pos);
%obj.ECM="<color:f00000>[ WARNING : INCOMING MISSILE ]";
break;
}
      %speed = vectorLen(%obj.getVelocity());
%obj.speed = mFloor(%speed+0.5);
%transform= %obj.gettransform();
      %obj.health = mFloor(-1*((%obj.getDamageLevel()/%obj.getDatablock().maxdamage)*100)+100 + 0.5);

switch (%obj.F22Agear)
{
case 1:
   %geart = "Up";
   %stat = "<color:00FF00>";
   %statnum = 1;
case 2:
   %geart = "Down";
   %stat = "<color:FF0000>";
   %statnum = 0;
default:
   %geart = "Down";
   %stat = "<color:FF0000>";
   %statnum = 0;
}

//F22A HUD
commandToClient(%obj.getMountedObject(0).client,'bottomprint',
"<just:left><font:Impact:24pt>\c3Speed <font:Impact:24pt>\c6: " @ %obj.speed @
"<just:center><font:Impact:24pt>\c3Altitude <font:Impact:24pt>\c6: " @ getcontrolobjectaltitude()

@
"<just:right><font:Impact:24pt>\c3[ L ] Gears <font:Impact:24pt>\c6: " @ %geart @
"<just:center><font:Impact:24pt>\c3[ > ] Armament <font:Impact:24pt>\c6: " @ %stat @ " " @

%obj.weapon , 1, 2, 3, 4);

commandToclient(%obj.getMountedObject(0).client,'centerprint',"<just:left><font:Impact:24pt>" @

%obj.lockstat @
"<just:center><font:Impact:24pt>" @ %obj.ECM @
"<just:right><font:Impact:24pt>\c3Health\c6: " @ %obj.health @ "%\n" @
"<just:right><font:Impact:24pt>" @ %obj.fColor @ "[FLARE]" @
"\n\n\n<just:center>[          ]" ,1,2,3,4);




if (mFloor(%speed+1.15) > %obj.getDatablock().minContrailSpeed)
{
%obj.mountImage(F22AContrailImage1,3);
%obj.mountImage(F22AContrailImage2,4);
}
else
{
%obj.unMountImage(3);
%obj.unMountImage(4);
}
     // if(%obj.speed < 145)
         // %obj.setVelocity(vectorScale(%obj.getVelocity(),1.03));
if(%obj.boost == true)
{

      %obj.applyimpulse(%obj.gettransform(),vectorScale(%obj.getVelocity(),3.65)); //1.45
%obj.mountImage(F22AAfterBurnerImage1,1);
%obj.mountImage(F22AAfterBurnerImage2,2);
}
else
{
%obj.unMountImage(1);
%obj.unMountImage(2);
if((%obj.speed >= 165))
    %obj.applyimpulse(%obj.gettransform(),vectorScale(%obj.getVelocity(),-4.0)); //-0.066
}
schedule(100,0,"F22ASpeedCheck",%obj);


}
« Last Edit: November 04, 2016, 05:14:08 PM by kez »

you can mount modeless bots that have images mounted to them to get around the limit

you can mount modeless bots that have images mounted to them to get around the limit
Wait so can you mount bots that automatically spawn with a light on? in the vehicle?

Wait so can you mount bots that automatically spawn with a light on? in the vehicle?
yea

tank is an example

you can mount modeless bots that have images mounted to them to get around the limit
How would I go about doing this?



Use mount points 0-3, not 1-4

Use mount points 0-3, not 1-4
That was one of the things I tried. It'll work, but it'll always mount the driver to mount0. You can't change that, as far as I know.

Were you ever able to fix the issue?
Swollow wrote a script to bypass it. I edited it to also play an engine loop sound.
Here you go.
It's in three parts, read the comments to know where to put them.

I'd hate to bump this, but I'm still having trouble. I got the code to work, but it does nothing ingame. I'm still missing both contrails on my jet.

here's my code:

Quote
datablock playerData(emptyPlayer : PlayerStandardArmor)

{

        shapeFile = "base/data/shapes/empty.dts";

        boundingBox = "0.01 0.01 0.01";

        deathSound = "";

        painSound = "";

        useCustomPainEffects = true;

        mountSound = "";

};

datablock ShapeBaseImageData(F22AContrailImage)
{
   shapeFile = "base/data/shapes/empty.dts";
   emap = false;

   mountPoint = 0;
   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]               = F22AContrailEmitter;
   stateEmitterTime[1]            = 10000;

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

package F22AContrail
{
   function F22AContrail(%set)
   {
           %veh = %set.veh;
           if(isObject(%veh) && vectorLen(%veh.getVelocity()) > 0.6)
                   %Contrail = 1;
           else
                   %Contrail = 0;
           if(!%Contrail)
           {
         %i = %set.getCount();
                   if(%i > 0)
                   {
                           while(%i-->=0)
                                   %set.getObject(%i).delete();                       
                           %set.contrail = 0;
                   }
           }
           else if(!%set.contrail)
           {
         %set.contrail = 1;
                   for(%i=0;%i<2;%i++)
                   {
                           %ai = new aiPlayer()
                           {
                                   datablock = emptyPlayer;
                                   position = %veh.getPosition();
                           };
                           %veh.mountObject(%ai,%i+1);
                           %set.add(%ai);
                           %ai.mountImage(F22AContrailImage,0);
                   }
           }
           if(!isObject(%veh))
                   return;
           schedule(2000,0,F22AContrail,%set);
   }
   function Armor::onMount(%db,%pl,%obj,%node)
        {
                if(%db.getName() $= emptyPlayer)
                        return;
                return parent::onMount(%db,%pl,%obj,%node);
        }
};
activatePackage(F22AContrail);

I followed the inscructions listed on the link you sent, and still nothing works.

Where is F22AContrail called?