Blockland Forums > Modification Help
How to make a bullets direction vary?
(1/3) > >>
RFW2:
I need help with making the bullets go in different places, can someone tell me where in the code this is found, or where to put it? I need to know!

Can someone post an edited version of this script that has a bit of spread?

--- Code: ---//Raider.cs

//audio
datablock AudioProfile(RaiderShot1Sound)
{
   filename    = "./NerfFire.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(RaiderBulletHitSound)
{
   filename    = "./bulletHit.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(RaiderroosterSound)
{
   filename    = "./Nerfrooster.wav";
   description = AudioClose3d;
   preload = true;
};

datablock ExplosionData(RaiderExplosion)
{
   //explosionShape = "";
soundProfile = RaiderBulletHitSound;

   lifeTimeMS = 150;

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

};


AddDamageType("Raider",   '<bitmap:add-ons/Weapon_Raider/CI_Raider> %1',    '%2 <bitmap:add-ons/Weapon_Raider/CI_Raider> %1',0.2,1);
datablock ProjectileData(RaiderProjectile)
{
   projectileShapeName = "./Dart.dts";
   directDamage        = 5;
   directDamageType    = $DamageType::Raider;
   radiusDamageType    = $DamageType::Raider;

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

      explosion             = RaiderExplosion;
   stickExplosion        = RaiderExplosion;
   bloodExplosion        = RaiderExplosion;
   particleEmitter       = RaiderEmitter;
   explodeOnPlayerImpact = true;
   explodeOnDeath        = true; 

   armingDelay         = 4000;
   lifetime            = 4000;
   fadeDelay           = 4000;

   isBallistic         = true;
   bounceAngle         = 170; //stick almost all the time
   minStickVelocity    = 10;
   bounceElasticity    = 0.2;
   bounceFriction      = 0.01;   
   gravityMod = 0.40;

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

   muzzleVelocity      = 30;
   velInheritFactor    = 1;

   uiName = "Nerf Dart";

};

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

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

//gui stuff
uiName = "Nerf Raider";
iconName = "./icon_Raider";
doColorShift = true;
colorShiftColor = "0.25 0.25 0.25 1.000";

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

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

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

   doColorShift = true;
   colorShiftColor = RaiderItem.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.10;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateSound[2] = RaiderShot1Sound;

stateName[4] = "Reload";
stateSequence[4]                = "Reload";
stateTransitionOnTimeout[4]     = "Reload2";
stateSound[4] = RaiderroosterSound;
stateTimeoutValue[4]            = 0.38;

stateName[5] = "Reload2";
stateSequence[5]                = "Ready";
stateTransitionOnTriggerUp[5]     = "Ready";
stateTimeoutValue[5]            = 0.10;

};

function RaiderImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, shiftAway);
Parent::onFire(%this,%obj,%slot);
}
--- End code ---
Headcrab Zombie:
Manually spawn a projectile in onFire
Look at a shotgun script.
herb:
getRandom is your new friend
otto-san:

--- Quote from: herb on August 12, 2010, 09:37:42 PM ---getRandom is your new friend

--- End quote ---
but my friend is function

i don't want getRandom :(
RFW2:
Thanks


EDIT: Looked at the shotgun script, but my gun is a single shot not a shotgun, what should I change?
Navigation
Message Index
Next page

Go to full version