Post by Sa8Gecko on Oct 26, 2004 6:22:15 GMT -5
The purpose of this guide is to show you how to configure
your own AA missiles in config.cpp to use them with MCAR
vehicles. It will show you what functions need to modified too.
This guide is for beta 2.5 MCAR standard Gaskin and Gaskin IR.
Place all your questions about this argument in this thread.
1) O2 modelling
I hope you know how to model a missile: I will not explain
it there, but you can take a look at tutorial on the web or
de-pbo the ammo.pbo in MCAR files.
The important thing is that you need a geometry LOD:
don't forget it.
When you've done with the basic model (the head of the
missile should point to left in left view...), you need to
create some more.
But don't panic, it's easy ! Just take the basic model,
rotate it (all the lods) 15 degrees clockwise and save it
as another file (i.e.: stinger_p15.p3d). Now take this
model, rotate it 15 degrees further clockwise and save it
as, for example, stinger_p30.p3d. Do it again until you
reach 90 degrees (the missile should point to the zenith).
Now take back the basic model and rotate it 15 degrees
counterclockwise, then save it, for example as stinger_m15.p3d.
Continue with rotating the models until the missile poinst
-90 degrees (nadir).
Now you should have obtained 13 missile models. This
procedure is necessary because you can't (as now, maybe
BIS will patch this) set the pitch of an object, missiles included.
So we try to make something that will look pretty odd
(a missile climbing, but always staying horizontal) look a
little better.
2) config.cpp
Put the following line under CfgModels, one for each missile model:
The above example refers directly at the Gaskin's missile,
where xx stands for the various tilted missile. Look at
the MCAR config to see how's done.
Next, CfgAmmo:
here is how our gaskin missile is configured in config.cpp:
the important parameters are 'model', that should refer
to your own missile model;
'hit' and 'indirectHit': assign them the desired values: don't
exceed too much 200 for 'Hit' and '150' for 'indirectHit' as
you'll obtain an overkiller. Remember that the more the
difference between 'hit' and 'indirectHit' (being 'hit' the higher
between the two) the more the damage will result for
a direct hit, and the less the damage will be done to
sorrounding areas. That means that a missile with 200 for
'hit' and '150' for indirectHit will not down a plane equipped
with 180 armor with a single, well centered hit (given the
same indirectHitRange value), while one with 200-20 will
(but will do little damage if exploding by proximity fuse).
I suggest to set indirectHit at 3/4 of hit to simulate the
fragmentation warhead of the missile.
Another important parameter is indirectHitRange: don't
set it too large, if you don't want an overkiller. The gaskin
guidance code is rather precise (better than the BIS standard
one) and if the scenario is not overcrowded (or too many
scripts are running) it will hit its target 95% of the times
(100% if the plane is not flying too high and too near (both) the
launcher when the missile is launched). If you observe
degradation in the results above then: you don't have a
recent PC or the settings are too high; or the scenario is
overcrowded and too many scripts are running; or you fired
to a very fast plane going away from you, so the missile
finished its fuel before reaching the target; all of the above.
Then the most important parameters:
'thrust' and 'initTime'. First, 'initTime': set it to zero. We
don't want the missile flashing at night when it's substituted
with the one with the correct pitch.
'thrust': set it very, very low. If it's bigger than a certain
value it will spoil the missile guidance code and set the
missile off course. Try experimenting and see it by yourself.
Then you have to set all the other missile models too:
it's a simple matter of copy and paste, but remember to
change the class name accordingly.
For example, here's how are defined the other missile
models, from the basic one, in MCAR config:
the other thing you need is a 'proximity fuse' activator,
but you can copy ours (RKT_detonator).
3)functions and scripts
in fired.sqs you need to substitute the gaskin basic
missile model (RKT_9M31_00) with your own.
In the same way you have to substitute all the missile type
strings in tiltmissileAA.sqf (_misArray) with your
own. Pay attention to substitute exactly each tilted missile
with the one of yours corresponding to it in pitch, or you
may obtain odd result.
In guidmis_8.sqs modify this line:
if you want to change the missile life duration to more than
15 seconds: change 7 with a higher number (less than 10).
Also, you have to modify this line too:
change the '15' with something more (less than 20).
You can also reduce missile life diminishing the aforementioned
parameters instead of augmenting them.
The reason for the '10' and '20' limit is that the missile
lifetime in OFP is ten seconds. So even your own missiles,
even if not guided by OFP engine, will live only ten seconds
before being destroyed automatically. You could make
the missiles 'live' more (that is, a succession of missiles
simulating a single missile), but you must modify further
the scripts. Let's see how:
- at the start of guidMis_8.sqs, before the '#Loop' label,
put this line:
- then modify the following line:
as below:
- skip next line of code and replace this line:
with this one:
- then you have to change missile lifetime too, modifying
this line:
change the '15' with the number of seconds you'd like the
missile to live. Done.
The procedure above is valid for the other Gaskin guidance
codes too.
Changing missile parameters such as acceleration and
max speed requires the modification of some other file.
In setspeed.sqf changing this portion of the code
will change the behaviour of the missile:
'100' is the acceleration of the missile. Change this
accordingly to your needs. '10' is the time after which the
missile will start to decelerate.
'450' is missile max speed in meters/secs. Change this in
all instances this value appear if you want to modify the
maximum speed. '20' is the deceleration rate in m/(s^2).
If you want your missile to loose speed rapidly raise this
parameter (but do your calculations so the missile won't
end its life with a negative speed !!! maximum deceleration
possible is equal to max speed/(seconds remaining to live) )
Then the turning rate. To obtain a more maneuvrable missile
raise the '60' value. Otherwise diminish it. Remember to
replace the new value in every place '60' appears in
this function.
Then you could modify the maximum climbing acceleration rate of the
missile. For this, open vz.sqf and modify '90' in
something different, if you want your missile to accelerate
faster or slower in the z direction.
your own AA missiles in config.cpp to use them with MCAR
vehicles. It will show you what functions need to modified too.
This guide is for beta 2.5 MCAR standard Gaskin and Gaskin IR.
Place all your questions about this argument in this thread.
1) O2 modelling
I hope you know how to model a missile: I will not explain
it there, but you can take a look at tutorial on the web or
de-pbo the ammo.pbo in MCAR files.
The important thing is that you need a geometry LOD:
don't forget it.
When you've done with the basic model (the head of the
missile should point to left in left view...), you need to
create some more.
But don't panic, it's easy ! Just take the basic model,
rotate it (all the lods) 15 degrees clockwise and save it
as another file (i.e.: stinger_p15.p3d). Now take this
model, rotate it 15 degrees further clockwise and save it
as, for example, stinger_p30.p3d. Do it again until you
reach 90 degrees (the missile should point to the zenith).
Now take back the basic model and rotate it 15 degrees
counterclockwise, then save it, for example as stinger_m15.p3d.
Continue with rotating the models until the missile poinst
-90 degrees (nadir).
Now you should have obtained 13 missile models. This
procedure is necessary because you can't (as now, maybe
BIS will patch this) set the pitch of an object, missiles included.
So we try to make something that will look pretty odd
(a missile climbing, but always staying horizontal) look a
little better.
2) config.cpp
Put the following line under CfgModels, one for each missile model:
class RKT_9m31_xx: Weapon {};
The above example refers directly at the Gaskin's missile,
where xx stands for the various tilted missile. Look at
the MCAR config to see how's done.
Next, CfgAmmo:
here is how our gaskin missile is configured in config.cpp:
class RKT_9m31_00: AT3
{
model="\psy_mcar_ammo\9m31\9M31";
minRange=75;
minRangeProbab=0.95;
midRange=600;
maxRange=2500;
maxRangeProbab=0.75;
hit=200;
indirectHit=120;
indirectHitRange=7;
thrustTime=20;
thrust=20;
initTime=0;
maneuvrability=7.5;
maxSpeed=1800;
airlock=1;
irLock=1;
laserLock=1;
maxControlRange=100000;
soundFly[]={"\psy_mcar_sound\psy_mcar_rocketfly.wav",db15,1.2};
};
the important parameters are 'model', that should refer
to your own missile model;
'hit' and 'indirectHit': assign them the desired values: don't
exceed too much 200 for 'Hit' and '150' for 'indirectHit' as
you'll obtain an overkiller. Remember that the more the
difference between 'hit' and 'indirectHit' (being 'hit' the higher
between the two) the more the damage will result for
a direct hit, and the less the damage will be done to
sorrounding areas. That means that a missile with 200 for
'hit' and '150' for indirectHit will not down a plane equipped
with 180 armor with a single, well centered hit (given the
same indirectHitRange value), while one with 200-20 will
(but will do little damage if exploding by proximity fuse).
I suggest to set indirectHit at 3/4 of hit to simulate the
fragmentation warhead of the missile.
Another important parameter is indirectHitRange: don't
set it too large, if you don't want an overkiller. The gaskin
guidance code is rather precise (better than the BIS standard
one) and if the scenario is not overcrowded (or too many
scripts are running) it will hit its target 95% of the times
(100% if the plane is not flying too high and too near (both) the
launcher when the missile is launched). If you observe
degradation in the results above then: you don't have a
recent PC or the settings are too high; or the scenario is
overcrowded and too many scripts are running; or you fired
to a very fast plane going away from you, so the missile
finished its fuel before reaching the target; all of the above.
Then the most important parameters:
'thrust' and 'initTime'. First, 'initTime': set it to zero. We
don't want the missile flashing at night when it's substituted
with the one with the correct pitch.
'thrust': set it very, very low. If it's bigger than a certain
value it will spoil the missile guidance code and set the
missile off course. Try experimenting and see it by yourself.
Then you have to set all the other missile models too:
it's a simple matter of copy and paste, but remember to
change the class name accordingly.
For example, here's how are defined the other missile
models, from the basic one, in MCAR config:
class RKT_9m31_15: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_15";
};
class RKT_9m31_30: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_30";
};
class RKT_9m31_45: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_45";
};
class RKT_9m31_60: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_60";
};
class RKT_9m31_75: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_75";
};
class RKT_9m31_90: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_90";
};
class RKT_9m31_m15: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_-15";
};
class RKT_9m31_m30: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_-30";
};
class RKT_9m31_m45: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_-45";
};
class RKT_9m31_m60: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_-60";
};
class RKT_9m31_m75: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_-75";
};
class RKT_9m31_m90: RKT_9m31_00
{
model="\psy_mcar_ammo\9m31\9M31_-90";
};
the other thing you need is a 'proximity fuse' activator,
but you can copy ours (RKT_detonator).
3)functions and scripts
in fired.sqs you need to substitute the gaskin basic
missile model (RKT_9M31_00) with your own.
In the same way you have to substitute all the missile type
strings in tiltmissileAA.sqf (_misArray) with your
own. Pay attention to substitute exactly each tilted missile
with the one of yours corresponding to it in pitch, or you
may obtain odd result.
In guidmis_8.sqs modify this line:
? (_time - _misTime >7) && (_change == 0): _change =1
if you want to change the missile life duration to more than
15 seconds: change 7 with a higher number (less than 10).
Also, you have to modify this line too:
? (_time - _misTime)>15: _chaff = _Missile call PSY_MCAR_detonate ; goto "deleteTarget"
change the '15' with something more (less than 20).
You can also reduce missile life diminishing the aforementioned
parameters instead of augmenting them.
The reason for the '10' and '20' limit is that the missile
lifetime in OFP is ten seconds. So even your own missiles,
even if not guided by OFP engine, will live only ten seconds
before being destroyed automatically. You could make
the missiles 'live' more (that is, a succession of missiles
simulating a single missile), but you must modify further
the scripts. Let's see how:
- at the start of guidMis_8.sqs, before the '#Loop' label,
put this line:
_ch = 1
- then modify the following line:
? (_time - _misTime >7) && (_change == 0): _change =1
as below:
? (_time - _misTime >7*_ch): _change =1; _ch = _ch +1
- skip next line of code and replace this line:
? _change == 1: _change = 2
with this one:
_change = 0
- then you have to change missile lifetime too, modifying
this line:
? (_time - _misTime)>15: _chaff = _Missile call PSY_MCAR_detonate ; goto "deleteTarget"
change the '15' with the number of seconds you'd like the
missile to live. Done.
The procedure above is valid for the other Gaskin guidance
codes too.
Changing missile parameters such as acceleration and
max speed requires the modification of some other file.
In setspeed.sqf changing this portion of the code
will change the behaviour of the missile:
if ((_time -_misTime)<10) then
{
_speed = 70 + (100* (_time - _misTime));
} else
{
_speed = 450 - (20* (_time - _misTime - 10));
};
if (_speed > 450) then { _speed = 450;};
_turnRate = (_speed - 65)*((_time - _misTime)/3);
if (_turnRate > 60) then { _turnRate = 60;};
'100' is the acceleration of the missile. Change this
accordingly to your needs. '10' is the time after which the
missile will start to decelerate.
'450' is missile max speed in meters/secs. Change this in
all instances this value appear if you want to modify the
maximum speed. '20' is the deceleration rate in m/(s^2).
If you want your missile to loose speed rapidly raise this
parameter (but do your calculations so the missile won't
end its life with a negative speed !!! maximum deceleration
possible is equal to max speed/(seconds remaining to live) )
Then the turning rate. To obtain a more maneuvrable missile
raise the '60' value. Otherwise diminish it. Remember to
replace the new value in every place '60' appears in
this function.
Then you could modify the maximum climbing acceleration rate of the
missile. For this, open vz.sqf and modify '90' in
something different, if you want your missile to accelerate
faster or slower in the z direction.