Blockland Forums > Modification Help

Using emote instead of creating?

Pages: (1/2) > >>

LeetZero:

Currently the script (s) I am using for my itmes create a spammy amount of emmiters and datablocks.
Because I currently use a single "base script" which creates a emote for all.

How can I make it so it USES the emote instead of CREATING and USING it?

Here's the code I am using for Hamburger:

--- Code: --- //fpHamburger.cs

//audio
datablock AudioProfile(EatSound)
{
   filename    = "./Eat.wav";
   description = AudioClose3d;
   preload = true;
};

datablock ParticleData(fpHamburgereatParticle)
{
   dragCoefficient      = 5.0;
   gravityCoefficient   = -0.2;
   inheritedVelFactor   = 0.0;
   constantAcceleration = 0.0;
   lifetimeMS           = 1000;
   lifetimeVarianceMS   = 500;
   useInvAlpha          = false;
   textureName          = "./eat";
   colors[0]     = "1.0 1.0 1.0 1";
   colors[1]     = "1.0 1.0 1.0 1";
   colors[2]     = "0.0 0.0 0.0 0";
   sizes[0]      = 0.4;
   sizes[1]      = 0.6;
   sizes[2]      = 0.4;
   times[0]      = 0.0;
   times[1]      = 0.2;
   times[2]      = 1.0;
};

datablock ParticleEmitterData(fpHamburgereatEmitter)
{
   ejectionPeriodMS = 35;
   periodVarianceMS = 0;
   ejectionVelocity = 0.5;
   ejectionOffset   = 1.0;
   velocityVariance = 0.49;
   thetaMin         = 0;
   thetaMax         = 120;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "fpHamburgereatParticle";

   uiName = "Emote - eat";
};

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

mountPoint = $HeadSlot;

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

stateName[1] = "FireA";
stateTransitionOnTimeout[1] = "Done";
stateWaitForTimeout[1] = True;
stateTimeoutValue[1] = 0.350;
stateEmitter[1] = fpHamburgereatEmitter;
stateEmitterTime[1] = 0.350;
stateSound[1] = EatSound;

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

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

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

//gui stuff
uiName = "Hamburger";
iconName = "./Icon_fpHamburger";
doColorShift = false;

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

datablock ShapeBaseImageData(fpHamburgerImage)
{
   // Basic Item properties
   shapeFile = "./fpHamburger.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "-.05 0 0";
   eyeOffset = 0; //"0.7 1.2 -0.5";
   rotation = eulerToMatrix( "-90 90 0" );

   className = "WeaponImage";
   item = fpHamburgerItem;

   //raise your arm up or not
   armReady = true;

   doColorShift = false;

   // Initial start up state
stateName[0]                     = "Ready";
stateTransitionOnTriggerDown[0]  = "Fire";
stateAllowImageChange[0]         = true;

stateName[1]                     = "Fire";
stateTransitionOnTimeout[1]      = "Ready";
stateAllowImageChange[1]         = true;
  stateScript[1]                   = "onFire";
stateTimeoutValue[1]    = 1;
stateSound[1] = EatSound;
};

function fpHamburgerImage::onFire(%this,%obj,%slot)
{


for(%i=0;%i<5;%i++)
{
%toolDB = %obj.tool[%i];
if(%toolDB $= %this.item.getID())
{
%obj.addhealth(65);
%obj.emote(fpHamburgereatImage);
%obj.tool[%i] = 0;
%obj.weaponCount--;
messageClient(%obj.client,'MsgItemPickup','',%i,0);
serverCmdUnUseTool(%obj.client);
break;
}
}
}

package fpHamburgerPackage
{
   function Armor::onCollision(%this, %obj, %col, %thing, %other)
   {
  if(%col.dataBlock $= "fpHamburgerItem" && %col.pickupNow !$= 1)
  {
if(!isObject(%col.spawnbrick))   
{
if((%obj.getDamageLevel() >= 1))
{
   %obj.setDamageLevel(0);
   %obj.emote(fpHamburgereatImage);
   %col.delete();
}
else
   %col.pickupNow = 1;
return;
}
  }
  Parent::onCollision(%this, %obj, %col, %thing, %others);
   }
};
activatePackage(fpHamburgerPackage);
--- End code ---

Help appreciated, if you are able to help you will also receive credit in the final "product".

LeetZero:

Bump.

Deathwish:

Uh, what exactly is wrong with this script. You haven't exactly been clear about what's wrong.

LeetZero:


--- Quote from: Deathwish on December 21, 2010, 12:59:47 PM ---Uh, what exactly is wrong with this script. You haven't exactly been clear about what's wrong.

--- End quote ---

... The script creates emotes, spamming datablocks and emmiter wrench section.
How can I use it so it uses a emote instead?

Deathwish:

If you don't want them to appear on the lists in wrench events, take the uiName's out the datablocks, if that's what you mean.

Pages: (1/2) > >>

Go to full version