Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- datablock AudioProfile(PitchforkactivateSound)
- {
- filename = "./activate.wav";
- description = AudioClose3d;
- preload = true;
- };
- datablock AudioProfile(pitchforkhitSound)
- {
- filename = "./pitchforkhit.wav";
- description = AudioClose3d;
- preload = true;
- };
- //effects
- datablock ParticleData(PitchforkExplosionParticle)
- {
- dragCoefficient = 2;
- gravityCoefficient = 1.0;
- inheritedVelFactor = 0.2;
- constantAcceleration = 0.0;
- spinRandomMin = -90;
- spinRandomMax = 90;
- lifetimeMS = 500;
- lifetimeVarianceMS = 300;
- textureName = "base/data/particles/chunk";
- colors[0] = "0.7 0.7 0.9 0.9";
- colors[1] = "0.9 0.9 0.9 0.0";
- sizes[0] = 0.5;
- sizes[1] = 0.25;
- };
- datablock ParticleEmitterData(PitchforkExplosionEmitter)
- {
- ejectionPeriodMS = 7;
- periodVarianceMS = 0;
- ejectionVelocity = 8;
- velocityVariance = 1.0;
- ejectionOffset = 0.0;
- thetaMin = 0;
- thetaMax = 60;
- phiReferenceVel = 0;
- phiVariance = 360;
- overrideAdvance = false;
- particles = "PitchforkExplosionParticle";
- uiName = "Pitchfork Hit";
- };
- datablock ExplosionData(PitchforkExplosion)
- {
- //explosionShape = "";
- lifeTimeMS = 500;
- soundProfile = PitchforkHitSound;
- particleEmitter = PitchforkExplosionEmitter;
- particleDensity = 10;
- particleRadius = 0.2;
- faceViewer = true;
- explosionScale = "1 1 1";
- shakeCamera = true;
- camShakeFreq = "20.0 22.0 20.0";
- camShakeAmp = "1.0 1.0 1.0";
- camShakeDuration = 0.5;
- camShakeRadius = 10.0;
- // Dynamic light
- lightStartRadius = 3;
- lightEndRadius = 0;
- lightStartColor = "00.0 0.2 0.6";
- lightEndColor = "0 0 0";
- };
- //Pitchfork trail
- //projectile
- AddDamageType("PitchforkDirect", '<bitmap:add-ons/Weapon_Pitchfork/CI_Pitchfork> %1', '%2 <bitmap:add-ons/Weapon_Pitchfork/CI_Pitchfork> %1',1,1);
- datablock ProjectileData(PitchforkProjectile)
- {
- directDamage = 30;
- directDamageType = $DamageType::PitchforkDirect;
- explosion = PitchforkExplosion;
- //particleEmitter = PitchforkExplosionEmitter;
- 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";
- };
- //////////
- // item //
- //////////
- datablock ItemData(PitchforkItem)
- {
- category = "Weapon"; // Mission editor category
- className = "Weapon"; // For inventory system
- // Basic Item Properties
- shapeFile = "./Pitchfork.dts";
- mass = 1;
- density = 0.2;
- elasticity = 0.2;
- friction = 0.6;
- emap = true;
- //gui stuff
- uiName = "Pitchfork";
- iconName = "./Pitchfork";
- doColorShift = false;
- colorShiftColor = "0.400 0.196 0 1.000";
- // Dynamic properties defined by the scripts
- image = PitchforkImage;
- canDrop = true;
- };
- //function butterflyknife::onUse(%this,%user)
- //{
- // //mount the image in the right hand slot
- // %user.mountimage(%this.image, $RightHandSlot);
- //}
- ////////////////
- //weapon image//
- ////////////////
- datablock ShapeBaseImageData(PitchforkImage)
- {
- // Basic Item properties
- shapeFile = "./Pitchfork.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.1 0.2 -0.55";
- // 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 = PitchforkItem;
- ammo = " ";
- projectile = PitchforkProjectile;
- projectileType = Projectile;
- //melee particles shoot from eye node for consistancy
- melee = false;
- //raise your arm up or not
- armReady = true;
- //casing = " ";
- doColorShift = true;
- colorShiftColor = "0.400 0.196 0 1.000";
- // 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.1;
- stateTransitionOnTimeout[0] = "Ready";
- stateSequence[0] = "ready";
- stateSound[0] = pitchforkactivateSound;
- stateName[1] = "Ready";
- stateTransitionOnTriggerDown[1] = "Charge";
- stateAllowImageChange[1] = true;
- stateName[2] = "Charge";
- stateTransitionOnTimeout[2] = "Armed";
- stateTimeoutValue[2] = 0.7;
- stateWaitForTimeout[2] = false;
- stateTransitionOnTriggerUp[2] = "AbortCharge";
- stateScript[2] = "onCharge";
- stateAllowImageChange[2] = false;
- stateName[3] = "AbortCharge";
- stateTransitionOnTimeout[3] = "Ready";
- stateTimeoutValue[3] = 0.3;
- stateWaitForTimeout[3] = true;
- stateScript[3] = "onAbortCharge";
- stateAllowImageChange[3] = false;
- stateSound[3] = pitchforkhitSound;
- stateName[4] = "Armed";
- stateTransitionOnTriggerUp[4] = "Fire";
- stateAllowImageChange[4] = false;
- stateName[5] = "Fire";
- stateTransitionOnTimeout[5] = "Ready";
- stateTimeoutValue[5] = 0.5;
- stateFire[5] = true;
- stateSequence[5] = "fire";
- stateScript[5] = "onFire";
- stateWaitForTimeout[5] = true;
- stateAllowImageChange[5] = false;
- stateSound[5] = pitchforkhitSound;
- stateName[5] = "Fire";
- stateSound[5] = pitchforkhitSound;
- };
- function Pitchforkprojectile::onCollision(%this, %obj, %col, %fade, %pos, %normal, %velocity)
- {
- Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal, %velocity);
- ServerPlay3D(pitchforkhitSound, %pos);
- }
- function pitchforkImage::onCharge(%this, %obj, %slot)
- {
- %obj.playthread(2, spearReady);
- }
- function pitchforkImage::onAbortCharge(%this, %obj, %slot)
- {
- %obj.playthread(2, root);
- }
- function PitchforkImage::onFire(%this, %obj, %slot)
- {
- %obj.playthread(2, spearThrow);
- Parent::onFire(%this, %obj, %slot);
- }
- function PitchforkImage::onFiretwo(%this,%obj,%slot)
- {
- %projectile = Pitchforkprojectile;
- %spread = 0.00001;
- %shellcount = 1;
- 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) * 2 * 3.1415926 * %spread;
- %y = (getRandom() - 0.5) * 2 * 3.1415926 * %spread;
- %z = (getRandom() - 0.5) * 2 * 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment