Author Topic: Emitters not showing up for other players but works for host.  (Read 774 times)



https://pastebin.com/ukg8Dr87

The emitters are working for me but not showing up for other players.

Not sure what is causing this.

The light works fine though.



I just edited the script to cut out the bullstuff and make it basically almost similar to Swollow's script. Yet the emitter still isn't showing to other players.

Code: [Select]
ForceRequiredAddOn("Weapon_Gun");
datablock AudioProfile(swol_torchIgniteSound)
{
   filename    = "./torchIgnite.wav";
   description = AudioClosest3d;
   preload = true;
};
datablock AudioProfile(swol_torchEndSound)
{
   filename    = "./torchEnd.wav";
   description = AudioClosest3d;
   preload = true;
};
datablock AudioProfile(swol_torchLoopSound)
{
   filename    = "./torchLoop.wav";
   description = AudioClosestLooping3d;
   preload = true;
};



datablock fxLightData(swol_torchLight)
{
lightOn = true;
radius = 5;
brightness = 10;
color = "1 0.4 0 1";
FlareOn = true;
FlareTP = true;
FlareColor = "1 0 0";
ConstantSize = 1;
NearSize = 1;
FarSize = 0.5;
NearDistance = 10.0;
FarDistance = 30.0;
FadeTime = 0.01;
AnimBrightness = true;
AnimRadius = true;
LinkFlare = true;
LinkFlareSize = true;
MinColor = "1 1 0";
MaxColor = "0 0 1";
MinBrightness = 1.1;
MaxBrightness = 2.1;
MinRadius = 9;
MaxRadius = 10;
StartOffset = "-5 0 0";
EndOffset = "5 0 0";
MaxRotation = 359;
SingleColorKeys = true;
RedKeys = "AAAAAAA";
GreenKeys = "DHSFJYJ";
BlueKeys = "ZZZZZZZ";
BrightnessKeys = "AADGDDGDAADGGDGCA";
RadiusKeys = "ABDGDDGDBADGGAGCA";
OffsetKeys = "AZAAAAA";
RotationKeys = "AZAAAAA";
ColorTime = 1;
BrightnessTime = 1;
RadiusTime = 1;
OffsetTime = 1;
RotationTime = 1;
LerpBrightness = true;
};
datablock ParticleData(swol_torchFireParticle)
{
dragCoefficient = 1;
gravityCoefficient = -1.2;
inheritedVelFactor = 0;
constantAcceleration = 0;
lifetimeMS         = 400;
lifetimeVarianceMS = 200;
textureName = "base/data/particles/cloud";
spinSpeed     = 0;
spinRandomMin = -20;
spinRandomMax = 20;
colors[0] = "1 1 0.25 0.4";
colors[1] = "1 0.7 0.25 0.8";
colors[2] = "1 0 0 0";
sizes[0] = 0.1;
sizes[1] = 0.35;
sizes[2] = 0.2;
times[1] = 0.3;
times[2] = 1;
useInvAlpha = true;
};
datablock ParticleEmitterData(swol_torchFireEmitter)
{
ejectionPeriodMS = 4;
periodVarianceMS = 0;
velocityVariance = 0;
ejectionVelocity = 0;
ejectionOffset   = 0.11;
thetaMin         = 0;
thetaMax         = 180;
phiReferenceVel = 0;
phiVariance     = 360;
overrideAdvance = false;
lifetimeMS = 0;
particles = swol_torchFireParticle;
};
datablock ParticleData(swol_torchSmokeParticle)
{
dragCoefficient = 2;
gravityCoefficient = -0.8;
inheritedVelFactor = 0;
constantAcceleration = 0;
lifetimeMS         = 400;
lifetimeVarianceMS = 200;
textureName = "base/data/particles/cloud";
spinSpeed     = 0;
spinRandomMin = -20;
spinRandomMax = 20;
colors[0] = "0.4 0.4 0.4 0.2";
colors[1] = "0.6 0.5 0.3 0.3";
colors[2] = "0.3 0.3 0.3 0";
sizes[0] = 0.1;
sizes[1] = 0.35;
sizes[2] = 0.2;
times[1] = 0.3;
times[2] = 1;
useInvAlpha = true;
};
datablock ParticleEmitterData(swol_torchSmokeEmitter)
{
ejectionPeriodMS = 4;
periodVarianceMS = 0;
velocityVariance = 0.4;
ejectionVelocity = 0;
ejectionOffset   = 0.11;
thetaMin         = 0;
thetaMax         = 180;
phiReferenceVel = 0;
phiVariance     = 360;
overrideAdvance = false;
lifetimeMS = 0;
particles = swol_torchSmokeParticle;
};





