Jump to content
scotg

Trying to figure out alternating fire mode for custom vehicle weapons

Recommended Posts

Does anyone have knowledge with creating custom vehicle weapon arrangements? I've tried searching, but I either overlooked relevant results, or there weren't any. Here's what I'm trying to do:

I have a tank with two main guns, which are in the same class as a M2A2 Bradley main gun - only larger caliber (45mm). I want it to have modes for "sustained alternating fire - fast," "sustained alternating fire - slow," and "sustained simultaneous fire - slow." It's more important to figure out the "sustained alternating fire" modes because I hope to use what I learn for a smaller, four-barrel (.50 M2 x4), tracked anti-personnel armored vehicle, planned for future development, and I don't want all barrels to fire at once.

Share this post


Link to post
Share on other sites

well that goes all the way down to modeling and memory points. Might want to do a request on the forums, 

Share this post


Link to post
Share on other sites

I have created a custom model, complete with the LODs, geom, memory points, etc. It even drives pretty well in Eden; I'm just trying to arrange the config of the turret, especially the main guns, so it makes sense for the vehicle's design. I have "usti hlavne 1" renamed to muzzle1 and "usti hlavne 2" renamed to muzzle2 for memory points. For animations I have gunrecoil1_axis, gunrecoil2_axis... but they move together. I'd like to know how to make the firing and animations alternate.

 

The twin-fire vehicles in Arma3 (e.g.: tracked AA vehicles) all fire in simultaneous mode only, or so it first appears. I didn't recognize any scripting that changed this in their config.cpp's.

Also, I wanted to know how to create and assign custom ammo. If modeling is required here, then I would indeed need to know what memory points to create, and especially the scripting.

Share this post


Link to post
Share on other sites

custom ammo? Maybe, I don't think that's necessarily requiring a model for the ammo. 

  • Like 1

Share this post


Link to post
Share on other sites

You're probably right, but I wasn't sure. Comparing the vanilla content to mod content, I noticed that BIS vehicles refer to BIS ammo, but RHS vehicles refer to RHS ammo, which led me to wonder if custom ammo needs custom 3D meshes. I know 0.00 about ArmA 3 ammo scripting; I just know there seems to be more to it than what is found in the vehicle configs. Skimming through the BIS and RHS configs, I couldn't pinpoint where big ammo is.

 

Side note: I imagine custom missiles would definitely need custom models, since they are bigger than ballistic rounds and sometimes exposed.

Share this post


Link to post
Share on other sites

I tried setting up a new fire mode in my tank's cfgWeapons class, based off of cannonCore. I got alternate firing (1, 2, 1, 2, 1, 2, etc.) sort of working. Projectiles were alternating barrels, but the muzzle flash and recoil animations were not working. To be fair, they were only half working before (i.e.: not alternating). I had had the choice to either name both barrels the same or to just have one barrel firing.

Share this post


Link to post
Share on other sites

Here's what I want to achieve: I want two barrels to take turns firing automatically. Each barrel's animation should be like a quick pop, and then a quick pause before the other barrel "pops."
Here's what is happening: The barrel keeps popping far more rapidly than the actual fired round. Rounds are firing in the desired intervals, taking turns, but both muzzle flashes are occurring when each round is fired. Note: I disabled one barrel until I get the animation just right.

config pertinents:

