Author Topic: Lego Jack Hammer  (Read 888 times)

My JackHammer has major flaws, I can fix some of them, but others I can't. Mainly the ones that deal with the script, here are the flaws.
1. The Jack Hammer is red and not grey+peach

^How it should look^

^How it looks ingame^

2. The I can't make the hands dissapear(don't worry about the way he holds it, I know how to fix that.)


3. The animation doesn't play

Can someone tell me how to fix these?
« Last Edit: August 27, 2009, 02:00:24 PM by Blockbuilder321 »

You probably have colorshiftcolor set to true and messed up mount points. The hands are unnessicary and i have pm'd you about help fixing it.

You probably have colorshiftcolor set to true and messed up mount points. The hands are unnessicary and i have pm'd you about help fixing it.
Is it possible to rotate the hands?

Edit: Also forgot about animation.
« Last Edit: August 27, 2009, 02:00:57 PM by Blockbuilder321 »

Blender's "vertex paint" does not affect in-game look. Use texture names of colours and then include the relevant files in your Add-On's directory. (e.g. "red", "grey50", "yellow" for solid colours or "blank", "whiteCheck" and the "black##" colours for colours blended to the colorShiftColor.


Idea that may be impossible anyway, just putting it out there: Would it be possible to make an animation for the player to rotate his hands instead of hiding them and recreating the hands in the model? (Thus making hands appear when the model is spawned.)

I suggest asking an experienced blender user (Such as me) who knows what is wrong with the model. Then I/whoever could edit it or tell you what to do so you can fix it yourself. You should also post the code so we can see what is wrong with that.

Blender's "vertex paint" does not affect in-game look. Use texture names of colours and then include the relevant files in your Add-On's directory. (e.g. "red", "grey50", "yellow" for solid colours or "blank", "whiteCheck" and the "black##" colours for colours blended to the colorShiftColor.

Thanks!

I suggest asking an experienced blender user (Such as me) who knows what is wrong with the model. Then I/whoever could edit it or tell you what to do so you can fix it yourself. You should also post the code so we can see what is wrong with that.

OK, I'll pm you .blend file and here is code:

Code: [Select]
datablock AudioProfile(legojackhammerRevUSound)
{
   filename    = "./up.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(legojackhammerRevDSound)
{
   filename    = "./down.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(legojackhammerHitSound)
{
   filename    = "./fire.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(legojackhammerShootSound)
{
   filename    = "./thrust.wav";
   description = AudioClose3d;
   preload = true;
};

datablock ParticleData(legojackhammerSmokeParticle)
{
dragCoefficient      = 4;
gravityCoefficient   = -1.0;
inheritedVelFactor   = 0.2;
constantAcceleration = 0.0;
lifetimeMS           = 425;
lifetimeVarianceMS   = 55;
textureName          = "base/data/particles/cloud";
spinSpeed = 10.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0]     = "0.5 0.5 0.5 0.1";
colors[1]     = "0.5 0.5 0.5 0.0";
sizes[0]      = 0.55;
sizes[1]      = 0.75;

useInvAlpha = false;
};
datablock ParticleEmitterData(legojackhammerSmokeEmitter)
{
   ejectionPeriodMS = 10;
   periodVarianceMS = 0;
   ejectionVelocity = -4.0;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "legojackhammerSmokeParticle";
};

datablock ExplosionData(legojackhammerExplosion : hammerExplosion)
{
soundProfile = legojackhammerHitSound;

   impulseRadius = 1;
   impulseForce = 200;
};

AddDamageType("legoJackhammerDirect",   '<bitmap:add-ons/Weapon_Legojackhammer/hammer> %1',    '%2 <bitmap:add-ons/Weapon_Legojackhammer/hammer> %1',1,2);

datablock ProjectileData(jackhammerProjectile)
{
//   projectileShapeName = "./empty.dts";
   directDamage        = 75;
   directDamageType    = $DamageType::legoJackhammerDirect;
   radiusDamageType    = $DamageType::legoJackhammerDirect;

   brickExplosionRadius = 2;
   brickExplosionImpact = true;          //destroy a brick if we hit it directly?
   brickExplosionForce  = 14;
   brickExplosionMaxVolume = 42;          //max volume of bricks that we can destroy
   brickExplosionMaxVolumeFloating = 50;  //max volume of bricks that we can destroy if they aren't connected to the ground

   explosion           = legojackhammerExplosion;
   impactImpulse      = 680;
   verticalImpulse   = 300;

   muzzleVelocity      = 60;
   velInheritFactor    = 1;

   armingDelay         = 00;
   lifetime            = 80;
   fadeDelay           = 00;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = false;
   gravityMod = 0.0;

   hasLight    = false;
   lightRadius = 3.0;
   lightColor  = "0 0 0.5";
};

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

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

//gui stuff
uiName = "Lego_Jackhammer";
iconName = "./icon_legojackhammer";

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


////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(legojackhammerImage)
{
   // Basic Item properties
   shapeFile = "./legojackhammer.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset = "0.0 1.4 -0.60";
   rotation = eulerToMatrix( "0 0 0" );

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = true;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = BowItem;
   ammo = " ";
   projectile = legojackhammerProjectile;
   projectileType = Projectile;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;
   LarmReady = false;

   //casing = " ";

   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0]                    = "Activate";
stateTimeoutValue[0]            = 0.15;
stateSequence[0]                = "Ready";
stateTransitionOnTimeout[0]     = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1]                    = "Ready";
stateTransitionOnTriggerDown[1] = "Spinup";
stateAllowImageChange[1]        = true;

stateName[2]                    = "Spinup";
stateAllowImageChange[2]        = false;
stateTransitionOnTimeout[2]     = "Fire";
stateTimeoutValue[2]            = 1.00;
stateWaitForTimeout[2] = true;
stateSound[2] = legojackhammerRevDSound;
stateSequence[2] = "Readyup";
stateTransitionOnTriggerUp[2]   = "Slow2";
//stateSequenceOnTimeout[2] = "Spin";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "Check";
stateTimeoutValue[3]            = 0.16;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;
stateEmitterNode[3] = "muzzleNode";
stateSound[3] = legojackhammerShootSound;

stateName[4] = "Smoke";
stateEmitter[4] = legojackhammerSmokeEmitter;
stateEmitterTime[4] = 0.01;
stateEmitterNode[4] = "muzzleNode";
stateTimeoutValue[4]            = 0.01;
stateTransitionOnTimeout[4]     = "Check";

stateName[5] = "Check";
stateTransitionOnTriggerUp[5]   = "Slow";
stateTransitionOnTriggerDown[5] = "Fire";

stateName[6] = "Slow";
stateSequence[6]                = "readydown";
stateEmitter[6] = legojackhammerSmokeEmitter;
stateEmitterTime[6] = 1.40;
stateSound[6] = legojackhammerRevUSound;
stateEmitterNode[6] = "muzzleNode";
stateAllowImageChange[6]        = false;
stateTransitionOnTimeout[6]     = "Ready";
stateTimeoutValue[6]            = 1.00;
stateWaitForTimeout[6] = true;

stateName[7] = "Slow2";
stateSequence[7]                = "readydown";
stateAllowImageChange[7]        = false;
stateTransitionOnTimeout[7]     = "Ready";
stateTimeoutValue[7]            = 0.40;
stateWaitForTimeout[7] = true;
};

function jackhammerImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this,%obj,%slot);
%obj.playThread(0, armreadynone);
}

function jackhammerImage::onUnMount(%this,%obj,%slot)
{
Parent::onMount(%this,%obj,%slot);
%obj.playThread(0, root);
}
[/size]