Jump to content
Sign in to follow this  
erupter

Invincibility not working

Recommended Posts

I'm feeling stupid, all the more because of beeing a noob and posting in this genious-laden forum.

Anyway, I'm trying the editor and have searched by and large to understand invincibility.

Yet no luck.

I have this code

this addEventHandler ["HandleDamage", {0}];
this allowDamage FALSE;

in the init section of a couple helos, plus I've put a trigger like this

expCond="getDammage Dampack1 > 0 || getDammage Dampack2 > 0";
expActiv="Dampack1 setDamage 0; Dampack2 setDamage 0;";

where Dampack1 and 2 are the names of the helos.

The helos have been placed as groups, so fully stuffed.

No matter what, my helos still fall to the ground.

What am I missing here?

if anyone cares, here is the full mission sqm

version=11;
class Mission
{
addOns[]=
{
	"CAAir_E_UH60M",
	"fallujah_v1_0",
	"acex_usnavy_men_usmc",
	"acex_veh_t72",
	"cacharacters2",
	"CAWheeled2_Kamaz",
	"CAWheeled2_GAZ39371"
};
addOnsAuto[]=
{
	"CAAir_E_UH60M",
	"acex_usnavy_men_usmc",
	"acex_veh_t72",
	"cacharacters2",
	"CAWheeled2_Kamaz",
	"CAWheeled2_GAZ39371",
	"fallujah_v1_0"
};
randomSeed=9055675;
class Intel
{
	resistanceWest=0;
	startWeather=0.28553796;
	startFog=0.063692428;
	forecastWeather=0.87804496;
	forecastFog=0.18720128;
	year=2016;
	month=6;
	day=17;
	hour=6;
	minute=0;
};
class Groups
{
	items=7;
	class Item0
	{
		side="WEST";
		class Vehicles
		{
			items=2;
			class Item0
			{
				position[]={8652.2637,7,1453.8934};
				azimut=295;
				special="FLY";
				age="30 MIN";
				id=0;
				side="WEST";
				vehicle="UH60M_EP1";
				leader=1;
				rank="CAPTAIN";
				skill=0.73333329;
				text="Dampack1";
				init="this flyInHeight 90;this addEventHandler [""HandleDamage"", {0}]; this setBehaviour ""careless""; this disableAi ""TARGET""; this disableAI ""AUTOTARGET""; this allowDamage FALSE;";
			};
			class Item1
			{
				position[]={8667.6152,7,1490.2454};
				azimut=295;
				special="FLY";
				id=1;
				side="WEST";
				vehicle="UH60M_EP1";
				rank="LIEUTENANT";
				skill=0.59999996;
				text="Dampack2";
				init="this flyInHeight 90;this addEventHandler [""HandleDamage"", {0}]; this setBehaviour ""careless""; this allowDamage FALSE;";
			};
		};
		class Waypoints
		{
			items=4;
			class Item0
			{
				position[]={4946.2764,6.9907308,3402.3823};
				combat="CARELESS";
				expActiv="diag_log text format [""Waypoint1 enabled =%1 : %2"", time, this];";
				class Effects
				{
				};
				showWP="NEVER";
			};
			class Item1
			{
				position[]={4818.3286,6.9907308,4331.48};
				combat="COMBAT";
				expActiv="diag_log text format [""Waypoint 2 enabled =%1 : %2"", time, this];";
				class Effects
				{
				};
				showWP="NEVER";
			};
			class Item2
			{
				position[]={4804.7808,6.9900088,5888.2129};
				combat="COMBAT";
				class Effects
				{
				};
				showWP="NEVER";
			};
			class Item3
			{
				position[]={5659.5249,7,6943.4502};
				combat="COMBAT";
				class Effects
				{
				};
				showWP="NEVER";
			};
		};
	};
	class Item1
	{
		side="WEST";
		class Vehicles
		{
			items=4;
			class Item0
			{
				position[]={8650.209,7,1439.1101};
				special="CARGO";
				id=2;
				side="WEST";
				vehicle="ACE_USMC_Soldier_TL_D";
				player="PLAYER COMMANDER";
				leader=1;
				rank="SERGEANT";
				skill=0.46666664;
				text="Mantid1";
				init="this moveInCargo Dampack1;this addWeapon ""ACE_ParachutePack"";this addEventHandler [""HandleDamage"", {false}];";
			};
			class Item1
			{
				position[]={8653.209,7,1434.1101};
				special="CARGO";
				id=3;
				side="WEST";
				vehicle="ACE_USMC_Soldier_AR_D";
				player="PLAY CDG";
				rank="CORPORAL";
				skill=0.33333331;
				text="Mantid2";
				init="this moveInCargo Dampack1;this addWeapon ""ACE_ParachutePack"";this addEventHandler [""HandleDamage"", {false}];";
			};
			class Item2
			{
				position[]={8655.209,7,1434.1101};
				id=4;
				side="WEST";
				vehicle="ACE_USMC_Soldier_AT_D";
				player="PLAY CDG";
				rank="CORPORAL";
				skill=0.33333331;
				text="Mantid3";
				init="this moveInCargo Dampack1;this addWeapon ""ACE_ParachutePack"";this addEventHandler [""HandleDamage"", {false}];";
			};
			class Item3
			{
				position[]={8657.209,7,1434.1101};
				special="CARGO";
				id=5;
				side="WEST";
				vehicle="ACE_USMC_Soldier_LAT_D";
				player="PLAY CDG";
				skill=0.2;
				text="Mantid4";
				init="this moveInCargo Dampack1;this addWeapon ""ACE_ParachutePack"";this addEventHandler [""HandleDamage"", {false}];";
			};
		};
	};
	class Item2
	{
		side="WEST";
		class Vehicles
		{
			items=4;
			class Item0
			{
				position[]={8684.3018,7,1440.1428};
				special="CARGO";
				id=6;
				side="WEST";
				vehicle="ACE_USMC_Soldier_TL_D";
				player="PLAY CDG";
				leader=1;
				rank="SERGEANT";
				skill=0.46666664;
				text="Echidna1";
				init="this moveInCargo Dampack2;this addWeapon ""ACE_ParachutePack"";this addEventHandler [""HandleDamage"", {false}];";
			};
			class Item1
			{
				position[]={8687.3018,7,1435.1428};
				special="CARGO";
				id=7;
				side="WEST";
				vehicle="ACE_USMC_Soldier_AR_D";
				player="PLAY CDG";
				rank="CORPORAL";
				skill=0.33333331;
				text="Echidna2";
				init="this moveInCargo Dampack2;this addWeapon ""ACE_ParachutePack"";this addEventHandler [""HandleDamage"", {false}];";
			};
			class Item2
			{
				position[]={8689.3018,7,1435.1428};
				special="CARGO";
				id=8;
				side="WEST";
				vehicle="ACE_USMC_Soldier_LAT_D";
				player="PLAY CDG";
				rank="CORPORAL";
				skill=0.33333331;
				text="Echidna3";
				init="this moveInCargo Dampack2;this addWeapon ""ACE_ParachutePack"";this addEventHandler [""HandleDamage"", {false}];";
			};
			class Item3
			{
				position[]={8691.3018,7,1435.1428};
				special="CARGO";
				id=9;
				side="WEST";
				vehicle="ACE_USMC_Soldier_Medic_D";
				player="PLAY CDG";
				rank="CORPORAL";
				skill=0.33333331;
				text="Echidna4";
				init="this moveInCargo Dampack2;this addWeapon ""ACE_ParachutePack"";this addEventHandler [""HandleDamage"", {false}];";
			};
		};
	};
	class Item3
	{
		side="EAST";
		class Vehicles
		{
			items=3;
			class Item0
			{
				position[]={6730.7358,7,2533.3196};
				id=10;
				side="EAST";
				vehicle="ACE_T72B_Base";
				leader=1;
				rank="CAPTAIN";
				skill=0.73333329;
			};
			class Item1
			{
				position[]={6737.7358,7,2523.3196};
				id=11;
				side="EAST";
				vehicle="ACE_T72B_Base";
				rank="LIEUTENANT";
				skill=0.59999996;
			};
			class Item2
			{
				position[]={6723.7358,7,2523.3196};
				id=12;
				side="EAST";
				vehicle="ACE_T72B_Base";
				rank="SERGEANT";
				skill=0.46666664;
			};
		};
	};
	class Item4
	{
		side="EAST";
		class Vehicles
		{
			items=3;
			class Item0
			{
				position[]={6656.2632,7,2466.8835};
				id=13;
				side="EAST";
				vehicle="ACE_T72B_Base";
				leader=1;
				rank="CAPTAIN";
				skill=0.73333329;
			};
			class Item1
			{
				position[]={6663.2632,7,2456.8835};
				id=14;
				side="EAST";
				vehicle="ACE_T72B_Base";
				rank="LIEUTENANT";
				skill=0.59999996;
			};
			class Item2
			{
				position[]={6649.2632,7.1086512,2456.8835};
				id=15;
				side="EAST";
				vehicle="ACE_T72B_Base";
				rank="SERGEANT";
				skill=0.46666664;
			};
		};
	};
	class Item5
	{
		side="EAST";
		class Vehicles
		{
			items=13;
			class Item0
			{
				position[]={6700.103,7,2489.4426};
				id=16;
				side="EAST";
				vehicle="RU_Soldier_SL";
				leader=1;
				rank="LIEUTENANT";
				skill=0.59999996;
			};
			class Item1
			{
				position[]={6695.103,7,2484.4426};
				id=17;
				side="EAST";
				vehicle="Kamaz";
				rank="SERGEANT";
				skill=0.46666664;
			};
			class Item2
			{
				position[]={6703.103,7,2484.4426};
				id=18;
				side="EAST";
				vehicle="RU_Soldier_MG";
				rank="SERGEANT";
				skill=0.46666664;
			};
			class Item3
			{
				position[]={6705.103,7,2484.4426};
				id=19;
				side="EAST";
				vehicle="RU_Soldier_AT";
				rank="SERGEANT";
				skill=0.46666664;
			};
			class Item4
			{
				position[]={6707.103,7,2484.4426};
				id=20;
				side="EAST";
				vehicle="RU_Soldier_LAT";
				rank="CORPORAL";
				skill=0.33333331;
			};
			class Item5
			{
				position[]={6709.103,7,2484.4426};
				id=21;
				side="EAST";
				vehicle="RU_Soldier_GL";
				rank="CORPORAL";
				skill=0.33333331;
			};
			class Item6
			{
				position[]={6711.103,7,2484.4426};
				id=22;
				side="EAST";
				vehicle="RU_Soldier_Marksman";
				rank="CORPORAL";
				skill=0.33333331;
			};
			class Item7
			{
				position[]={6713.103,7,2484.4426};
				id=23;
				side="EAST";
				vehicle="RU_Soldier_MG";
				rank="CORPORAL";
				skill=0.33333331;
			};
			class Item8
			{
				position[]={6715.103,7,2484.4426};
				id=24;
				side="EAST";
				vehicle="RU_Soldier_LAT";
				rank="CORPORAL";
				skill=0.33333331;
			};
			class Item9
			{
				position[]={6717.103,7,2484.4426};
				id=25;
				side="EAST";
				vehicle="RU_Soldier_AR";
				skill=0.2;
			};
			class Item10
			{
				position[]={6719.103,7,2479.4426};
				id=26;
				side="EAST";
				vehicle="RU_Soldier_AT";
				skill=0.2;
			};
			class Item11
			{
				position[]={6721.103,7,2479.4426};
				id=27;
				side="EAST";
				vehicle="RU_Soldier_GL";
				skill=0.2;
			};
			class Item12
			{
				position[]={6723.103,7,2479.4426};
				id=28;
				side="EAST";
				vehicle="RU_Soldier";
				skill=0.2;
			};
		};
	};
	class Item6
	{
		side="EAST";
		class Vehicles
		{
			items=4;
			class Item0
			{
				position[]={6659.2495,7,2513.1677};
				id=29;
				side="EAST";
				vehicle="RU_Soldier_TL";
				leader=1;
				rank="SERGEANT";
				skill=0.46666664;
			};
			class Item1
			{
				position[]={6654.2495,7,2508.1677};
				id=30;
				side="EAST";
				vehicle="GAZ_Vodnik_HMG";
				rank="CORPORAL";
				skill=0.33333331;
			};
			class Item2
			{
				position[]={6662.2495,7,2508.1677};
				id=31;
				side="EAST";
				vehicle="RU_Soldier_AR";
				skill=0.2;
			};
			class Item3
			{
				position[]={6664.2495,7,2508.1677};
				id=32;
				side="EAST";
				vehicle="RU_Soldier_AT";
				skill=0.2;
			};
		};
	};
};
class Sensors
{
	items=7;
	class Item0
	{
		position[]={7340.0986,7,2556.1665};
		timeoutMin=15;
		timeoutMid=15;
		timeoutMax=15;
		age="UNKNOWN";
		expCond="paradrop_start == 1";
		expActiv="Mantid1 action [""eject"", Dampack1]; Echidna1 action [""eject"", Dampack2]; paradrop_unit1 = 1;";
		class Effects
		{
		};
	};
	class Item1
	{
		position[]={7448.2861,7,2557.1147};
		timeoutMin=1;
		timeoutMid=1;
		timeoutMax=1;
		age="UNKNOWN";
		expCond="paradrop_unit1 == 1;";
		expActiv="Mantid2 action [""eject"",Dampack1]; Echidna2 action [""eject"", Dampack2]; paradrop_unit2 = 1;";
		class Effects
		{
		};
	};
	class Item2
	{
		position[]={7562.168,7,2556.1665};
		timeoutMin=1;
		timeoutMid=1;
		timeoutMax=1;
		age="UNKNOWN";
		expCond="paradrop_unit2 == 1;";
		expActiv="Mantid3 action [""eject"",Dampack1]; Echidna3 action [""eject"", Dampack2]; paradrop_unit3=1;";
		class Effects
		{
		};
	};
	class Item3
	{
		position[]={7685.5396,7.4460449,2555.2185};
		timeoutMin=1;
		timeoutMid=1;
		timeoutMax=1;
		interruptable=1;
		age="UNKNOWN";
		expCond="paradrop_unit3 == 1;";
		expActiv="Mantid4 action [""eject"",Dampack1]; Echidna4 action [""eject"", Dampack2]; paradrop_end = 1; Dampack1 setSpeedMode ""full"";  Dampack2 setSpeedMode ""full""; paradrop_unit4 = 1;";
		class Effects
		{
		};
	};
	class Item4
	{
		position[]={4770,6.9907308,4054.1426};
		activationBy="WEST";
		interruptable=1;
		age="UNKNOWN";
		expActiv="paradrop_start = 1; Dampack1 setSpeedMode ""limited""; Dampack2 setSpeedMode ""limited"";";
		class Effects
		{
		};
	};
	class Item5
	{
		position[]={7801.3877,7,2557.6724};
		timeoutMin=20;
		timeoutMid=20;
		timeoutMax=20;
		interruptable=1;
		age="UNKNOWN";
		expCond="paradrop_unit4 == 1;";
		expActiv="{deleteVehicle _x;}forEach crew Dampack1;deleteVehicle Dampack1;{deleteVehicle _x;}forEach crew Dampack2;deleteVehicle Dampack2;{_x addEventHandler [""HandleDamage"", {false}];} forEachMemberTeam Echidna;";
		class Effects
		{
		};
	};
	class Item6
	{
		position[]={7927.8784,7.1352539,2558.6475};
		interruptable=1;
		age="UNKNOWN";
		expCond="getDammage Dampack1 > 0 || getDammage Dampack2 > 0";
		expActiv="Dampack1 setDamage 0; Dampack2 setDamage 0;diag_log text format [""T=%1 : %2"", time, _this];";
		class Effects
		{
		};
	};
};
};
class Intro
{
addOns[]=
{
	"fallujah_v1_0"
};
addOnsAuto[]=
{
	"fallujah_v1_0"
};
randomSeed=11761983;
class Intel
{
	startWeather=0;
	forecastWeather=0;
	year=2010;
	month=1;
	day=11;
	hour=12;
	minute=0;
};
};
class OutroWin
{
addOns[]=
{
	"fallujah_v1_0"
};
addOnsAuto[]=
{
	"fallujah_v1_0"
};
randomSeed=16029571;
class Intel
{
	startWeather=0;
	forecastWeather=0;
	year=2010;
	month=1;
	day=11;
	hour=12;
	minute=0;
};
};
class OutroLoose
{
addOns[]=
{
	"fallujah_v1_0"
};
addOnsAuto[]=
{
	"fallujah_v1_0"
};
randomSeed=7623343;
class Intel
{
	startWeather=0;
	forecastWeather=0;
	year=2010;
	month=1;
	day=11;
	hour=12;
	minute=0;
};
};

