Jump to content
thy_

How can I code to know if the player's vehicle can float in water? [SOLVED]

Recommended Posts

Hey there, hope this message finds you well.

 

I just read a bit around this below, but no clue how I'll know through the code if the player's vehicle is amphibious. All I want is a bool value as a return.  

https://community.bistudio.com/wiki/CfgVehicles_Config_Reference#canFloat


I've already investigated:

https://community.bistudio.com/wiki/BIS_fnc_objectType

https://community.bistudio.com/wiki/isKindOf

https://community.bistudio.com/wiki/typeOf

 

 

Share this post


Link to post
Share on other sites
_vehicle = vehicle player;
private _floatVal = _vehicle getVariable ['TAG_canFloat',-1];
if (_floatVal isEqualTo -1) then {
	_floatVal = getNumber (configFile >> 'CfgVehicles' >> (typeOf _vehicle) >> 'canFloat');
	_vehicle setVariable ['TAG_canFloat',_floatVal];
}; 
private _canFloat = _floatVal > 0;
systemchat str _canFloat;

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
16 hours ago, fn_Quiksilver said:

_vehicle = vehicle player;
private _floatVal = _vehicle getVariable ['TAG_canFloat',-1];
if (_floatVal isEqualTo -1) then {
	_floatVal = getNumber (configFile >> 'CfgVehicles' >> (typeOf _vehicle) >> 'canFloat');
	_vehicle setVariable ['TAG_canFloat',_floatVal];
}; 
private _canFloat = _floatVal > 0;
systemchat str _canFloat;

 

 

Works as gold. Thanks!

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

×