I am making a postal 2 kick thingy and I have no clue how to make it so when i press left click, the model appears, then a certain body part (right leg) hides itself and after the kick is done the leg appears and the model is hidden untill i fire the "weapon" again
//effects
datablock AudioProfile(kickfire)
{
filename = "./kickmiss.wav";
description = AudioClose3d;
preload = true;
};
datablock AudioProfile(kickhit)
{
filename = "./kickhit.wav";
description = AudioClose3d;
preload = true;
};
datablock ParticleData(pushBroomSparkParticle)
{
dragCoefficient = 4;
gravityCoefficient = 1;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 400;
lifetimeVarianceMS = 300;
textureName = "base/data/particles/chunk";
useInvAlpha = false;
spinSpeed = 150.0;
spinRandomMin = -150.0;
spinRandomMax = 150.0;
colors[0] = "0.30 0.10 0.0 0.0";
colors[1] = "0.30 0.10 0.0 0.5";
colors[2] = "0.30 0.10 0.0 0.0";
sizes[0] = 0.15;
sizes[1] = 0.15;
sizes[2] = 0.15;
times[0] = 0.1;
times[1] = 0.5;
times[2] = 1.0;
useInvAlpha = true;
};
datablock ParticleEmitterData(pushBroomSparkEmitter)
{
lifeTimeMS = 10;
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 5;
velocityVariance = 3.0;
ejectionOffset = 1.50;
thetaMin = 0;
thetaMax = 90;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = pushBroomSparkParticle;
uiName = "Push Broom Chunk";
};
datablock ParticleData(pushBroomExplosionParticle)
{
dragCoefficient = 10;
gravityCoefficient = -0.15;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 800;
lifetimeVarianceMS = 500;
textureName = "base/data/particles/cloud";
spinSpeed = 50.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0] = "1.0 1.0 1.0 0.25";
colors[1] = "0.0 0.0 0.0 0.0";
sizes[0] = 0.5;
sizes[1] = 1.0;
useInvAlpha = true;
};
datablock ParticleEmitterData(pushBroomExplosionEmitter)
{
lifeTimeMS = 50;
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 10;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 95;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = pushBroomExplosionParticle;
uiName = "Push Broom Dust";
emitterNode = HalfEmitterNode;
};
datablock ExplosionData(pushBroom2Explosion)
{
//explosionShape = "";
lifeTimeMS = 10;
//emitter[0] = pushBroomExplosionEmitter;
emitter[0] = pushBroomSparkEmitter;
particleEmitter = pushBroomExplosionEmitter;
particleDensity = 15;
particleRadius = 0.5;
faceViewer = true;
explosionScale = "1 1 1";
soundProfile = kickhit;
shakeCamera = false;
cameraShakeFalloff = false;
camShakeFreq = "2.0 3.0 1.0";
camShakeAmp = "1.0 1.0 1.0";
camShakeDuration = 2.5;
camShakeRadius = 0.0001;
// Dynamic light
lightStartRadius = 0;
lightEndRadius = 0;
lightStartColor = "0.0 0.0 0.0";
lightEndColor = "0 0 0";
};
//audio
datablock AudioProfile(shotgunReloadSound)
{
filename = "./shotgunReload.wav";
description = AudioClose3d;
preload = true;
};
//shell
datablock DebrisData(shotgunShellDebris)
{
shapeFile = "./shotgunShell.dts";
lifetime = 2.0;
minSpinSpeed = -400.0;
maxSpinSpeed = 200.0;
elasticity = 0.5;
friction = 0.2;
numBounces = 3;
staticOnMaxBounce = true;
snapOnMaxBounce = false;
fade = true;
gravModifier = 2;
};
//emitter
datablock ParticleData(shotgunSmokeParticle)
{
dragCoefficient = 3;
gravityCoefficient = -0.5;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 525;
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.5";
colors[1] = "0.5 0.5 0.5 0.0";
sizes[0] = 0.15;
sizes[1] = 0.1;
useInvAlpha = false;
};
datablock ParticleEmitterData(shotgunSmokeEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 1.0;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 90;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = "shotgunSmokeParticle";
};
AddDamageType("Shotgun", '<bitmap:add-ons/Weapon_Shotgun/CI_shotgun> %1', '%2 <bitmap:add-ons/Weapon_Shotgun/CI_shotgun> %1',0.5,1);
datablock ProjectileData(shotgunProjectile)
{
//projectileShapeName = "~/data/shapes/arrow.dts";
directDamage = 10;
impactImpulse = 500;
verticalImpulse = 500;
explosion = pushBroom2Explosion;
//particleEmitter = as;
muzzleVelocity = 50;
velInheritFactor = 1;
armingDelay = 0;
lifetime = 100;
fadeDelay = 70;
bounceElasticity = 0;
bounceFriction = 0;
isBallistic = false;
gravityMod = 0.0;
hasLight = false;
lightRadius = 3.0;
lightColor = "0 0 0.5";
uiName = "Kick Test";
};
//////////
// item //
//////////
datablock ItemData(shotgunItem)
{
category = "Weapon"; // Mission editor category
className = "Weapon"; // For inventory system
// Basic Item Properties
shapeFile = "./shotgun.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
//gui stuff
uiName = "Kick";
iconName = "./shotgunIcon";
doColorShift = true;
colorShiftColor = "0.5 0.5 0.5 1.000";
// Dynamic properties defined by the scripts
image = shotgunImage;
canDrop = true;
};
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(shotgunImage)
{
// Basic Item properties
shapeFile = "./Kick.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.4 2.9 -0.45";
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 = shotgunItem;
ammo = " ";
projectile = shotgunProjectile;
projectileType = Projectile;
casing = shotgunShellDebris;
shellExitDir = "1.0 0.1 1.0";
shellExitOffset = "0 0 0";
shellExitVariance = 10.0;
shellVelocity = 5.0;
//melee particles shoot from eye node for consistancy
melee = true;
//raise your arm up or not
armReady = false;
minShotTime = 1000;
doColorShift = true;
colorShiftColor = shotgunItem.colorShiftColor;
// 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;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = weaponSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateTimeoutValue[1] = 0.01;
stateName[2] = "Fire";
stateTransitionOnTimeout[2] = "Smoke";
stateTimeoutValue[2] = 0.5;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
stateScript[2] = "onFire";
stateWaitForTimeout[2] = true;
// stateEmitter[2] = gunFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = kickfire;
stateTransitionOnTimeout[2] = "Smoke";
stateName[3] = "Smoke";
// stateEmitter[3] = shotgunSmokeEmitter;
// stateEmitterTime[3] = 0.1;
// stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3] = 0.4;
stateTransitionOnTimeout[3] = "Ready";
// stateName[4] = "Reload";
// stateTimeoutValue[4] = 0.3;
// stateSequence[4] = "reload";
// stateTransitionOnTimeout[4] = "Wait";
// stateWaitForTimeout[4] = true;
// stateEjectShell[4] = true;
// stateSound[4] = shotgunReloadSound;
// stateName[5] = "Wait";
// stateTimeoutValue[5] = 0.1;
// stateTransitionOnTimeout[5] = "Ready";
};
function shotgunImage::onFire(%this,%obj,%slot)
{
if((%obj.lastFireTime+%this.minShotTime) > getSimTime())
return;
%obj.lastFireTime = getSimTime();
%obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%obj.client.player.getEyeVector(),"-3")));
%obj.playThread(2, shiftAway);
%projectile = %this.projectile;
%spread = 0.0015;
%shellcount = 3;
for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);
%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}
function shotgunImage::onMount(%this, %obj, %slot)
{
%obj.hidenode("Rshoe");
}
function shotgunImage::onUnMount(%this, %obj, %slot)
{
%obj.unhidenode("Rshoe");
}
function shotgunImage::onMount(%this, %obj, %slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.playThread(1, armreadyboth);
}
function shotgunImage::onUnMount(%this, %obj, %slot)
{
Parent::onUnMount(%this, %obj, %slot);
}