Jump to content
Sign in to follow this  
abs

Sub Parts?

Recommended Posts

Hi all,

So, I'm working on configuring an addon in o2, and I was wondering what had to be done to create new hit zones. For example, if I wanted to create one called Port Nacelle, what would be the best way to go about and do this? Is it even possible?

It's configured as a plane class, and based on other planes (http://img826.imageshack.us/img826/6640/arma2oa2010071916460611.jpg) I can see that the only "part" available is called Hull. This is different, of course, for helicopters and tanks. I found out by accident that there is a LOD called Sub Parts (and when I say by accident I mean that I finally looked at what other LODs were possible), and tried to look into that further. I came across this post (http://forums.bistudio.com/showthread.php?69513-Sub-parts-and-edit-LODs), which may or may not be out of date. If BI discontinued using sub parts, then why is the option still there in o2? There is also this interview (http://www.bistudio.com/english/company/developers-blog/221-report-in-interview-with-lukas-milacek-executive-producer) where sub parts are mentioned, hinting at its purpose. And finally, the only place the config mentions anything remotely similar is here:

Class CfgNonAIVehicles 
       { 
       Class ProxyBysta 
               { 
               autocenter=0; 
               scope=2; 
               reversed=1; 
               animated=1; 
               model=""; 
               simulation="ProxySubpart"; 
               }; 
};

If anyone knows anything more about this elusive Sub Part lod, or perhaps how I can achieve my proposed goal, please let me know.

Thanks for your time,

Abs

Share this post


Link to post
Share on other sites

Hi mate

CSJ amongst many clearly showed you can define multiple hit zones for planes.

BUT, you typically have to script the result of that area being hit (via EH). I believe some of the default hit names (engine, electronics etc ) wont actually do the normal stuff as it does to other vehicles. (happy to be wrong)

BUT, again with below definitions as an example (just the "Hitpoints" bit), you could test these default classes and see whether ENGINE for example actually damages the engine.

For a custom damage system

- Put some dots in the HIT-POINTS LOD and call them whatever you like.

- In the CONFIG.CPP place HITPOINTS class;