class cfgWeapons
{
	class CannonCore;
	class hissGuns: CannonCore
	{
		scope = 1;
		displayName = "HISS Guns";
		nameSound = "turret";
		cartridgePos = "cartridge_pos";
		cartridgeVel = "cartridge_dir";
		cursor = "emptyCursor";
		cursorAim = "mg";
		cursorAimOn = "";
		cursorSize = 1;
		canLock = 2;
		class gunParticles
		{
			class effect1
			{
				positionName = "cartridge_pos";
				directionName = "cartridge_dir";
				effectName = "MachineGunCartridge1";
			};
		};
		//magazines[] = {"RDS_40Rnd_23mm_AZP85","RDS_2000Rnd_23mm_AZP85"};
		magazines[] = {"140Rnd_30mm_MP_shells_Tracer_Yellow","60Rnd_30mm_APFSDS_shells_Tracer_Yellow"};
		magazineReloadTime = 1;
		modes[] = {"manual"};
		class manual: CannonCore
		{
			displayName = "Alternating Fire";
			autoFire = 1;
			sounds[] = {"StandardSound"};
			class StandardSound
			{
				//weaponSoundEffect = "DefaultRifle";
				begin1[] = {"hiss\sound\vehicles\weapons\hissGun_Fire",5,1,1500};
				soundBegin[] = {"begin1",1};
			};
			reloadTime = 0.3;
			dispersion = 0.0005;
			multiplier = 1;
			soundContinuous = 0;
			showToPlayer = 1;
			burst = 1;
			aiRateOfFire = 0.5;
			aiRateOfFireDistance = 50;
			minRange = 1;
			minRangeProbab = 0.01;
			midRange = 2;
			midRangeProbab = 0.01;
			maxRange = 3;
			maxRangeProbab = 0.01;
		};
	};
};

class CfgVehicles
{
		class Turrets: Turrets
		{
			class MainTurret: MainTurret
			{
				class ViewGunner;
				class Turrets: Turrets
				{
					class CommanderOptics: CommanderOptics
					{
						body = "obsTurret";
						gun = "obsGun";
						animationSourceBody = "obsTurret";
						animationSourceGun = "obsGun";
						memoryPointGunnerOutOptics = "commanderview";
						memoryPointGunnerOptics = "commanderview";
						minElev = -4;
						maxElev = 20;
						initElev = 0;
						minTurn = -360;
						maxTurn = 360;
						initTurn = 0;
						hideWeaponsGunner = 1;
						weapons[] = {"SmokeLauncher"};
						magazines[] = {"SmokeLauncherMag","SmokeLauncherMag"};
						turretInfoType = "RscWeaponRangeFinder";
						gunnerAction = mbt2_slot2b_out;
						gunnerInAction = mbt2_slot2b_in;
						gunnerGetInAction = GetInHigh;
						gunnerGetOutAction = GetOutHigh;
						gunnerDoor = "hatchG";
						gunnerOpticsModel = "\A3\weapons_f\reticle\Optics_Commander_02_F";
						gunnerOutOpticsModel = "";	// leave "" to disable optics view
						gunnerOpticsEffect[] = {};	// post processing effets
						class ViewOptics: ViewOptics {
							initAngleX=0;
							minAngleX=-30;
							maxAngleX=+30;
							initAngleY=0;
							minAngleY=-100;
							maxAngleY=+100;
							// Field of view values: 1 = 120°
							initFov=0.155;
							minFov=0.034;
							maxFov=0.155;
							visionMode[] = {"Normal","TI"};
							thermalMode[] = {0,1};
						};
						startEngine = 0;
						gunnerHasFlares = 1;
						viewGunnerInExternal = 1;
						outGunnerMayFire = 0;  // Turn off to make player able to look around freely outside optics view.
						inGunnerMayFire = 0;   // Turn off to make player able to look around freely outside optics view.
						class HitPoints
						{
							class HitTurret
							{
								armor = 0.3;
								material = -1;
								name = "vezVelitele";
								visual = "vezVelitele";
								passThrough = 0;
								minimalHit = 0.03;
								explosionShielding = 0.001;
								radius = 0.25;
							};
							class HitGun
							{
								armor = 0.3;
								material = -1;
								name = "zbranVelitele";
								visual = "zbranVelitele";
								passThrough = 0;
								minimalHit = 0.03;
								explosionShielding = 0.001;
								radius = 0.25;
							};
						};
					};
				};
				//gunBeg = "usti hlavne 1";
				//gunEnd = "konec hlavne 1";
				memoryPointGun[] = {"usti hlavne 1","usti hlavne 2"};
				
