Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddDamageType("assaultrifle", '<bitmap:add-ons/Weapon_assault_rifle/CI_assaultriflenew> %1', '%2 <bitmap:add-ons/Weapon_assault_rifle/CI_assaultriflenew> %1',0.2,1);
- datablock ProjectileData(assaultrifleProjectile)
- {
- projectileShapeName = "add-ons/Weapon_Gun/bullet.dts";
- directDamage = 20;
- directDamageType = $DamageType::assaultrifle;
- radiusDamageType = $DamageType::assaultrifle;
- 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 = 0;
- verticalImpulse = 0;
- explosion = gunExplosion;
- particleEmitter = bulletTrailEmitter;
- muzzleVelocity = 90;
- velInheritFactor = 1;
- armingDelay = 00;
- lifetime = 4000;
- fadeDelay = 3500;
- bounceElasticity = 0.5;
- bounceFriction = 0.20;
- isBallistic = false;
- gravityMod = 0.0;
- hasLight = false;
- lightRadius = 3.0;
- lightColor = "0 0 0.5";
- uiName = "Assault Rifle Bullet";
- };
- //////////
- // item //
- //////////
- datablock ItemData(AssaultRifleItem)
- {
- category = "Weapon"; // Mission editor category
- className = "Weapon"; // For inventory system
- // Basic Item Properties
- shapeFile = "./assaultriflenew.dts";
- rotate = false;
- mass = 1;
- density = 0.2;
- elasticity = 0.2;
- friction = 0.6;
- emap = true;
- //gui stuff
- uiName = "Assault Rifle";
- iconName = "./icon_assaultriflenew";
- doColorShift = true;
- colorShiftColor = "1 1 1 1.000";
- // Dynamic properties defined by the scripts
- image = assaultrifleImage;
- canDrop = true;
- };
- ////////////////
- //weapon image//
- ////////////////
- datablock ShapeBaseImageData(assaultrifleImage)
- {
- // Basic Item properties
- shapeFile = "./assaultriflenew.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 = assaultrifleItem;
- ammo = " ";
- projectile = assaultrifleProjectile;
- projectileType = Projectile;
- casing = gunShellDebris;
- shellExitDir = "2.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 = assaultrifleItem.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.1;
- stateTransitionOnTimeout[0] = "Ready";
- stateSound[0] = activateSound;
- stateName[1] = "Ready";
- stateTransitionOnTriggerDown[1] = "Fire";
- stateAllowImageChange[1] = true;
- stateSequence[1] = "Ready";
- stateName[2] = "Fire";
- stateTransitionOnTimeout[2] = "smoke";
- stateTimeoutValue[2] = 0.075;
- stateFire[2] = true;
- stateAllowImageChange[2] = false;
- stateSequence[2] = "Fire";
- stateScript[2] = "onFire";
- stateWaitForTimeout[2] = true;
- stateEmitter[2] = gunFlashEmitter;
- stateEmitterTime[2] = 0.05;
- stateEjectShell[2] = true;
- stateEmitterNode[2] = "muzzleNode";
- stateSound[2] = gunshot1Sound;
- stateSequence[2] = "Fire";
- stateEjectShell[2] = true;
- stateName[3] = "Smoke";
- stateEmitter[3] = gunSmokeEmitter;
- stateEmitterTime[3] = 0;
- stateEmitterNode[3] = "muzzleNode";
- stateTimeoutValue[3] = 0.0;
- stateTransitionOnTimeout[3] = "Reload";
- stateName[4] = "Reload";
- stateAllowImageChange[4] = false;
- stateTimeoutValue[4] = 0.05;
- stateWaitForTimeout[4] = true;
- stateTransitionOnTimeout[4] = "Check";
- //stateTransitionOnTriggerUp[4] = "Ready";
- stateName[5] = "Check";
- stateTransitionOnTriggerUp[5] = "StopFire";
- stateTransitionOnTriggerDown[5] = "Ready";
- stateName[6] = "StopFire";
- stateTransitionOnTimeout[6] = "Ready";
- stateTimeoutValue[6] = 0.01;
- stateAllowImageChange[6] = false;
- stateWaitForTimeout[6] = true;
- stateScript[6] = "onStopFire";
- };
- function assaultrifleImage::onFire(%this,%obj,%slot)
- {
- if((%obj.lastFireTime+%this.minShotTime) > getSimTime())
- return;
- %obj.lastFireTime = getSimTime();
- %projectile = %this.projectile;
- %spread = 0.001;
- %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) * 10 * 3.1415926 * %spread;
- %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %z = (getRandom() - 0.5) * 10 * 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
Advertisement