Author Topic: how does this make any sense  (Read 1950 times)


You forgot }; above it.



Code: [Select]
//audio
datablock AudioProfile(MagnumSound)
{
   filename    = "./magnum.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(roosterSound)
{
   filename    = "./rooster.wav";
   description = AudioClose3d;
   preload = true;
};


//shell
datablock DebrisData(gunShellDebris)
{
shapeFile = "./gunShell.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;
};


//muzzle flash effects
datablock ParticleData(MagnumFlashParticle)
{
dragCoefficient      = 0;
    gravityCoefficient   = 0;
    inheritedVelFactor   = 0;
    constantAcceleration = 0.0;
    lifetimeMS           = 50;
    lifetimeVarianceMS   = 0;
    textureName          = "base/data/particles/star1";
    spinSpeed        = 9000.0;
    spinRandomMin        = -5000.0;
    spinRandomMax        = 5000.0;

    colors[0]     = "1.0 0.5 0 0.9";
    colors[1]     = "0.9 0.4 0 0.8";
    colors[2]     = "1 0.5 0.2 0.6";
    colors[3]     = "1 0.5 0.2 0.4";

    sizes[0]      = 1.75;
   sizes[1]      = 0.4;
    sizes[2]      = 0.10;
    sizes[3]      = 0.0;

   times[0] = 0.0;
   times[1] = 0.1;
   times[2] = 0.5;
   times[3] = 1.0;

    useInvAlpha = false;
};
datablock ParticleEmitterData(MagnumFlashEmitter)
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 0;
   ejectionVelocity = 34.0;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 1;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;

   particles = "MagnumFlashParticle";
};

datablock ParticleData(MagnumSmokeParticle)
{
dragCoefficient      = 3;
    gravityCoefficient   = 0;
    inheritedVelFactor   = 0;
    constantAcceleration = 0.0;
    lifetimeMS           = 100;
    lifetimeVarianceMS   = 0;
    textureName          = "base/data/particles/cloud";
    spinSpeed        = 9000.0;
    spinRandomMin        = -5000.0;
    spinRandomMax        = 5000.0;

    colors[0]     = "0.6 0.6 0.6 0.0";
    colors[1]     = "0.7 0.7 0.7 0.3";
    colors[2]     = "1 1 1 0.2";
    colors[3]     = "1 1 1 0";

    sizes[0]      = 0.0;
   sizes[1]      = 0.4;
    sizes[2]      = 0.10;
    sizes[3]      = 0.05;

   times[0] = 0.0;
   times[1] = 0.1;
   times[2] = 0.5;
   times[3] = 1.0;

    useInvAlpha = false;
};

datablock ParticleEmitterData(MagnumSmokeEmitter)
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 0;
   ejectionVelocity = 32.0;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 1;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;

   particles = "MagnumSmokeParticle";
};

datablock ParticleData(MagnumTrailParticle)
{
   dragCoefficient      = 3.0;
   windCoefficient      = 0.0;
   gravityCoefficient   = 0.0;
   inheritedVelFactor   = 0.0;
   constantAcceleration = 0.0;
   lifetimeMS     = 210;
   lifetimeVarianceMS   = 0;
   spinSpeed      = 10.0;
   spinRandomMin     = -50.0;
   spinRandomMax     = 50.0;
   useInvAlpha    = false;
   animateTexture    = false;
   //framesPerSec    = 1;

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

   // Interpolation variables
   colors[0]   = "1 1 0 0.5";
   colors[1]   = "1 1 0.4 0.5";
   colors[2]   = "1 1 1 0.5";
   sizes[0] = 0.25;
   sizes[1] = 0.15;
   sizes[2] = 0.0;
   times[0] = 0.0;
   times[1] = 0.5;
   times[2] = 1.0;
};

datablock ParticleEmitterData(MagnumTrailEmitter)
{
   ejectionPeriodMS = 2;
   periodVarianceMS = 0;

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

   ejectionOffset = 0;

   thetaMin         = 0.0;
   thetaMax         = 90.0; 

   particles = "MagnumTrailParticle";

   useEmitterColors = true;
};


datablock ParticleData(MagnumExplosionParticle)
{
dragCoefficient      = 8;
gravityCoefficient   = 1;
inheritedVelFactor   = 0.2;
constantAcceleration = 0.0;
lifetimeMS           = 700;
lifetimeVarianceMS   = 400;
textureName          = "base/data/particles/cloud";
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0]     = "0.9 0.9 0.9 0.3";
colors[1]     = "0.9 0.5 0.6 0.0";
sizes[0]      = 0.25;
sizes[1]      = 0.75;

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

   useEmitterColors = true;
   uiName = "";
};


datablock ParticleData(MagnumExplosionRingParticle)
{
dragCoefficient      = 8;
gravityCoefficient   = -0.5;
inheritedVelFactor   = 0.2;
constantAcceleration = 0.0;
lifetimeMS           = 50;
lifetimeVarianceMS   = 35;
textureName          = "base/data/particles/star1";
spinSpeed = 500.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0]     = "1 1 0.0 0.9";
colors[1]     = "0.9 0.0 0.0 0.0";
sizes[0]      = 2;
sizes[1]      = 0;

useInvAlpha = false;
};
datablock ParticleEmitterData(MagnumExplosionRingEmitter)
{
lifeTimeMS = 50;

   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 0;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 89;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "MagnumExplosionRingParticle";

   useEmitterColors = true;
   uiName = "";
};

