Jump to content
Sign in to follow this  
SteelSampson

Simulate loss of mobility, some of crew in vehicle?

Recommended Posts

I am making a training mission and I'd like to simulate loss of mobility on a vehicle and loss of one crewman, like the driver and/or gunner without having everyone in the vehicle go down.

Sidenote: they players in the vehicle and the vehicle itself could be different each time the mission is played.

Thanks

Share this post


Link to post
Share on other sites

Select random crew member in vehicle

_randomCrewMember = (crew _vehicle) select floor(random(count(crew _vehicle)));
//Do whatever you want with _randomCrewMember

Share this post


Link to post
Share on other sites
Select random crew member in vehicle

_randomCrewMember = (crew _vehicle) select floor(random(count(crew _vehicle)));
//Do whatever you want with _randomCrewMember

Awesome! Thank you! Is there a way to make it also choose a random number of crew members?

Share this post


Link to post
Share on other sites

Is it possible to make it so a vehicle can take damage just never blowup? like limiting the damage it can take to 'damage 0.9' or something?

Share this post


Link to post
Share on other sites
Awesome! Thank you! Is there a way to make it also choose a random number of crew members?

_crew = crew _vehicle;
_players = [];
for "_i" from 0 to 2 do {
if(count(_crew) > 0) then {
	_random = _crew select floor(random(count _crew));
	_players = _players + [_random];
	_crew = _crew - [_random];
};
};

This will select 3 (0 to 2) random units from vehicle crew and put into _players array

Is it possible to make it so a vehicle can take damage just never blowup? like limiting the damage it can take to 'damage 0.9' or something?

This is a bit complicated, you will need HandleDamage event handler: http://community.bistudio.com/wiki/ArmA_2:_Event_Handlers#HandleDamage

you will need to add it for all clients that are in the game and will join the game (init line of vehicle for example or use BIS_fnc_MP for newly spawned vehicles).

Example for init line:

this addEventHandler ["HandleDamage", {if((_this select 2) < 0.8) then {_this select 2} else {0.8}} ];

this will prevent any vehicle part (including overall damage) going above 0.8

Share this post


Link to post
Share on other sites

Thank you!

Would it be possible to reset the damage to 0 after 60 seconds for any vehicle that: 1. has players in it and 2. has reached the damage limit of 0.8?

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  

×