When I'm testing my turret out so far, it gives me this ooonnneee little error:
Add-Ons/Vehicle_WMJ/WarMonster_Turret.cs (0): preload failed for WarMonsterTurretDts: Missing sequence .WMT_root.dsq wrench for Add-Ons/Vehicle_WMJ/WarMonsterTurret.dts.
Even though I have it in the script.
sequence35 = ".WMT_root.dsq wrench";
What am I doing wrong?[/s]
Solved. Now it the turret will not appear on the vehicle.
datablock TSShapeConstructor(WarMonsterJeepTurretDts)
{
baseShape = "./WarMonsterTurret.dts";
sequence0 = "./WMT_root.dsq root";
sequence1 = "./WMT_root.dsq run";
sequence2 = "./WMT_root.dsq walk";
sequence3 = "./WMT_root.dsq back";
sequence4 = "./WMT_root.dsq side";
sequence5 = "./WMT_root.dsq crouch";
sequence6 = "./WMT_root.dsq crouchRun";
sequence7 = "./WMT_root.dsq crouchBack";
sequence8 = "./WMT_root.dsq crouchSide";
sequence9 = "./WMT_look.dsq look";
sequence10 = "./WMT_root.dsq headside";
sequence11 = "./WMT_root.dsq headUp";
sequence12 = "./WMT_root.dsq jump";
sequence13 = "./WMT_root.dsq standjump";
sequence14 = "./WMT_root.dsq fall";
sequence15 = "./WMT_root.dsq land";
sequence16 = "./WMT_root.dsq armAttack";
sequence17 = "./WMT_root.dsq armReadyLeft";
sequence18 = "./WMT_root.dsq armReadyRight";
sequence19 = "./WMT_root.dsq armReadyBoth";
sequence20 = "./WMT_root.dsq spearready";
sequence21 = "./WMT_root.dsq spearThrow";
sequence22 = "./WMT_root.dsq talk";
sequence23 = "./WMT_root.dsq death1";
sequence24 = "./WMT_root.dsq shiftUp";
sequence25 = "./WMT_root.dsq shiftDown";
sequence26 = "./WMT_root.dsq shiftAway";
sequence27 = "./WMT_root.dsq shiftTo";
sequence28 = "./WMT_root.dsq shiftLeft";
sequence29 = "./WMT_root.dsq shiftRight";
sequence30 = "./WMT_root.dsq rotCW";
sequence31 = "./WMT_root.dsq rotCCW";
sequence32 = "./WMT_root.dsq undo";
sequence33 = "./WMT_root.dsq plant";
sequence34 = "./WMT_root.dsq sit";
sequence35 = "./WMT_root.dsq wrench";
};
datablock AudioProfile(WarMonsterJeepShotSound)
{
filename = "./shot.wav";
description = AudioDefault3d;
preload = true;
};
datablock PlayerData(WarMonsterJeepTurretPlayer)
{
renderFirstPerson = true;
emap = false;
className = Armor;
shapeFile = "./WarMonsterTurret.dts";
cameraMaxDist = 8;
cameraTilt = 0.261;
cameraVerticalOffset = 2.3;
computeCRC = false;
canObserve = true;
cmdCategory = "Clients";
cameraDefaultFov = 90.0;
cameraMinFov = 5.0;
cameraMaxFov = 120.0;
//debrisShapeName = "~/data/player/debris_player.dts";
//debris = horseDebris;
aiAvoidThis = true;
minLookAngle = -1.5708;
maxLookAngle = 1.5708;
maxFreelookAngle = 3.0;
mass = 90;
drag = 0.1;
maxdrag = 0.52;
density = 0.7;
maxDamage = 250;
maxEnergy = 10;
repairRate = 0.33;
energyPerDamagePoint = 75.0;
rechargeRate = 0.4;
runForce = 28 * 90;
runEnergyDrain = 0;
minRunEnergy = 0;
maxForwardSpeed = 12;
maxBackwardSpeed = 6;
maxSideSpeed = 1;
maxForwardCrouchSpeed = 12;
maxBackwardCrouchSpeed = 6;
maxSideCrouchSpeed = 1;
maxForwardProneSpeed = 0;
maxBackwardProneSpeed = 0;
maxSideProneSpeed = 0;
maxForwardWalkSpeed = 0;
maxBackwardWalkSpeed = 0;
maxSideWalkSpeed = 0;
maxUnderwaterForwardSpeed = 8.4;
maxUnderwaterBackwardSpeed = 7.8;
maxUnderwaterSideSpeed = 7.8;
jumpForce = 17 * 90; //8.3 * 90;
jumpEnergyDrain = 0;
minJumpEnergy = 0;
jumpDelay = 0;
minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;
recoverDelay = 0;
recoverRunForceScale = 1.2;
minImpactSpeed = 250;
speedDamageScale = 3.8;
boundingBox = vectorScale("2.5 2.5 1.7", 4);
crouchBoundingBox = vectorScale("2.5 2.5 1.7", 4);
proneBoundingBox = vectorScale("2.5 2.5 1.7", 4);
pickupRadius = 0.75;
// Damage location details
boxNormalHeadPercentage = 0.83;
boxNormalTorsoPercentage = 0.49;
boxHeadLeftPercentage = 0;
boxHeadRightPercentage = 1;
boxHeadBackPercentage = 0;
boxHeadFrontPercentage = 1;
// Foot Prints
//decalData = HorseFootprint;
//decalOffset = 0.25;
jetEmitter = playerJetEmitter;
jetGroundEmitter = playerJetGroundEmitter;
jetGroundDistance = 4;
//footPuffEmitter = LightPuffEmitter;
footPuffNumParts = 10;
footPuffRadius = 0.25;
//dustEmitter = LiftoffDustEmitter;
splash = PlayerSplash;
splashVelocity = 4.0;
splashAngle = 67.0;
splashFreqMod = 300.0;
splashVelEpsilon = 0.60;
bubbleEmitTime = 0.1;
splashEmitter[0] = PlayerFoamDropletsEmitter;
splashEmitter[1] = PlayerFoamEmitter;
splashEmitter[2] = PlayerBubbleEmitter;
mediumSplashSoundVelocity = 10.0;
hardSplashSoundVelocity = 20.0;
exitSplashSoundVelocity = 5.0;
// Controls over slope of runnable/jumpable surfaces
runSurfaceAngle = 85;
jumpSurfaceAngle = 86;
minJumpSpeed = 20;
maxJumpSpeed = 30;
horizMaxSpeed = 68;
horizResistSpeed = 33;
horizResistFactor = 0.35;
upMaxSpeed = 80;
upResistSpeed = 25;
upResistFactor = 0.3;
footstepSplashHeight = 0.35;
//NOTE: some sounds commented out until wav's are available
JumpSound = HorseJumpSound;
// Footstep Sounds
//FootSoftSound = HorseFootFallSound;
//FootHardSound = HorseFootFallSound;
//FootMetalSound = HorseFootFallSound;
//FootSnowSound = HorseFootFallSound;
//FootShallowSound = HorseFootFallSound;
//FootWadingSound = HorseFootFallSound;
//FootUnderwaterSound = HorseFootFallSound;
//FootBubblesSound = FootLightBubblesSound;
//movingBubblesSound = ArmorMoveBubblesSound;
//waterBreathSound = WaterBreathMaleSound;
//impactSoftSound = ImpactLightSoftSound;
//impactHardSound = ImpactLightHardSound;
//impactMetalSound = ImpactLightMetalSound;
//impactSnowSound = ImpactLightSnowSound;
//impactWaterEasy = ImpactLightWaterEasySound;
//impactWaterMedium = ImpactLightWaterMediumSound;
//impactWaterHard = ImpactLightWaterHardSound;
groundImpactMinSpeed = 10.0;
groundImpactShakeFreq = "4.0 4.0 4.0";
groundImpactShakeAmp = "1.0 1.0 1.0";
groundImpactShakeDuration = 0.8;
groundImpactShakeFalloff = 10.0;
//exitingWater = ExitingWaterLightSound;
observeParameters = "0.5 4.5 4.5";
// Inventory Items
maxItems = 10; //total number of bricks you can carry
maxWeapons = 5; //this will be controlled by mini-game code
maxTools = 5;
//uiName = "WarMonsterJeep Turret";
rideable = true;
lookUpLimit = 0.6;
lookDownLimit = 0.4;
canRide = false;
showEnergyBar = false;
paintable = true;
brickImage = horseBrickImage; //the imageData to use for brick deployment
numMountPoints = 1;
mountThread[0] = "root";
//protection for passengers
protectPassengersBurn = true; //protect passengers from the burning effect of explosions?
protectPassengersRadius = true; //protect passengers from radius damage (explosions) ?
protectPassengersDirect = false; //protect passengers from direct damage (bullets) ?
};
datablock ParticleData(WarMonsterJeepSmokeParticle)
{
dragCoefficient = 3;
gravityCoefficient = -1;
inheritedVelFactor = 0.6;
constantAcceleration = 0.0;
lifetimeMS = 850;
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.2";
colors[1] = "0.5 0.5 0.5 0.0";
sizes[0] = 0.6;
sizes[1] = 0.8;
useInvAlpha = true;
};
datablock ParticleEmitterData(WarMonsterJeepSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 4;
ejectionVelocity = 3;
velocityVariance = 2;
ejectionOffset = 0;
thetaMin = 0;
thetaMax = 50;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = "WarMonsterJeepSmokeParticle";
uiName = "WarMonsterJeep Smoke";
};
datablock ShapeBaseImageData(WarMonsterJeepSmokeImage)
{
shapeFile = "base/data/shapes/empty.dts";
emap = false;
mountPoint = 1;
stateName[0] = "Ready";
stateTransitionOnTimeout[0] = "FireA";
stateTimeoutValue[0] = 0.01;
stateName[1] = "FireA";
stateTransitionOnTimeout[1] = "FireB";
stateWaitForTimeout[1] = True;
stateTimeoutValue[1] = 0.05;
stateEmitter[1] = vehicleFinalExplosionEmitter3;
stateEmitterTime[1] = 0.05;
stateName[2] = "FireB";
stateTransitionOnTimeout[2] = "FireC";
stateWaitForTimeout[2] = True;
stateTimeoutValue[2] = 0.05;
stateEmitter[2] = vehicleExplosionEmitter;
stateEmitterTime[2] = 0.05;
stateName[3] = "FireC";
stateTransitionOnTimeout[3] = "Done";
stateWaitForTimeout[3] = True;
stateTimeoutValue[3] = 0.850;
stateEmitter[3] = WarMonsterJeepSmokeEmitter;
stateEmitterTime[3] = 0.850;
stateName[4] = "Done";
stateScript[4] = "onDone";
};
function WarMonsterJeepSmokeImage::onDone(%this,%obj,%slot)
{
%obj.unMountImage(%slot);
}
function Player::rigTurret(%obj)
{
if(%obj.dataBlock !$= WarMonsterJeepTurretPlayer)
return;
if(!isObject(%obj))
return;
%parent = %obj.getObjectMount();
if(!isObject(%parent))
return;
%obj.spawnBrick = %parent.spawnBrick;
%obj.brickGroup = %parent.brickGroup;
}
function WarMonsterJeepVehicle::onRemove(%this,%obj)
{
if(isObject(%obj.turret))
%obj.turret.delete();
}
function WarMonsterJeepTurretPlayer::onDriverLeave(%this,%obj)
{
%obj.setTransform("0 0 0 0 0 0 0");
}
package WarMonsterJeepPackage
{
function Player::burn(%obj,%time)
{
if(%obj.dataBlock $= WarMonsterJeepTurretPlayer)
return;
else
Parent::burn(%obj,%time);
}
function ShapeBase::setNodeColor(%obj,%node,%color)
{
Parent::setnodecolor(%obj,%node,%color);
if(isObject(%obj.turret))
{
%obj.turret.setNodeColor("ALL",%color);
}
}
function WarMonsterJeepVehicle::Damage(%this,%obj,%source,%pos,%amm,%type)
{
if((%obj.getDamageLevel()+%amm) >= %this.maxDamage)
{
if(%obj.destroyed)
return;
%obj.setNodeColor("ALL","0 0 0 1");
if(isObject(%obj.turret))
{
%obj.turret.delete();
%p = new Projectile()
{
dataBlock = WarMonsterJeepTurretExplosionProjectile;
initialPosition = vectorAdd(%obj.getPosition(),"0 0" SPC %this.initialExplosionOffset);
initialVelocity = "0 0 1";
client = %obj.lastDamageClient;
sourceClient = %obj.lastDamageClient;
};
MissionCleanup.add(%p);
}
else
{
%p = new Projectile()
{
dataBlock = WarMonsterJeepExplosionProjectile;
initialPosition = vectorAdd(%obj.getPosition(),"0 0" SPC %this.initialExplosionOffset);
initialVelocity = "0 0 1";
client = %obj.lastDamageClient;
sourceClient = %obj.lastDamageClient;
};
MissionCleanup.add(%p);
}
if(%obj.destroyed)
return;
%obj.setDamageLevel(%this.maxDamage);
%obj.destroyed = 1;
%obj.schedule(%this.burnTime,"finalExplosion");
if(isObject(%obj.spawnBrick.client.minigame))
%respawn = %obj.spawnBrick.client.minigame.vehicleReSpawnTime;
%obj.spawnBrick.schedule(%respawn,"spawnVehicle");
}
else
Parent::Damage(%this,%obj,%source,%pos,%amm,%type);
}
function Player::emote(%obj,%emote)
{
if(%obj.dataBlock $= WarMonsterJeepTurretPlayer)
return;
Parent::emote(%obj,%emote);
}
function WarMonsterJeepTurretPlayer::onDamage(%this,%obj,%ammount)
{
if(%obj.dataBlock $= WarMonsterJeepTurretPlayer)
return;
Parent::onDamage(%this,%obj,%ammount);
}
function WarMonsterJeepShellProjectile::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e)
{
if(%col.dataBlock.className $= "Glass" && !%col.indestructable)
{
%col.explode();
}
Parent::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e);
}
function WarMonsterJeepTurretPlayer::onDisabled(%this,%obj,%state)
{
%p = new Projectile()
{
dataBlock = WarMonsterJeepTurretExplosionProjectile;
initialPosition = vectorAdd(%obj.getObjectMount().getPosition(),"0 0" SPC %obj.getObjectMount().dataBlock.initialExplosionOffset);
initialVelocity = "0 0 1";
client = %obj.lastDamageClient;
sourceClient = %obj.lastDamageClient;
};
MissionCleanup.add(%p);
%obj.schedule(10,"delete");
%player = %obj.getMountedObject(0);
if(isObject(%player))
{
%obj.getObjectMount().schedule(10,"mountObject",%player,2);
}
}
function WarMonsterJeepTurretPlayer::Damage(%this,%obj,%source,%pos,%amm,%type)
{
//scale the damage ammount as if this was a vehicle
%amm *= $Damage::VehicleDamageScale[%type];
if(%obj.getDamageLevel()+%amm > %this.maxDamage)
%obj.setDamageLevel(%this.maxDamage);
else
Parent::Damage(%this,%obj,%source,%pos,%amm,%type);
}
function armor::onMount(%this,%obj,%col,%slot)
{
Parent::onMount(%this,%obj,%col,%slot);
if(%col.getDataBlock() == WarMonsterJeepVehicle.getId())
{
if(%slot $= 2)
{
%obj.setLookLimits(1,0);
}
}
else if(%col.getDataBlock() == WarMonsterJeepTurretPlayer.getId())
{
%client = %obj.client;
if(isObject(%client))
ServerCmdUnUseTool(%client);
}
}
function armor::onTrigger(%this, %obj, %triggerNum, %val)
{
%mount = %obj.getObjectMount();
if(isObject(%mount))
{
if(%mount.getDataBlock() == WarMonsterJeepTurretPlayer.getId() && %triggerNum == 0 && %val)
{
%client = %obj.client;
if(isObject(%client))
ServerCmdUnUseTool(%client);
if(getSimTime() - %obj.lastShotTime < 2500)
return;
%scaleFactor = getWord(%mount.getScale(), 2);
%p = new Projectile()
{
dataBlock = WarMonsterJeepShellProjectile;
initialPosition = vectorAdd(%mount.getEyeTransform(),vectorScale(%mount.getEyeVector(),3));
initialVelocity = vectorScale(%mount.getEyeVector(),140 * %scaleFactor);
sourceObject = %obj;
client = %obj.client;
sourceSlot = 0;
originPoint = vectorAdd(%mount.getEyeTransform(),vectorScale(%mount.getEyeVector(),3));
};
MissionCleanup.add(%p);
%p.setScale(%scaleFactor SPC %scaleFactor SPC %scaleFactor);
%mount.mountImage(WarMonsterJeepSmokeImage,1);
serverPlay3D(WarMonsterJeepshotSound,%obj.getPosition());
%theVector = %mount.getEyeVector();
%theVector = vectorAdd(%theVector,"0 0 1");
%theVector = vectorScale(%theVector,%mount.getObjectMount().dataBlock.mass*5);
%theVector = vectorSub(%theVector,vectorScale(%thevector,2));
%mount.getObjectMount().applyImpulse(getWords(%mount.getEyeTransform(),0,2),%theVector);
%obj.playThread(0,activate);
%obj.lastShotTime = getSimTime();
return;
}
}
Parent::onTrigger(%this,%obj,%triggerNum,%val);
}
};
datablock ProjectileData(WarMonsterJeepTurretExplosionProjectile)
{
directDamage = 0;
radiusDamage = 0;
damageRadius = 0;
explosion = WarMonsterJeepTurretExplosion;
directDamageType = $DamageType::jeepExplosion;
radiusDamageType = $DamageType::jeepExplosion;
explodeOnDeath = 1;
armingDelay = 0;
lifetime = 10;
};
datablock ExplosionData(WarMonsterJeepShellExplosion)
{
explosionShape = "";
soundProfile = rocketExplodeSound;
lifeTimeMS = 150;
debris = WarMonsterJeepShellDebris;
debrisNum = 30;
debrisNumVariance = 10;
debrisPhiMin = 0;
debrisPhiMax = 360;
debrisThetaMin = 0;
debrisThetaMax = 180;
debrisVelocity = 140;
debrisVelocityVariance = 50;
particleEmitter = gravityRocketExplosionEmitter;
particleDensity = 10;
particleRadius = 0.2;
emitter[0] = gravityRocketExplosionRingEmitter;
emitter[1] = gravityRocketExplosionChunkEmitter;
faceViewer = true;
explosionScale = "1 1 1";
shakeCamera = true;
camShakeFreq = "10.0 11.0 10.0";
camShakeAmp = "3.0 10.0 3.0";
camShakeDuration = 0.5;
camShakeRadius = 20.0;
// Dynamic light
lightStartRadius = 5;
lightEndRadius = 20;
lightStartColor = "1 1 0 1";
lightEndColor = "1 0 0 0";
damageRadius = 8;
radiusDamage = 170;
impulseRadius = 15;
impulseForce = 5000;
playerBurnTime = 5000;
};
AddDamageType("WarMonsterJeepShellDirect", '<bitmap:add-ons/Projectile_GravityRocket/rocket> %1', '%2 <bitmap:add-ons/Projectile_GravityRocket/rocket> %1',1,1);
AddDamageType("WarMonsterJeepShellRadius", '<bitmap:add-ons/Projectile_GravityRocket/rocketRadius> %1', '%2 <bitmap:add-ons/Projectile_GravityRocket/rocketRadius> %1',1,0);
datablock ProjectileData(WarMonsterJeepShellProjectile)
{
projectileShapeName = "./WarMonsterJeepBullet.dts";
directDamage = 100;
directDamageType = $DamageType::WarMonsterJeepShellDirect;
radiusDamageType = $DamageType::WarMonsterJeepShellRadius;
impactImpulse = 1000;
verticalImpulse = 1000;
explosion = WarMonsterJeepShellExplosion;
particleEmitter = rocketTrailEmitter;
brickExplosionRadius = 5;
brickExplosionImpact = true; //destroy a brick if we hit it directly?
brickExplosionForce = 50;
brickExplosionMaxVolume = 60; //max volume of bricks that we can destroy
brickExplosionMaxVolumeFloating = 120; //max volume of bricks that we can destroy if they aren't connected to the ground (should always be >= brickExplosionMaxVolume)
sound = rocketLoopSound;
muzzleVelocity = 120;
velInheritFactor = 1.0;
armingDelay = 0;
lifetime = 4000;
fadeDelay = 4000;
bounceElasticity = 0.5;
bounceFriction = 0.20;
isBallistic = true;
gravityMod = 1.0;
hasLight = true;
lightRadius = 5.0;
lightColor = "1 0.5 0.0";
explodeOnDeath = 1;
uiName = "WarMonsterJeep Shell"; //naming it this way so it's next to the rocket in the alphabetized list
};
Note, I have not edited all the projectiles and explosions yet, so please don't yell at me.