Home   Help Search Login Register  

Author Topic: Starshell Launcher/Mortar  (Read 1312 times)

0 Members and 1 Guest are viewing this topic.

johnnylump

  • Guest
Starshell Launcher/Mortar
« on: 02 Nov 2002, 18:29:39 »
Forgive me if this is bad form, but I am trying to modify GFX707's excellent mortar addon to fire flares (preferably at 45-60 second intervals).

This would function as an illumination device over a nighttime battlefield.

I have it so it can actually hold flares as ammo, but it refuses to fire under any circumstances (including when manually triggered by the player).

I'd like to post the .cpp here, which is a modified version of GFX707's. Moderators, is that permissible?

Otherwise, can anyone suggest how to get flares to fire from an emplaced weapon like an M2?
« Last Edit: 02 Nov 2002, 20:25:42 by johnnylump »

Offline SelectThis

  • Former Staff
  • ****
  • .
Re:Starshell Launcher/Mortar
« Reply #1 on: 03 Nov 2002, 14:58:00 »
I don't see a problem with just posting the cpp here to help with problem solving...but of course if you plan to release it publically then you would need permission from the author (just a email away).

SelectThis

johnnylump

  • Guest
Re:Starshell Launcher/Mortar
« Reply #2 on: 03 Nov 2002, 17:42:29 »
Thanks, STT ... will do.

Below is my sorry mess. Again, flares load into the mortar, but neither the AI nor the player is able to fire them:

#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define true 1
#define false 0

// type scope
#define private 0
#define protected 1
#define public 2


class CfgPatches
{
   class mortar2
   {
      units[] = {mortar2WF};
      requiredVersion = 1.46;
   };

};

class CfgAmmo
{
   class Default{};
   class Grenade: Default {};
   class Flare: Grenade{};
};

class WeaponFireGun {};
class WeaponCloudsGun {};
class WeaponFireMGun: WeaponFireGun {};
class WeaponCloudsMGun: WeaponCloudsGun {};

class CfgWeapons
{
   class Default{};
   class GrenadeLauncher: Default{};
   class Mortar2WF: GrenadeLauncher{
        ammo=Flare;
   count=200;
   displayname="Flare"
   displayNameMagazine="Flare";
   shortNameMagazine="Flare";
   initSpeed=100;
   reloadTime=45;
   magazineReloadTime=1;
   optics = 0;
   sound[]={"\M29Illum\RifleGrenade.ogg",4.000000,1};

};
};

class mortar2Clouds : WeaponCloudsMGun{
   access=3;
   cloudletGrowUp=0.050000;
   cloudletFadeIn=0;
   cloudletFadeOut=0.100000;
   cloudletDuration=0.050000;
   cloudletAlpha=0.300000;
   cloudletAccY=0;
   cloudletMinYSpeed=-100;
   cloudletMaxYSpeed=100;
   interval=0.020000;
   size=0.000000;
   sourceSize=0.020000;

};

class CfgVehicles
{
   class All{};
   class AllVehicles:All{};
   class Land: AllVehicles{};
   class LandVehicle: Land{};
   class Tank: LandVehicle{};  
   class APC: Tank{};
   class M113:APC{};
   class M2StaticMG: M113{};
   class mortar2WF: M2StaticMG
   {
      displayName="M-29 Illuminator";
                model="\m29illum\mortar2";
      cost=15000;
      weapons[]={"Mortar2WF"};
      magazines[]={"Mortar2WF"};
           side=1;
      crew="SoldierWB";
      sensitivity=3;
      hasdriver=0;
          hasCommander=0;
      hasgunner=1;
      threat[]={1,0.100000,0.100000};
      armor=20;
      armorStructural=5.000000;
      icon="kulomet.paa";
      gunnerAction="ManActmortar2Gunner";
      gunnerInAction="ManActmortar2Gunner";
      class GunFire: WeaponCloudsMGun{};
      class GunClouds: mortar2Clouds {};
      class MGunFire: WeaponFireMGun {};
      class MGunClouds: WeaponCloudsMGun {};
      class Turret
      {
         gunAxis = "osahlavne";
         turretAxis = "osaveze";
         soundServo[]={Vehicles\gun_elevate2,db-30,1.0};

         gunBeg = "usti hlavne";
         gunEnd = "konec hlavne";
         
         body = "OtocVez";
         gun = "OtocHlaven";

         minElev=-30;
         maxElev=+90;
         minTurn=-60;
         maxTurn=+60;
      };

      class ComTurret
      {
         turretAxis="OsaVelitele";
         gunAxis="OsaHlavneVelitele";
         soundServo[]={"Vehicles\gun_elevate2",0.000316,1.200000};
         gunBeg="usti hlavne";
         gunEnd="konec hlavne";
         minElev=-4;
         maxElev=20;
         minTurn=-360;
         maxTurn=360;
         body="OtocVelitele";
         gun="OtocHlavenVelitele";
      };
   };


};

class CfgNonAIVehicles
{
   class ProxyWeapon{};
   class Proxytmortar2: ProxyWeapon{};
};

class CfgVehicleActions
{
   mortar2Gunner="CombatToMedic";
};

class EventHandlers
{
fired = "if ((_this select 3) == ""Flare"") then {fire [""Grenadesmuzzle"",""Flare"",""Flare""]}";
Init = "fire [""Grenadesmuzzle"",""Flare"",""Flare""]";
};
};

Offline DaCoroner

  • Members
  • *
Re:Starshell Launcher/Mortar
« Reply #3 on: 05 Nov 2002, 18:45:47 »
I ran into the same problem some time ago... unfortunately it seems that BIS, in their infinite wisdom, made it so vehicles cannot fire anything except boring old projectiles, no smoke rounds, no flare rounds.  Funny thing is, you can give a tank "throw" as it's main weapon and use it to toss hand grenades (not smoke ones though), but you can get it to fire off a flare.

Annoying isn't it :)  I think you'll have to script something.