datablock ExplosionData(MagnumExplosion)
{
   //explosionShape = "";
soundProfile = bulletHitSound;

   lifeTimeMS = 150;

   particleEmitter = MagnumExplosionEmitter;
   particleDensity = 5;
   particleRadius = 0.2;

   emitter[0] = MagnumExplosionRingEmitter;

   faceViewer     = true;
   explosionScale = "1 1 1";

   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 = 2;
   lightEndRadius = 2;
   lightStartColor = "0.5 0.8 0.9";
   lightEndColor = "0 0 0";
};


AddDamageType("Magnum",   '<bitmap:add-ons/Weapon_Magnum/CI_Magnum> %1',    '%2 <bitmap:add-ons/Weapon_Magnum/CI_Magnum> %1',0.2,1);
datablock ProjectileData(MagnumProjectile)
{
   projectileShapeName = "./bullet.dts";
   directDamage        = 35;
   directDamageType    = $DamageType::Magnum;
   radiusDamageType    = $DamageType::Magnum;

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

   impactImpulse      = 200;
   verticalImpulse   = 200;
   explosion           = gunExplosion;
   particleEmitter     = "MagnumTrailEmitter"; //bulletTrailEmitter;

   muzzleVelocity      = 135;
   velInheritFactor    = 1;

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

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

   uiName = "";
};

AddDamageType("Magnum",   '<bitmap:add-ons/Weapon_Magnum/CI_Magnum> %1',    '%2 <bitmap:add-ons/Weapon_Magnum/CI_Magnum> %1',0.2,1);
datablock ProjectileData(MagnumProjectileHeadshot)
{
   projectileShapeName = "./bullet.dts";
   directDamage        = 80;
   directDamageType    = $DamageType::Magnum;
   radiusDamageType    = $DamageType::Magnum;

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

   impactImpulse       = 200;
   verticalImpulse     = 200;
   explosion           = gunExplosion;
   particleEmitter     = "MagnumTrailEmitter"; //bulletTrailEmitter;

   muzzleVelocity      = 135;
   velInheritFactor    = 1;

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

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

   uiName = "";
};

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

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

//gui stuff
uiName = "Old Magnum";
iconName = "./icon_Magnum";
doColorShift = true;
colorShiftColor = "0.5 0.4 0.3 1.000";

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

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(MagnumImage)
{
   // Basic Item properties
   shapeFile = "./Magnum.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 = MagnumProjectile;
   projectileType = Projectile;

//casing = gunShellDebris;
shellExitDir        = "1.0 -1.0 1.0";
shellExitOffset     = "0 0 0";
shellExitVariance   = 15.0;
shellVelocity       = 7.0;

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

   doColorShift = true;
   colorShiftColor = MagnumItem.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.25;
stateTransitionOnTimeout[0]       = "Ready";
stateSound[0] = weaponSwitchSound;

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

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Wait";
stateTimeoutValue[2]            = 0.15;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = MagnumFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = MagnumSound;
stateEjectShell[2]       = true;

stateName[3] = "Smoke";
stateEmitter[3] = MagnumSmokeEmitter;
stateEmitterTime[3] = 0.05;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3]            = 0.01;
stateTransitionOnTimeout[3]     = "Reload";

stateName[4]        = "Wait";
   stateTimeoutValue[4]            = 0.7;
   stateScript[4]       = "onWait";
   stateSound[4]        = roosterSound;
   stateTransitionOnTimeout[4]     = "Ready";


};

function MagnumImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, shiftAway);
%obj.schedule(100,playThread, Plant);
Parent::onFire(%this,%obj,%slot);
}
function MagnumImage::onWait(%this,%obj,%slot)
{
      %obj.playThread(2, shiftLeft);
      %obj.schedule(100,playThread, shiftRight);
}

function MagnumProjectile::Damage(%this,%obj,%col,%fade,%pos,%normal)
{
  if(%col.getClassName() $="Player" || %col.getClassName() $= "AIPlayer")
  {
    if(%col.getClassName() $= "AIPlayer")
    {
      %oldClient = %col.client;
      %col.client = BotConnection;
      %hitBoxList = getHitbox(%obj,%col,%pos);
      %col.client = %oldClient;
    }
    else
    {
      %hitBoxList = getHitbox(%obj,%col,%pos);
    }
    if(strReplace(%hitBoxList,"headskin","BAM") $= %hitBoxList)
    {
      parent::Damage(%this,%obj,%col,%fade,%pos,%normal);
    }
    else
    {
      %col.damage(%obj,%pos,120 / %obj.getScale(),$DamageType::InterventionHeadshot);
    }
  }
  else
  {
    parent::Damage(%this,%obj,%col,%fade,%pos,%normal);
  }
}
whoa


not really, because it worked with other weapons I put this on

Works fine for me so I dunno. Are you working on this in a zip?


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

This probably doesn't do what you think it does. You need {} to have more than two statements inside the if.


Yeah, it's in a zip
Don't put stuff in a zip while you're working on it

This probably doesn't do what you think it does. You need {} to have more than two statements inside the if.
It's the same thing as what the default gun weapon has except for the schedule

It works fine now, maybe it was that onFire problem

If you restarted blockland, that's because it updates the zip file.

Try to put your work into a folder until you think it's completely done, when updating a file in a zip you have to make Blockland discover it everytime. (Same for adding NEW files to the folder/zip)
« Last Edit: December 04, 2015, 08:20:41 AM by Kyuande »

weird errors come up when you exec edited .cs files without restarting BL. to avoid them, and the need to restart, run setmodpaths(getmodpaths()); which i think updates the addons in memory to match the ones in the folder/zip?

either way, it makes the code changes correctly transfer over to your testing server to be exec'd, whether or not its singleplayer.
« Last Edit: December 04, 2015, 02:45:52 PM by Conan »

or just use a folder and not a .zip lol