Share this post


Link to post
Share on other sites

That's because you have no pilots. Using the command moveInCargo only put the soldier in the back, use moveInDriver to get a pilot to fly the chopper.

Share this post


Link to post
Share on other sites

Well... the chopper is fully staffed, it flies and follows the waypoints (when there are no enemies) and I can see the support gunners fire if I don't disable targeting.

Although nothing of this shows in the sqm, don't know why.only the choppers show in the script.

Anyway the choppers have been added as a group not as single units.this way they automatically come fully stuffed.

Share this post


Link to post
Share on other sites

Try....

[b][i]helicopter[/i][/b] [url="http://community.bistudio.com/wiki/allowDamage"]allowDamage[/url] false;

Where helicopter is the name of your helo. No need for the other stuff I think.

EDIT:

Just did a little test with a KA-52 sitting on the runway with crew. Could not destroy it or kill the crew with SMAW's.

Edited by twirly

Share this post


Link to post
Share on other sites

As you can see in the complete mission.sqm I posted, I already have those lines in the single heli init.

And still they fall.

Also no matter what I get evasive manuvers, something I'd rather not have.

Ok I did a test.

Removed all init from the helo and just left

"dampack1 allowDamage false; dampack1 forceSpeed 10;"

The helo gets shot down as usual, but this time the pilot does not do evasive manouvers and best of all my forced speed is totally ignored.

