Home   Help Search Login Register  

Author Topic: About muzzle velocity and ammunition  (Read 1410 times)

0 Members and 1 Guest are viewing this topic.

Offline tateyou

  • Members
  • *
About muzzle velocity and ammunition
« on: 24 Jun 2008, 17:13:27 »
Here is the thing, i'm working on creating a railgun, so is there a possibility that i could set the value of muzzle velocity, and creat a new type of ammuntion, instead of the original types in ARMA?
For example, a railgun can accelerate it's own bullet to 3000m/s, how can i do that?

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: About muzzle velocity and ammunition
« Reply #1 on: 25 Jun 2008, 20:44:16 »
You can do this very easily by changing the initSpeed value in the cfgMagazines.  I don't know if the ArmA engine could handle speeds of 3000 m/s.

You could do this very easily in script only with a fired event handler. Add this to the unit's init line:
Code: [Select]
this addEventHandler ["FIRED", {[_this, 3000] call fRailgun}];add this to your init.sqf:
Code: [Select]
fRailgun = compile preprocessFileLineNumbers "railgun.sqf"
and add the following script to your mission folder:
railgun.sqf
Code: [Select]
private ["_bullet", "_initSpeed", "_vel", "_velSqr", "_ratio", "_velRail"];
_bullet = nearestObject [_this select 0 select 0, _this select 0 select 4];
_initSpeed = _this select 1;
_vel = velocity _bullet;
_velSqr = 0;
{_velSqr = _velSqr + (_vel select _x)*(_vel select _x)} forEach [0, 1, 2];
_ratio = _initSpeed / (sqrt _velSqr);
_velRail = [];
{_velRail = _velRail + [_ratio * (_vel select _x)]} forEach [0, 1, 2];
_bullet setVelocity _velRail;

« Last Edit: 25 Jun 2008, 20:47:52 by Mr.Peanut »
urp!

Offline tateyou

  • Members
  • *
Re: About muzzle velocity and ammunition
« Reply #2 on: 26 Jun 2008, 11:09:07 »
Thanks a lot, but is there a way to creat an independent PBO instead of using in mission?