Example;

	MycustomDamageScript = "\myaddon\scripts\Damage.sqf";

		class HitPoints
 		{
		class engine1 {
			armor = 1.0;
			material = 50;
			name = "engine1";
			visual = "";
			passThrough = 0;
		};
		class fueltank1 {
			armor = 1.0;
			material = 50;
			name = "fueltank1";
			visual = "";
			passThrough = 0;
		};
		class fueltank2 {
			armor = 1.0;
			material = 50;
			name = "fueltank2";
			visual = "";
			passThrough = 0;
		};
		class landingGear {
			armor = 1.0;
			material = 50;
			name = "landingGear";
			visual = "";
			passThrough = 0;
		};
		class wingleft {
			armor = 1.0;
			material = 50;
			name = "wingleft";
			visual = "wingleft";
			passThrough = 0;
		};

In a vehicle initialise script;

CustomDamageSQF = compile preprocessFile getText(configFile >> "CfgVehicles" >> (typeof (_this select 0)) >> "MycustomDamageScript");
(_this select 0)  addEventHandler ["HandleDamage", {_this call CustomDamageSQF}];

Damage.sqf is something like this;

_plane = _this select 0;
_damaged = _this select 1;
_damage = _this select 2;

if (local _plane) then
{
Switch (_damaged) Do
{
	Case "" : {_varHitPoint="zbytekD"};
	Case "zbytek" : {_varHitPoint="zbytekD"};
	Case "engine1" : {_varHitPoint="engine1D"};
	Case "fueltank1" : {_varHitPoint="fueltank1D"};
	Case "fueltank2" : {_varHitPoint="fueltank2D"};
	Case "landingGear" : {_varHitPoint="landingGearD"};
	Case "wingleft" : {_varHitPoint="wingleftD"};
}; 

_oldDamage=(_plane getVariable _varHitPoint);
If(IsNil("_oldDamage")) Then {_oldDamage=0};
_newDamage=_damage+_oldDamage;
_plane setVariable [_varHitPoint,_newDamage,true];

player Globalchat format["%1 on %2", _newDamage, _varHitPoint];

If((_varHitPoint=="zbytekD")and(_newDamage>=(0.6*_ArmourHull))) then
{
	if (not alive _plane) exitwith {};
	_runHull1 = (_plane getVariable "RunHull1");
	if (IsNil("_runHull1")) then {_runHull1 = 0};
	if (_runHull1 > 0) exitWith {};
	_runHull1 = 1;
	_plane setVariable ["RunHull1", _runHull1, true];
	[_plane] execVM "\myaddon\scripts\smoke.sqf";
};
If((_varHitPoint=="zbytekD")and(_newDamage>=(1.0*_ArmourHull))) then
{
	if (not alive _plane) exitwith {};
	_runHull2 = (_plane getVariable "RunHull2");
	If (IsNil("_runHull2")) Then {_runHull2=0};
	if (_runHull2>0) exitWith {};
	_runHull2 = 1;
	_plane setVariable ["RunHull2", _runHull2, true];
	[_plane] execVM "\myaddon\scripts\smokeB.sqf";
};
If((_varHitPoint=="engine1D")and(_newDamage>=_ArmourEngine)) then
{
	if (not alive _plane) exitwith {};
	[_plane, "engine1"] execVM "\myaddon\scripts\EngineDamage.sqf";
};
If((_varHitPoint=="fueltank1D")and(_newDamage>=_ArmourFuel)) then
{
	if (not alive _plane) exitwith {};
	_runfueltank1=(_plane getVariable "Runfueltank1");
	if (IsNil("_runfueltank1")) then {_runfueltank1=0};
	if (_runfueltank1>0) exitWith {};
	_runfueltank1=1;
	_plane setVariable ["Runfueltank1",_runfueltank1,true];
	[_plane, "fueltank1"] execVM "\myaddon\scripts\FuelDamage.sqf";
};
_damage;
};

More info on HandleDamage Event Handler here;

http://forums.bistudio.com/showthread.php?113418-HandleDamage-EH-explained-(-poor-man-s-getHit)

Share this post


Link to post
Share on other sites

Thanks for that awesome response, Gnat! :) I haven't had a chance to try it out yet (work days are usually swamped), but this is the config I already had for my shuttle:

	class HitPoints
	{
		Class HitHull
		{
			armor=1;
			material=50;
			name="telo";
			passThrough=1;
		};
		Class HitPortNacelle
		{
			armor=1;
			material=50;
			name="PortNac";
			passThrough=1;
		};
		Class HitStarboardNacelle
		{
			armor=1;
			material=50;
			name="StarNac";
			passThrough=1;
		};
	};

Whenever I use BinPBO on it, it pops out an error that my config is wrong until I delete this section. I have the Hitpoints LOD, and I created points as well, and named them the same as the sections in the config. Is this enough to make these components show up in game, or will I need to implement the scripts you quoted as well?

I'm under the impression that these scripts are for simulating damage like CSJ's The Few...I am not a scripter though (well, not for the game series, anyway), so I am unsure of how it works.

I'll spend some time this weekend trying to get what you've already provided me in-game and working...Thanks again. :)

Abs

Share this post


Link to post
Share on other sites

From what I could gather, the Sub Part lod seems to be a relic from Game 2 (not ArmA, but project after OFP). It seems it would have handled advanced damage simulations, like actual parts falling off vehicles, I think... but the information is vague. It could also easily just be a prequel to hitZones linking to animations, just like it is now in A2 (Building damage is done this way).

Chances are extremely high the engine won't recognize this LOD anymore and/ot just plainly ignore it. Probably just left in O2 LOD selector to troll you folks.

Usage of this LOD would be done via certain parameters in class DestructionEffects with tokens like attachTo = sectionname.

If I get around it this weekend I'll try to rebuild a prototype form the parts of this tech that are left in A2 (if any), but I haven't seen this LOD used anywhere, so chances are high this tech is completely scrapped.

If I had to sum this up, linking hit zones to animations is probably exactly what was tried with Sub Parts lod, or maybe it was indeed actual dismembering of things from objects upon impact. Who knows, it's currently cloudy in Prague and the last goat sacrifice is weeks ago, so practically anything could be true...

My $0.02 on this.

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  

×