Author Topic: syntax errors  (Read 1306 times)

here they come
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(KickReloadSound)
{
   filename    = "./shotgunReload.wav";
   description = AudioClose3d;
   preload = true;
};

//shell
datablock DebrisData(KickShellDebris)
{
   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

ParticleData(KickSmokeParticle)
{##
##
   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(KickSmokeEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 1.0;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "KickSmokeParticle";
};

AddDamageType("Kick",   '<bitmap:add-ons/Weapon_Kick/CI_Kick> %1',    '%2 <bitmap:add-ons/Weapon_Kick/CI_Kick> %1',0.5,1);
datablock ProjectileData(KickProjectile)

{
   //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(KickItem)
{
   category = "Weapon";  // Mission editor category
   className = "Weapon"; // For inventory system

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

   //gui stuff
   uiName = "Kick";
   iconName = "./KickIcon";
   doColorShift = true;
   colorShiftColor = "0.5 0.5 0.5 1.000";

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

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

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 1; //change this to the right foot, I can't remember what number it is off the top of my head
   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 = KickItem;
   ammo = " ";
   projectile = KickProjectile; //is this really what you will use?
   projectileType = Projectile;

   casing = KickShellDebris;
   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 = KickItem.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.5;
                stateTransitionOnTimeout[0]    = "Ready";
                stateWaitForTimeout[0]         = true;
                stateSound[0]                  = weaponSwitchSound;

                stateName[1]                   = "Ready";
                stateTransitionOnTriggerDown[1]= "Fire";
                stateAllowImageChange[1]       = true;
//            stateEmitter[1]                = PyGunambientEmitter;
//            stateEmitterTime[1]            = 1000;
//            stateEmitterNode[1]            = "muzzlePoint";

   stateName[2]                    = "Fire";
   stateTransitionOnTimeout[2]     = "Smoke";
   stateTimeoutValue[2]            = 0.2;
   stateFire[2]                    = true;
   stateAllowImageChange[2]        = false;
   stateSequence[2]                = "Fire";
   stateScript[2]                  = "onFire";
   stateWaitForTimeout[2]        = true;
   stateSound[2]           = kickfire;
   stateTransitionOnTimeout[2]     = "Smoke";

   stateName[3]            = "Smoke";
   stateScript[3]         = "onSmoke";
   stateTimeoutValue[3]            = 0.5;
   stateTransitionOnTimeout[3]     = "Ready";
};

function kickImage::onFire(%this, %obj, %slot)
{
   %obj.hideNode(rShoe);
   %obj.hideNode(rPeg);
}

function kickImage::onSmoke(%this, %obj, %slot)
{
   %obj.unMountImage(Mountpoint1); //I have forgotten the number the rShoe is
   %obj.client.applyBodyParts();
   %obj.client.applyBodyColors();
}


the syntax is here

//emitter

ParticleData(KickSmokeParticle)
{##
##

   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;
};

You need to look really hard at the difference between the other datablock sections of code and your own one that you've added, specifically the very first lines of the sections.

In other words, you forgot to put in the word datablock.

In other words, you forgot to put in the word datablock.

I'm sure he could have figured that out himself, but whatever.

sometimes it's helpful to be helpful

sometimes it's helpful to be helpful

are you suggesting I wasn't being helpful.

are you suggesting I wasn't being helpful.
he's helpfully pointing out that you can be more helpful by being actually helpful than only implicitly helpful

he's helpfully pointing out that you can be more helpful by being actually helpful than only implicitly helpful

I am so very sorry, next time I'll aspire to be more helpful then.

I am so very sorry, next time I'll aspire to be more helpful then.
aaaaaaaaa
You need to look really hard at the difference between the other datablock sections of code and your own one that you've added, specifically the very first lines of the sections.
ok i see now, i fixed it
but now the whole item is broke
the shoe model i made (kick.dts) appears behind my arm with forgeted up scale
and it has the glitch where if i select it and my last used item was the printer, i am still holding the printer even though i selected the kick item in my inv
help

The mount point for the right foot is 3. It also sounds like you need to fix the model.
I don't know about the printer thing. It's usually caused by the image field in your item datablock not leading to the right image.

ok here is my attempt 2 at this
there are no syntaxes but the projectile doesnt work for some reason
please help
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 = true;
   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";
};
   
datablock DebrisData(KickShellDebris)
{
        shapeName = "base/data/shapes/empty.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;
};

AddDamageType("Kick",   '<bitmap:add-ons/Weapon_Kick/CI_Kick> %1',    '%2 <bitmap:add-ons/Weapon_Kick/CI_Kick> %1',0.5,1);
datablock ProjectileData(KickProjectile)

{
   projectileShapeName = "base/data/shapes/empty.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(KickItem)
{
   category = "Weapon";  // Mission editor category
   className = "Weapon"; // For inventory system

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

   //gui stuff
   uiName = "Kick";
   iconName = "./icon_Kick";
   doColorShift = true;
   colorShiftColor = "0.25 0.25 0.25 1.000";

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

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

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
 
  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 = BowItem;
   ammo = " ";
   projectile = KickProjectile;
   projectileType = Projectile;

   casing = KickShellDebris;
   shellExitDir        = "1.0 -1.3 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 = KickItem.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.5;
   stateTransitionOnTimeout[0]       = "Ready";

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

   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;
   stateSound[2]           = kickfire;
   stateTransitionOnTimeout[2]     = "Smoke";

   stateName[3]            = "Smoke";
   stateTimeoutValue[3]            = 0.2;
   stateTransitionOnTimeout[3]     = "Reload";

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

};


function KickImage::onFire(%this, %obj, %slot)
{
   %obj.hideNode(rShoe);
   %obj.hideNode(rPeg);
}

function KickImage::onSmoke(%this, %obj, %slot)
{
   %obj.unMountImage(Mountpoint3); //I have forgotten the number the rShoe is
   %obj.client.applyBodyParts();
   %obj.client.applyBodyColors();
}

iirc you have to parent onFire at the end for the projectile to actually fire.
« Last Edit: July 22, 2016, 08:07:56 PM by EcstaticEggplant »

iirk you have to parent onFire at the end for the projectile to actually fire.
what

what
in the default gun, the onfire method looks like this:

function KickImage::onFire(%this, %obj, %slot)
{
   %obj.hideNode(rShoe);
   %obj.hideNode(rPeg);
   parent::onFire(%this, %obj, %slot);
}


i assume that the projectile not working means that the weapon isnt firing

he's helpfully pointing out that you can be more helpful by being actually helpful than only implicitly helpful
people learn better when they figure stuff out themselves, than if you just give them the answer