Home   Help Search Login Register  

Author Topic: AI shoots too high with launchers  (Read 2719 times)

0 Members and 1 Guest are viewing this topic.

Offline flashist

  • Members
  • *
AI shoots too high with launchers
« on: 12 Mar 2014, 12:32:53 »
Hi guys,
I have little problem with LAW, RPG NH-75 and RPG7 in my mod.
When AI engages a tank they are shoot too high and it turnes them completely useless against enemy armor.
I've checked this via intro in editor : placed soldier with launcher and used his view by setting control by player and tank about 100 meters in front. And every time he tries to shoot a tank he aims too high.
What is going on?

heres the part of config
is something wrong here?
cfgAmmo
   class LAW:AT3
      {
      hit=450;
      indirectHit=50;
      indirectHitRange=2.5;
      minRange=20;
      minRangeProbab=0.5;
      midRange=175;
      midRangeProbab=0.95;
      maxRange=1000;
      maxRangeProbab=0.1;
      model="LAW";
      simulation="shotRocket";
      simulationStep=0.05;
      cost=5000;
      soundHit[]={"Explosions\explosion_at3",31.6227779,1};
      soundFly[]={"objects\noise",0.0001,4};
      maxSpeed=145;
      irLock=1;
      manualControl=1;
      maxControlRange=0;
      initTime=0;
      thrustTime=0.2;
      thrust=2000;
      maneuvrability=0;
      };

   class RPG:LAW
      {
      hit=435;
      maxSpeed=115;
      minRange=20;
      minRangeProbab=0.5;
      midRange=175;
      midRangeProbab=0.95;
      maxRange=920;
      model="RPG";
      };

   class RPG75:LAW
      {
      hit=452;
      maxSpeed=189;
      minRange=20;
      minRangeProbab=0.5;
      midRange=300;
      midRangeProbab=0.95;
      maxRange=100;
      model="RPG";
      };
cfgWeapons
   class LAWLauncher:Default
      {
      scopeWeapon=2;
      scopeMagazine=2;
      weaponType=16;
      magazineType="2 *       256";
      valueWeapon=10;
      valueMagazine=5;
      model="law_proxy";
      modelOptics="optika_LAW";
      ammo="LAW";
      displayName="M72 LAW";
      displayNameMagazine="$STR_MN_LAW";
      shortNameMagazine="$STR_SN_LAW";
      count=1;
      magazineReloadTime=12;
      reloadTime=0.5;
      sound[]={"Weapons\at_launch",0.01,1};
      reloadMagazineSound[]={"Weapons\at_load",0.0003162,1};
      initSpeed=145;
      canLock=0;
      reloadAction=manactreloadat;
      autoReload=0;
      ffMagnitude=0.1;
      ffFrequency=1;
      ffCount=1;
      recoil="LAWSingle";
      aiRateOfFire=10.0;
      aiRateOfFireDistance=500;
      optics=1;
      primary=0;
      opticsZoomMin=0.15;
      opticsZoomMax=0.15;
      distanceZoomMin=150;
      distanceZoomMax=150;
      uiPicture="islaw";
      dexterity=0.5;
      };

   class RPGLauncher:LAWLauncher
      {
      model="\FRM_weap\rpg7_proxy.p3d";
      modelSpecial="\FRM_weap\rpg7_r_proxy.p3d";
modelmagazine="\FRM_misc\mags\pg7_mag";
      modelOptics="optika_RPG";
      ammo="RPG";
      initSpeed=25;
      displayName="RPG-7";
      displayNameMagazine="PG-7";
      shortNameMagazine="PG-7";
      };

   class RPG75Launcher:LAWLauncher
      {
      model="rpg7_proxy";
      modelOptics="optika_RPG";
      ammo="RPG75";
      initSpeed=115;
      displayName="$STR_DN_RPG";
      displayNameMagazine="$STR_MN_RPG";
      shortNameMagazine="$STR_SN_RPG";
      };


Ok i know that this question is propably too difficult to answer forr You, so i tried to solve this problem by myself. I was editing thrust and thrustTime several times and i've get to a point where AI shoots correct (they were taking a gravity correction byt rockets didn't fall down properly) but ie. LAW slows down to almost 0m/s after travelling max 500 meters and after that explodes in the air.Is it because of wrong proportions of thrust , thrustTime and mass in geometry lod of the rocket model?

Thanks for your help guys. I've fixed it by myself. I'm plannig to release this mod it has some features i've never seen before, but according to activity of the OFPEC community i wonder does it have any sense.
« Last Edit: 27 Mar 2014, 13:39:22 by flashist »

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: AI shoots too high with launchers
« Reply #1 on: 17 Apr 2014, 17:44:08 »
I think if you increase the maxspeed the AI will shoot lower. You have to mess with the initspeed, maxspeed and thrust to get optimum AI performance. The problem is that somtimes when it works right for AI, then the player might have problems. You can make different AI ammo than player ammo and use an init event handler to check if the unit is a player. If they are a player, then swith their ammo to the player version. You can check out my MAAWS "Carl Gustov" addon http://www.ofpec.com/forum/index.php?topic=36319.msg248980#msg248980 to see how I made some rockets work for both AI and player units.
« Last Edit: 20 Apr 2014, 20:50:57 by Raptorsaurus »

Offline flashist

  • Members
  • *
Re: AI shoots too high with launchers
« Reply #2 on: 28 Apr 2014, 13:10:23 »
Thanks, but i am planing to use as less scripts as possible, only the necessary ones.I will try to mess up with maxspeed etc today and i'll see what will happen. I suspect that  "distanceZoomMin" and "distanceZoomMax" does matter too because of wrong zeroing. Am i right?

Offline flashist

  • Members
  • *
Re: AI shoots too high with launchers
« Reply #3 on: 08 May 2014, 10:54:09 »
I was trying and didn't get a wanted effect. Ai was still shooting too high or missiles were flying short distances and explode after i.e. 500m, so i decided to return to BIS values and slightly tweaked them. For now i have more important things to do in my mod, so when i'll have some free time i will try to mess up with that. Now i have different questions:
1)How to make script that recognize what part of soldiers body were hit?
2)how to make Ai stop shooting at wounded soldier (it is for let the wounded troop play some "suffering" anim like in FFUR)?

I'm a greenhorn in scripting but i think i know the answer for the second question - when soldier is hit then script assign him to the civilian side or better SetCaptive, and when the anim ends or when he dies return to his previous side.Is it possible?
« Last Edit: 08 May 2014, 13:52:11 by flashist »