Einzelnen Beitrag anzeigen
Alt 06.06.2012, 09:02   #10 (permalink)
Tajin
50 Beiträge100 Beiträge250 Beiträge
 
Benutzerbild von Tajin
 
Registriert seit: 17.01.2008
Beiträge: 267
Standard

Sooo, funktioniert soweit.

Je nach Fahrzeugtyp gibt es gewisse Abweichungen, vorallem Flieger sind da etwas eigen aber es reicht um einen Anhaltspunkt zu haben.

PHP-Code:
//fn_estimateWeight.sqf
private ["_obj","_type","_class","_armor","_bbox","_bmin","_bmax","_width","_length","_height","_volume","_factor","_weight"];

_obj _this select 0;
if (
isnil ("_obj")) exitWith hint "no object found"; };

_type typeOf _obj;
_class configFile >> "CfgVehicles" >> _type;
_armor getNumber(_class >> "Armor");

_bbox boundingBox _obj;
_bmin _bbox select 0;
_bmax _bbox select 1;
_width = (_bmax select 0) - (_bmin select 0);
_length = (_bmax select 1) - (_bmin select 1);
_height = (_bmax select 2) - (_bmin select 2);
_volume _width _length _height;

_factor 1;

if (
_obj isKindOf "Car"then _factor 14 };
if (
_obj isKindOf "Ikarus"then _factor 19 };
if (
_obj isKindOf "Truck"then _factor 40 };
if (
_obj isKindOf "Motorcycle"then _factor };
if (
_obj isKindOf "Bicycle"then _factor 1.5 };
if (
_obj isKindOf "Ship"then _factor };
if (
_obj isKindOf "Plane"then _factor };
if (
_obj isKindOf "Helicopter"then _factor };
if (
_obj isKindOf "Tank"then _factor 103 };
if (
_obj isKindOf "Tracked_APC"then _factor 65 };
if (
_obj isKindOf "Wheeled_APC"then _factor 45 };

_weight =  round ( (_volume _factor) + (_armor 100 _factor) );

_weight
__________________
Tajin ist offline