So it appears my command are being ignored. Any idea why?

Edited by erupter

Share this post


Link to post
Share on other sites

The pilot dies? Make sure the pilot also has allowDamage false;.

something like:

(driver this) allowDamage false;

in init of helicopter

Share this post


Link to post
Share on other sites

Have a look at this little test mission here see if it helps you. It is well commented.

http://www.mediafire.com/?89e1zoq4g54t8jp

The helicopter and anyone inside is invulnerable.

Making the AI ignore enemy fire and fly where you want is another story. I have never had much luck with that when trying to make a plane fly directly toward or over a target to drop a free fall bomb. Anyway the code that's supposed to make them ignore everything is also there.

Good luck!

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

Thanks twirly, I'll try that.

I started a new mission from scratch.

Now I have invulnerability, but I had to define every single element by hand.

Meaning I had to place an empty helo and assign every crew member by hand with "this allowdamage false" in every init of every unit.

This way it's invincible.

But I can't find a way to give it speed orders anymore: any "this forcespeed xx" is ignored by both the helo and the pilot.

All the disable AI didn't work to force sticking to waypoints: the helo avoids enemy fire.

Moreover after some escaping manouvers (which are random) it tryes to settle at about 30m of altitude as if waiting for something.

Another nice thing: I put two AH6 flir as escort, they are always hit before even firing a shot.

