PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Warfare 2. zusaetzliche Artellerie


Hannibal
09.10.2008, 19:14
Hallo,

Ich möchte in der Warfare eine zusätzliche Artellerie für den Osten hinzufügen,
habe soweit auch die Config_Artillery.sqf angepasst.

//Last modified 12/18/7
//************************************************** ***************************************
//Description: Artillery information.
//************************************************** ***************************************

westArtilleryNames = ["M119"];
westArtilleryWeapons = ["M119"];
westArtilleryAmmos = ["Sh_105_HE"];
westArtilleryMagazines = ["30Rnd_105mmHE_M119"];
westArtilleryMinRanges = [100];
westArtilleryMaxRanges = [4000];
westArtilleryReloadTimes = [8];
westArtilleryVelocities = [1100];

//Dispersion in km at max range.
westArtilleryDispersions = [50];

eastArtilleryNames = ["D30","VIL_2s7"];
eastArtilleryWeapons = ["D30","VIL_2s7_203mm"];
eastArtilleryAmmos = ["Sh_122_HE","VIL_Sh_203_s7vibi"];
eastArtilleryMagazines = ["30Rnd_122mmHE_D30","VIL_2s7_mag"];
eastArtilleryMinRanges = [100];
eastArtilleryMaxRanges = [4000];
eastArtilleryReloadTimes = [8];
eastArtilleryVelocites = [1100];

//Dispersion in km at max range.
eastArtilleryDispersions = [50];

//************************************************** ***************************************
//12/18/7 MM - Created file.


Aber leider funktioniert nur die D30 Artellerie und die zweite Artellerie (VIL_2s7) , feuert nur aber es kommen keine Einschläge im Zielgebiet an

Habe auch das ganze nur mit der VIL_2s7 Artellerie getestet (ohne die D30 Artellerie) und es hat funktioniert

Mfg

Hannbal

Hannibal
28.11.2008, 04:33
So nun konnte 2 weitere Skripte die wohl für die Artillerie zuständig sind ausmachen

Config_Artillery.sqf siehe erster post

Common_FireArtillery.sqf

//Last modified 5/9/8
//************************************************** ***************************************
//Description: Aim and fire artillery.
//************************************************** ***************************************

Private["_ammo","_angle","_arcDistance","_artillery","_destination","_direction","_distance","_minRange","_maxRange","_position","_radius","_shell","_side","_type","_velocity","_weapon","_x","_y"];

_artillery = _this Select 0;
_destination = _this Select 1;
_side = _this Select 2;
_radius = _this Select 3;

_type = Call Compile Format["%1ArtilleryNames Find TypeOf _artillery",Str _side];
if (_type == -1) ExitWith {};

_minRange = Call Compile Format["%1ArtilleryMinRanges Select _type",Str _side];
_maxRange = Call Compile Format["%1ArtilleryMaxRanges Select _type",Str _side];
_weapon = Call Compile Format["%1ArtilleryWeapons Select _type",Str _side];
_ammo = Call Compile Format["%1ArtilleryAmmos Select _type",Str _side];
_velocity = Call Compile Format["%1ArtilleryVelocities Select _type",Str _side];
_dispersion = Call Compile Format["%1ArtilleryDispersions Select _type",Str _side];

if (IsNull Gunner _artillery) ExitWith {};
if (IsPlayer Gunner _artillery) ExitWith {};

_position = GetPos _artillery;
_x = (_destination Select 0) - (_position Select 0);
_y = (_destination Select 1) - (_position Select 1);

_direction = -(((_y atan2 _x) + 270) % 360);
if (_direction < 0) then {_direction = _direction + 360};

_distance = sqrt ((_x ^ 2) + (_y ^ 2)) - _minRange;
_angle = _distance / (_maxRange - _minRange) * 100 + 15;

if (_angle > 90) then {_angle = 90};
if (_distance < 0 || _distance + _minRange > _maxRange) ExitWith {};

_watchPosition = [(_position Select 0) + (sin _direction) * 50,(_position Select 1) + (cos _direction) * 50,_angle];
Gunner _artillery DoWatch _watchPosition;

Sleep (3 + Random 3);

_amount = _artillery Ammo _weapon;
_artillery Fire _weapon;

WaitUntil {_artillery Ammo _weapon < _amount};

_shell = nearestObject [_artillery,_ammo];

_shell SetPos [0,0,1000 + Random 20];
_shell SetVelocity [0,0,0];

//Rough approximation of the distance the shell will travel in a parabola.
_arcDistance = sqrt((_distance ^ 2) * 2);

//Wait until shell should arrive.
Sleep (_arcDistance / _velocity);

_distance = Random (_distance / _maxRange * 100) + Random _radius;
_direction = Random 360;
_shell SetPos [(_destination Select 0)+((sin _direction)*_distance),(_destination Select 1)+((cos _direction)*_distance),400];
_destination = [(_destination Select 0)+((sin _direction)*_distance),(_destination Select 1)+((cos _direction)*_distance),400];
_shell SetVelocity [0,0,-_velocity];

//************************************************** ***************************************
//12/18/7 MM - Created file.


Common_GetTeamArtillery.sqf

//Last modified 4/4/8
//************************************************** ***************************************
//Description: Get artillery in range that belongs to the team.
//************************************************** ***************************************
Private["_artillery","_count","_destination","_ignoreAmmo","_position","_range","_team","_unit","_units","_vehicle","_x","_y"];

_team = _this Select 0;
_destination = _this Select 1;
_range = _this Select 2;

_ignoreAmmo = false;
if (Count _this > 3) then {_ignoreAmmo = _this Select 3};

_units = Units _team;
_artillery = [];

_names = Call Compile Format["%1ArtilleryNames",Str Side _team];
_weapons = Call Compile Format["%1ArtilleryWeapons",Str Side _team];

for [{_count = Count _units},{_count >= 0},{_count = _count - 1}] do
{
_unit = _units Select _count;
_vehicle = Vehicle _unit;
_type = _names Find TypeOf _vehicle;

if (_type != -1 && !IsNull Gunner _vehicle && !(_vehicle In _artillery)) then
{
if (!IsPlayer Gunner _vehicle) then
{
_weapon = _weapons Select _type;

if (_ignoreAmmo || (_vehicle Ammo _weapon > 0)) then
{
_position = GetPos _vehicle;
_x = (_position Select 0) - (_destination Select 0);
_y = (_position Select 1) - (_destination Select 1);

if (sqrt ((_x ^ 2) + (_y ^ 2)) < _range) then
{
_artillery = _artillery + [_vehicle];
};
};
};
};
};

_artillery

//************************************************** ***************************************
//12/18/7 MM - Created file.