//////////
// item //
//////////
datablock ItemData(torchItem)
{
   category = "Weapon";  // Mission editor category
   className = "Weapon"; // For inventory system

    // Basic Item Properties
   shapeFile = "./Torch.dts";
   mass = 1;
   density = 0.2;
   elasticity = 0.2;
   friction = 0.6;
   emap = true;

   //gui stuff
   uiName = "Torch";
   iconName = "./icon_torch";
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";

    // Dynamic properties defined by the scripts
   image = swol_torchImage;
   canDrop = true;
};


datablock shapeBaseImageData(swol_torchImage)
{
   className = "WeaponImage";
   shapeFile = "./torch.dts";
   emap = true;
   mountPoint = 0;
   offset = "0 0 0";
   item = "";
   
   doColorShift = true;
   colorShiftColor = "0.37 0.25 0.1 1";
   melee = true;
   armReady = true;
   
   eyeOffset = "0.7 1.4 -0.8";
   eyeOffset = "";
   rotation = "0 0 0 180";
   eyeRotation = "0 0 0 0";
   

   stateTimeoutValue[0]         = 0.1;
   stateTransitionOnTimeout[0]    = "Ignite";
   
   stateName[1]               = "Ignite";
   stateScript[1]               = "onIgnite";
   stateTimeoutValue[1]         = 0.2;
   stateEmitter[1]               = gunFlashEmitter;
   stateEmitterTime[1]            = 0.1;
   stateTransitionOnTimeout[1]      = "FireA";



   stateName[2]               = "FireA";
   stateTimeoutValue[3]         = 1000;
   stateEmitter[2]               = swol_torchFireEmitter;
   stateEmitterTime[2]            = 10000;
   stateTransitionOnTimeout[3]      = "FireB";


   
   stateName[3]               = "FireB";
   stateTimeoutValue[3]         = 0.01;
   stateEmitter[3]               = swol_torchFireEmitter;
   stateEmitterTime[3]            = 1000;
   stateTransitionOnTimeout[3]      = "FireA";


};
datablock shapeBaseImageData(swol_torchImageEnd)
{
   className = "WeaponImage";
   shapeFile = "./torch.dts";
   emap = true;
   mountPoint = 0;
   offset = "-0.008 0.01 -0.13";
   item = "";
   
   
   doColorShift = true;
   colorShiftColor = "0.37 0.25 0.1 1";
   
   armReady = true;
   
   eyeOffset = "0.7 1.4 -0.8";
   eyeOffset = "";
   rotation = "0 0 0 180";
   eyeRotation = "0 0 0 0";
   
   stateName[0]               = "Ready";
   stateTimeoutValue[0]         = 0.1;
   stateTransitionOnTimeout[0]    = "FireA";
   
   stateName[2]               = "FireA";
   stateTimeoutValue[3]         = 1.2;
   stateEmitter[2]               = swol_torchSmokeEmitter;
   stateEmitterTime[2]            = 1.2;
   stateTransitionOnTimeout[2]      = "Done";
   
   stateName[3]               = "Done";
};