Nice AI, isn't it?

Share this post


Link to post
Share on other sites

Something that used to work many moons ago in OFP was to make a Civilian fly the plane or helo. Then they would fly where ever you wanted. But I don't think that still applies in the Arma series.

I do think it's quite bizarre that there are so many commands that imply that you can make the AI ignore stuff.... but none of them seem to really work. One would think it would be easier to make them do nothing... than to make them do something!!

Share this post


Link to post
Share on other sites
Now I have invulnerability, but I had to define every single element by hand.

{ _x allowDamage false; } foreach [this] + crew this;

=)

Share this post


Link to post
Share on other sites
One would think it would be easier to make them do nothing... than to make them do something!!

Exactly! Especially when it comes to waypoint following: is it so difficult to make an AI JUST follow the waypoints???

Considering it's also extremely diffucult getting any AI do be effective you'd think it would be easy to get a stupid AI.

Instead it's f***ing hard to get them doing what you want. Instead they do (badly) all sorts of things you DON'T want them to.

{ _x allowDamage false; } foreach [this] + crew this;

=)

Yeah but this kind of scripting must be managed in a way I've still to learn.

Right now I'm using the editor and scripting from inside there.

These things (as I understand) go in the init script of the whole mission.

But that way you have to define all the groups and units before, or in the same init script and then initialize them there.

