Author Topic: Weapon Doesn't Appear in Items List  (Read 427 times)

I wanted to refrain from posting anything about this, but I'm making a "Block Wars Battlefront" server.
I'm not going to go into detail, but what I plan on doing is executing all the add-ons for it from within the game mode folder.
Surely enough, it works.  But the "Lego Short Blaster" from Basic LEGO blasters isn't sohwing up in the list of items when I wrench a brick.
The problem is, the console doesn't say anything's wrong and I can't find anything wrong either.

Below is all the code that has to do with that specific weapon (I renamed the weapon "Blaster Pistol" to appeal to the original Star Wars Battlefront game's weapon names).

server.cs
Code: [Select]
exec("Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Weapons/Weapons.cs");

Weapons.cs
Code: [Select]
exec("Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Weapons/blaster_pistol.cs");
exec("Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Effects/Effects.cs");
exec("Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Sounds/Audio.cs");
exec("Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Projectiles/Projectiles.cs");

blaster_pistol.cs
Code: [Select]
//blaster_pistol.cs

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

// Basic Item Properties
shapeFile = "Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Weapons/blaster_pistol.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "Blaster Pistol";
iconName = "Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Icons/blaster_pistol";
doColorShift = false;
colorShiftColor = "0.25 0.25 0.25 1.000";

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

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(BlasterPistolImage)
{
// Basic Item properties
shapeFile = "Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Weapons/blaster_pistol.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.7 1.2 -0.5";
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 = BlasterPistolProjectile;
projectileType = Projectile;

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

doColorShift = false;
colorShiftColor = BlasterPistolItem.colorShiftColor; //"0.400 0.196 0 1.000";

//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;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateSequence[1] = "Ready";

stateName[2] = "Fire";
stateTransitionOnTimeout[2] = "Reload";
stateTimeoutValue[2] = 0.14;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
stateScript[2] = "onFire";
stateWaitForTimeout[2] = true;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = BlasterPistolShotSound;

stateName[3] = "Reload";
stateSequence[3] = "Reload";
stateTransitionOnTriggerUp[3] = "Ready";
stateSequence[3] = "Ready";

};

function BlasterPistolImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, shiftAway);
Parent::onFire(%this,%obj,%slot);
}

Effects.cs
Code: [Select]
//blaster pistol emitters
datablock ParticleData(BlasterPistolTrailParticle)
{
dragCoefficient = 2.0;
windCoefficient = 0.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 30;
lifetimeVarianceMS = 0;
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
useInvAlpha = true;
animateTexture = false;
//framesPerSec = 1;

textureName = "base/data/particles/dot";
//animTexName = " ";

colors[0] = "1 0.4 0.0 1.0";
colors[1] = "1 0.4 0.0 0.0";
sizes[0] = 0.13;
sizes[1] = 0.25;
//times[0] = 0.5;
//times[1] = 0.5;
};

datablock ParticleEmitterData(BlasterPistolTrailEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;

ejectionVelocity = 0; //0.25;
velocityVariance = 0; //0.10;

ejectionOffset = 0;

thetaMin = 0.0;
thetaMax = 90.0;  

particles = BlasterPistolTrailParticle;

useEmitterColors = true;
uiName = "Blaster Pistol Trail";
};

datablock ParticleData(BlasterPistolExplosionParticle)
{
dragCoefficient = 8;
gravityCoefficient = 1;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 300;
lifetimeVarianceMS = 100;
textureName = "base/data/particles/star1";
spinSpeed = 2.0;
spinRandomMin = -20.0;
spinRandomMax = 20.0;
colors[0] = "1.0 0.4 0.0 0.5";
colors[1] = "1.0 0.4 0.0 0.0";
sizes[0] = 0.75;
sizes[1] = 0.0;

useInvAlpha = true;
};

datablock ParticleEmitterData(BlasterPistolExplosionEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 89;
thetaMax = 90;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = "BlasterPistolExplosionParticle";

useEmitterColors = true;
uiName = "Blaster Pistol Explosion";
};

datablock ExplosionData(BlasterPistolExplosion)
{
//explosionShape = "";
soundProfile = BlasterHitSound;

lifeTimeMS = 150;

particleEmitter = BlasterPistolExplosionEmitter;
particleDensity = 5;
particleRadius = 0.2;

faceViewer = true;
explosionScale = "1.5 1.5 1.5";

shakeCamera = false;
camShakeFreq = "10.0 11.0 10.0";
camShakeAmp = "1.0 1.0 1.0";
camShakeDuration = 0.5;
camShakeRadius = 10.0;

// Dynamic light
lightStartRadius = 0;
lightEndRadius = 3;
lightStartColor = "1 0.4 0 1";
lightEndColor = "1 0.4 0 1";
};

Projectiles.cs
Code: [Select]
//projectiles
AddDamageType("blaster_pistol",   '<bitmap:Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Icons/CI_blaster_pistol> %1',    '%2 <bitmap:Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Icons/CI_blaster_pistol> %1',0.2,1);

//blaster pistol projectile
datablock ProjectileData(BlasterPistolProjectile)
{
projectileShapeName = "base/data/shapes/empty.dts";
directDamage = 40;
directDamageType = $DamageType::blaster_pistol;
radiusDamageType = $DamageType::blaster_pistol;

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

impactImpulse = 200;
verticalImpulse = 200;
explosion = BlasterPistolExplosion;
particleEmitter = BlasterPistolTrailEmitter;

muzzleVelocity = 90;
velInheritFactor = 1;

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

hasLight = true;
lightRadius = 3.0;
lightColor = "1 0.4 0.0 1";

uiName = "Blaster Pistol Laser";
};

Audio.cs
Code: [Select]
//blaster pistol sounds
datablock AudioProfile(BlasterPistolShotSound)
{
filename = "Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Sounds/blaster_pistol_shot.wav";
description = AudioClose3d;
preload = true;
};
//sounds that the sniper rifle, blaster rifle and blaster pistol share
datablock AudioProfile(BlasterHitSound)
{
filename = "Add-Ons/GameMode_Block_Wars_Battlefront/Weapons/Sounds/blaster_hit.wav";
description = AudioClose3d;
preload = true;
};

Sorry about posting ALL the code here.
I just can't find the problem ANYWHERE!
PLEASE HELP!
« Last Edit: July 24, 2013, 05:00:16 PM by Clone2 »

Change the execution order of the .cs files to:
Audio.cs
Effects.cs
Projectiles.cs
Blaster_pistol.cs


If this is indeed the fix, the reason is that each datablock balances off the other. So if you define the datablock for the projectile, it won't know what ? Particle is unless you defined it first.

Change the execution order of the .cs files to:
Audio.cs
Effects.cs
Projectiles.cs
Blaster_pistol.cs


If this is indeed the fix, the reason is that each datablock balances off the other. So if you define the datablock for the projectile, it won't know what ? Particle is unless you defined it first.
That actually was the order of it.
Besides, the blaster pistol is not the only add-on I had in there.
The rest work fine.

I'm just going to completely redo the blaster pistol and see how that works for now.

Okay, so I re-downloaded the original and tried to do that hole process of making it work inside the game mode again.
It sill isn't working.

I don't know what's wrong, but I'm starting to think it's a problem with the original add-on.