				weapons[] = {"hissGuns"};
				magazines[] = {"140Rnd_30mm_MP_shells_Tracer_Yellow","60Rnd_30mm_APFSDS_shells_Tracer_Yellow"};
				soundServo[] = {"A3\sounds_f\dummysound",0.031622775,1.0,30};
				minElev = -5;
				maxElev = 57;
				initElev = 2;
				gunnerAction = "gunner_apctracked3_out";
				gunnerInAction = "gunner_apctracked3_in";
				gunnerGetInAction = "GetInHigh";
				gunnerGetOutAction = "GetOutHigh";
				gunnerDoor = "";
				viewGunnerInExternal = 1;
				castGunnerShadow = 1;
				forceHideGunner = 0;
				stabilizedinaxes = 3;
				gunnerOpticsModel = "\A3\weapons_f\reticle\Optics_Gunner_02_F";
				gunnerOutOpticsModel = "";
				// FCS
				turretInfoType = "RscOptics_APC_Tracked_03_gunner";
				discreteDistance[] = {100,200,300,400,500,600,700,800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800};
				discreteDistanceInitIndex = 5;
				
				memoryPointGunnerOptics = "gunnerview";				
				gunnerHasFlares = 1;
				maxhorizontalrotspeed = 1.04;
				maxverticalrotspeed = 1.04;
				startengine = 0;
				hideWeaponsGunner = 1;
				selectionFireAnim = "zasleh2";
				
				class OpticsIn: Optics_Gunner_APC_02
				{
					class Wide: Wide{};
					class Medium: Medium{};
					class Narrow: Narrow{};
				};
				turretInfoType = "RscOptics_APC_Tracked_03_gunner";
				class HitPoints
				{
					class HitTurret
					{
						armor = 0.6;
						material = -1;
						name = "vez";
						visual = "vez";
						passThrough = 0;
						minimalHit = 0.1;
						explosionShielding = 0.4;
						radius = 0.25;
					};
					class HitGun
					{
						armor = 0.4;
						material = -1;
						name = "zbran";
						visual = "";
						passThrough = 0;
						minimalHit = 0.1;
						explosionShielding = 0.8;
						radius = 0.25;
					};
				};
			};
		};
		class AnimationSources : AnimationSources
		{
			/* class muzzle_rot_cannon {source = "ammorandom"; weapon = "hissGuns";};
			class muzzle_source
			{
				source = "reload";
				weapon = "hissGuns";
			}; */
			class recoil_source
			{
				source = "reload";
				weapon = "hissGuns";
			};
		};
};

model.cfg settings:

class recoil_L1
			{
				type="translation";
				source="recoil_source";
				selection="gunrecoil1";
				axis="gunrecoil1_axis";//*probably*
				sourceAddress = loop;
				minValue = 0.2;//rad 28.64789
				maxValue = 0.4;//rad 45.836624
				offset0 = 0.2;
				offset1 = 0.0;
				animPeriod = 0.0;
				initPhase = 0;
//				memory = true;//(default assumed)
			};
			/*
			class recoil_R
			{
				type="translation";
				source="recoil_source";
				selection="gunrecoil2";
				axis="gunrecoil2_axis";//*probably*
				sourceAddress = mirror;
				minValue = 0.001//rad 28.64789
				maxValue = 0.02;//rad 45.836624
				offset0 = 0.2;
				offset1 = 0.0;
				animPeriod = 0.0;
				initPhase = 1;
//				memory = true;//(default assumed)
			};
			*/

Here's what I think I've learned:
When sourceAddress is "clamp" I can almost get the desired animations, but it either only plays once or is frozen in one position - a non-animation. "Loop" plays the animation over and over again, but it doesn't cooperate with multiple phases of the animation (at least not in a way that I could figure out). I tried using this and starting the animation with an offset value after a delay to fake the "pop." The result is that the animation looks like it's going way too fast and continuously, but changing the minValue and maxValue did nothing. "Mirror" seems to do the same as loop, except that it reverses the animation once its limit has been reached. It also continues to animate out of sync with the fired rounds. Because of this, I can't tell if it condenses the whole animation into the time range, or if it extends the time range to fit the mirrored portion in.


Isn't there a way to set up the animation for a single shot, and then let the game sync it up with the fired round? That's what I thought I was doing, but it's proving to be more convoluted than it should be.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×