Now I couldn't find a well laden out documentation on the file structure of a mission, what gets parsed first, file syntax, etc.

So right now I'm trying the easy way.

If anyone can suggest some docs to help me understand the scripting structure of a mission I'm all for it.

Right now I just tweak the SQM sometimes.

For example where should I put the code posted in this thread?

Edited by erupter

Share this post


Link to post
Share on other sites

The posted code need to be saved as a "Something.sqf" - basically a simple text file, contained in the missions folder.

Its then called from the mission, and the code is then executed as and when needed by Arma.

Did you d/l the example mission from that thread ?

Its a simple folder to be opened in the editor. Most missions contain many similar .sqf or .sqs files. They work outside the editor, and are called in as needed to serve some logic/ function/ effect needed by the author. That example uses 'init.sqf' a special script run once at the star of every mission, used to define and initiate the map and its elements.

Usually the folder is then 'zipped' as a single file, the .pbo you normally see as a mission d/l. Missions often contain dozens of small script files or images- the resources need by the mission - within this pbo. Maps are as simple or complex as you can imagine, very time consuming detailed work. Its normal to define every single element by hand.

Arma has many levels of complexity. Making AI do nothing is not easy, so many variables and built in 'intelligent' routines that make them respond and fight. They react to what they see and hear, you have to minutely control them and the environment, its often why .sqm /script is used in the first place. Will take a while to build up any sort of understanding why the AI do what they do, we are all still learning, they are that unpredictable and adaptable.