function swol_torchImage::onMount(%db,%pl,%slot)
{
if(%im = %pl.getMountedImage(0))
{
if(%im.armReady)
{
%pl.playThread(1,armReadyBoth);
}
else
{
%pl.playThread(1,armReadyLeft);
}
}
else
{
%pl.playThread(1,armReadyLeft);
}
%pl.lastTorchTime = getSimTime();
}
function swol_torchImage::onIgnite(%db,%pl,%slot)
{
serverPlay3D(swol_torchIgniteSound,%pl.getPosition());
%pl.playThread(3,plant);
%pl.startTorchSched = %db.schedule(150,mountLight,%pl,%slot);
}
function swol_torchImage::mountLight(%db,%pl,%slot)
{
%pl.light = new fxLight()
{
datablock = swol_torchLight;
};
missionCleanup.add(%pl.light);
%pl.light.setTransform(%pl.getPosition());
%pl.light.attachToObject(%pl);
%pl.light.player = %pl;
%pl.playAudio(2,swol_torchLoopSound);
}
function swol_torchImage::putOutTorch(%db,%pl,%slot)
{
if(isObject(%pl.light))
{
%pl.light.delete();
%pl.playAudio(2,swol_torchEndSound);
%pl.schedule(1,mountImage,swol_torchImageEnd,1);
%db.schedule(1800,unMountEnd,%pl,%slot);
%pl.playThread(3,plant);
}
else
{
cancel(%pl.startTorchSched);
}
}
function swol_torchImage::unMountEnd(%db,%pl,%slot)
{
if(%im = %pl.getMountedImage(1))
{
if(%im == nameToId(swol_torchImageEnd))
{
%pl.unMountImage(1);
%pl.playThread(1,root);
if(%im = %pl.getMountedImage(0))
{
if(%im.armReady)
{
%pl.playThread(1,armReadyRight);
}
}
}
}
}
function swol_torchImage::unMountCheck(%db,%pl,%slot)
{
if(!isObject(%pl.getMountedImage(0)))
%pl.playThread(1,armReadyLeft);
}
function swol_torchImageEnd::unMountCheck(%db,%pl,%slot)
{
if(!isObject(%pl.getMountedImage(0)))
%pl.playThread(1,armReadyLeft);
}
function swol_torchImage::onUnMount(%db,%pl,%slot)
{
if(isObject(%pl.light))
{
%pl.light.delete();
%pl.playAudio(2,swol_torchEndSound);
}
else
{
cancel(%pl.startTorchSched);
}
%pl.lastTorchTime = getSimTime();

}
package swol_torchLightReplace
{
function player::updateArm(%pl,%image)
{
if(!%leftimage = %pl.getMountedImage(1))
return parent::updateArm(%pl,%image);
if(!%leftimage.isLeftHandLight && !%leftimage.leftHandKeepUp)
return parent::updateArm(%pl,%image);
if(%image.armReady)
{
if(!isObject(%pl.getMountedImage(0)))
%pl.playThread(1,armReadyBoth);
}
}
function WeaponImage::onUnMount(%db,%pl,%slot)
{
if(%slot != 0)
return parent::onUnMount(%db,%pl,%slot);
if(!%leftimage = %pl.getMountedImage(1))
return parent::onUnMount(%db,%pl,%slot);
if(!%leftimage.isLeftHandLight && !%leftimage.leftHandKeepUp)
return parent::onUnMount(%db,%pl,%slot);
%leftimage.schedule(1,unMountCheck,%pl,%slot);
if(%db.showBricks)
{
if(isObject(%cl = %pl.client))
commandToClient(%cl,'ShowBricks',0);
}
}
function player::hideNode(%pl,%node)
{
if(%node $= "lhook" || %node $= "lhand")
{
if(isObject(%im = %pl.getMountedImage(1)))
{
if(%im.isLeftHandLight)
{
%pl.unMountImage(1);
%pl.playThread(2,root);
}
}
}
parent::hideNode(%pl,%node);
}
function serverCmdLight(%cl)
{
if(!isObject(%pl = %cl.player))
return parent::serverCmdLight(%cl);
if(isObject(%im = %pl.getMountedImage(0)))
{
if(isObject(%im.item))
{
if(%im.item $= ND_Item)
return parent::serverCmdLight(%cl);
}
}

if(!isObject(%im = %pl.getMountedImage(1)))
{
if(getSimTime()-%pl.lastTorchTime > 2500)
{
if(%pl.isNodeVisible("lhand")+%pl.isNodeVisible("lhook") > 0)
%pl.mountImage(swol_torchImage,1);
}
}
else if(%im == nameToId(swol_torchImage))
{
if(getSimTime()-%pl.lastTorchTime > 1100)
{
swol_torchImage.putOutTorch(%pl,1);
}
}
}
};


