-
Notifications
You must be signed in to change notification settings - Fork 2
Replace createVehicleCrew with fn_createCrew #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
| File: fn_createCrew.sqf | ||
| Author: PiG13BR - https://github.com/PiG13BR/ | ||
| Date: 2024-26-08 | ||
| Last Update: 2024-27-08 | ||
| License: MIT License - http://www.opensource.org/licenses/MIT | ||
|
|
||
| Description: | ||
| Creates vehicle crew based on preset configuration only | ||
|
|
||
| Parameter(s): | ||
| _vehicle - Vehicle to add crew | ||
| _side - crew side: KPLIB_side_enemy or KPLIB_side_player (Default: KPLIB_side_enemy) | ||
|
|
||
| Returns: | ||
| Array - [Crew created, group] | ||
| */ | ||
|
|
||
| params[ | ||
| ["_vehicle", objNull, [objNull]], | ||
| ["_side", KPLIB_side_enemy, [sideUnknown]] | ||
|
|
||
| ]; | ||
|
|
||
| if (isNull _vehicle) exitWith {["No vehicle provided"] call BIS_fnc_error}; | ||
|
|
||
| private _typeCrew = ""; | ||
|
|
||
| // Placeholder types | ||
| switch (_side) do { | ||
| case KPLIB_side_enemy : { | ||
| _typeCrew = KPLIB_o_rifleman; | ||
| }; | ||
| case KPLIB_side_player : { | ||
| _typeCrew = KPLIB_b_crewUnit; | ||
| } | ||
| }; | ||
|
|
||
| /* | ||
| Save it for later changes | ||
| switch (_side) do { | ||
| case KPLIB_side_enemy : { | ||
| if (_vehicle isKindOf "Air") then { | ||
| _typeCrew = KPLIB_o_pilot; | ||
| } else { | ||
| if ((_vehicle isKindOf "Tank") || {_vehicle isKindOf "Wheeled_APC_F"}) then { | ||
| _typeCrew = KPLIB_o_crewman; | ||
| } else { | ||
| _typeCrew = KPLIB_o_rifleman; | ||
| } | ||
| } | ||
| }; | ||
| case KPLIB_side_player : { | ||
| if (_vehicle isKindOf "Air") then { | ||
| _typeCrew = KPLIB_b_heliPilotUnit; | ||
| } else { | ||
| if ((_vehicle isKindOf "Tank") || {_vehicle isKindOf "Wheeled_APC_F"}) then { | ||
| _typeCrew = KPLIB_b_crewUnit; | ||
| } else { | ||
| _typeCrew = KPLIB_b_crewStatic; | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| */ | ||
|
Comment on lines
+39
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this supposed to be commented out? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If you want to add those new variables in presets, then yes. The original version uses them. I tested a lot and works just fine. |
||
|
|
||
| private _grp = createGroup [_side, true]; | ||
| private _allCrew = []; | ||
|
|
||
| { | ||
| private _crew = [_typeCrew, getPosATL _vehicle, _grp] call KPLIB_fnc_createManagedUnit; | ||
| _allCrew pushBack _crew; | ||
|
|
||
| if (_x isEqualTo [-1]) then { | ||
| _crew assignAsDriver _vehicle; | ||
| _crew moveInDriver _vehicle; | ||
| } else { | ||
| _crew assignAsTurret [_vehicle, _x]; | ||
| _crew moveInTurret [_vehicle, _x]; | ||
| }; | ||
| } forEach (_vehicle call BIS_fnc_vehicleCrewTurrets); | ||
|
|
||
|
|
||
| // Return all the vehicle crew and its group | ||
| [_allCrew, _grp] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All opfor crew is riflemen?