One of the best ways to learn is sort of reverse engineer some of these missions and try to follow how it was done. Start small and simple. Lots of examples about in this forum, good luck.

Quick useful links -

http://forums.bistudio.com/showthread.php?134274-Arma-2-Editing-amp-Scripting-Tutorials-Youtube a good place to start

http://forums.bistudio.com/showthread.php?78089-Mission-Editing-and-Scripting-Information-Links-only-NO-Discussion

Share this post


Link to post
Share on other sites
{ _x allowDamage false; } foreach [this] + crew this;

Just drop that within the chopper init line in the editor.

What it will do is make the chopper and all it's crew to invisible.

Share this post


Link to post
Share on other sites
The posted code need to be saved as a "Something.sqf" - basically a simple text file, contained in the missions folder.

Its then called from the mission, and the code is then executed as and when needed by Arma.

Did you d/l the example mission from that thread ?

[...]

Yeah, I'm an embedded-C programmer IRL.

Fact is I'm used to much more documented "languages".

This was born as an ingame scripting, features addes on the way, now it's almost a full blown language for the Arma OS.

BUT imho it lacks a decent documentation, as to say:

  • list of all classes (ok there's this)
  • for each class, every component (properties)
  • for each class, every action available (methods)
  • inheritance
  • casting and data type management and conversion

For example in the Mission editing thread there is no reference to all the files that can be part of a mission and in what order they are processed.

I'm just a sucker for clear&clean documentation :P

Share this post


Link to post
Share on other sites

I feel your pain, yes documentation is sketchy at best, constant development has caused a real lag in clean information.

There is a lot of real gems out there, http://www.ofpec.com/ and other sites like https://dev-heaven.net/. You will still have to sift through it to get what you need.

The information is out there, but poorly distributed up until recently. One of the best examples for me is something like the Domination missions. Some fantastic coding with a number of features highlighting very sophisticated code. Arguably better put together than any of the original vanilla missions. Full of efficient snippets and specialised examples. It has taken months if not years to filter and disseminate all these best practices though the community.

You can see it in level of sophistication now being used in common addons, or mods like DayZ. The bar moves upwards, I just wish we could have more definitive documentation to speed up this process.

If you want an example of anything or more pointers usually worth asking the nerds here on the forums.

Share this post


Link to post
Share on other sites
If you want an example of anything or more pointers usually worth asking the nerds here on the forums.

That's why I'm here ;)

Besides before attempting to move the mission-gurus I have lots to learn to even begin to understand the possible answers :p

Share this post


Link to post
Share on other sites

I feel your pain too mate.... it's been ten years for me. I don't get as frustrated as I used to. In fact I don't get frustrated at all anymore and just really enjoy coding now. It has however been a long hard road. Stick with it man.... the light will eventually switch on!

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
Sign in to follow this  

×