function servercmdlight(%a, %b){}
« Last Edit: October 23, 2018, 11:12:19 PM by King Tøny »

I think the problem is that Swollow's torch counted as a light while my edit makes it count as a weaponimage. So his emitters probably weren't made for that.

But this is the script I use with other items to add emitters and sounds and I know it works.

I just don't know how to use it with swollow's state script properly.

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

  stateName[0] = "Fire";
  stateTransitionOnTimeout[0] = "Fire";
  stateWaitForTimeout[0] = true;
  stateTimeoutValue[0] = 1000;
  stateEmitter[0] = gemShimmerEmitter;
  stateEmitterTime[0] = 1000;
};





//////////////////////////////////////////////////////////



// Gems Item Datas

//emerald

function RPGxEmeraldItem::onAdd(%this, %obj)
{
%obj.mountImage(gemShimmerImage,0);
 %obj.playAudio(0, GemsparkleSound);
Parent::onAdd(%this, %obj);
}

function RPGxEmeraldImage::onMount(%this, %obj, %slot)
{   
    %obj.mountImage(gemShimmerImage,1);
    Parent::onMount(%this, %obj, %slot);
}

function RPGxEmeraldImage::onUnMount(%this, %obj, %slot)
{
    %obj.unMountImage(1);
    %obj.stopAudio(0);
    Parent::onUnMount(%this, %obj, %slot);
}
« Last Edit: October 23, 2018, 11:14:05 PM by King Tøny »

https://www.mediafire.com/file/7etwc97s7ljqd7h/Item_Torch.zip/file

Here is the new script I am working on. This is guaranteed to get the emitters to show up for other players.

The only issue is I can't figure out how to ignite the torch which will mount the light and emitter.


I almost had the loving script down in the original post but emitters wouldn't show for other players. I was so close.

I'm about to give up I'm not sure why the emitter doesn't show.


Dunno what's wrong with your emitters.  The mediafire link seems to be broken, so I don't have your latest version.  But I did spot some problems w/ your states for swol_torchImage in the code you posted here.

Quote
datablock shapeBaseImageData(swol_torchImage)
{
   className = "WeaponImage";
   shapeFile = "./torch.dts";
   emap = true;
   mountPoint = 0;
   offset = "0 0 0";
   item = "";
   
   doColorShift = true;
   colorShiftColor = "0.37 0.25 0.1 1";
   melee = true;
   armReady = true;
   
   eyeOffset = "0.7 1.4 -0.8";
   eyeOffset = "";
   rotation = "0 0 0 180";
   eyeRotation = "0 0 0 0";
   
   stateName[0]  = "Activate";
   stateTimeoutValue[0]         = 0.1;
   stateTransitionOnTimeout[0]    = "Ignite";
   
   stateName[1]               = "Ignite";
   stateScript[1]               = "onIgnite";
   stateTimeoutValue[1]         = 0.2;
   stateEmitter[1]               = gunFlashEmitter;
   stateEmitterTime[1]            = 0.1;
   stateTransitionOnTimeout[1]      = "FireA";



   stateName[2]               = "FireA";
   stateTimeoutValue[32]         = 1000;
   stateEmitter[2]               = swol_torchFireEmitter;
   stateEmitterTime[2]            = 10000;
   stateTransitionOnTimeout[32]      = "FireB";


   
   stateName[3]               = "FireB";
   stateTimeoutValue[3]         = 0.01;
   stateEmitter[3]               = swol_torchFireEmitter;
   stateEmitterTime[3]            = 1000;
   stateTransitionOnTimeout[3]      = "FireA";


};

These errors may be present in other image datablocks as well. It looks like someone's been copy-pasting too much.

Oh hey it's working now, thanks a lot for the help.

I can't believe I overlooked that.