Skip to content

Commit 354ad3b

Browse files
committed
Refactored vehicle spawning code into seperate file
Refactored vehicle spawning code into seperate file to reduce duplication, enhance readability, and reduce error. Order of values to be passed to the new 'spawnVehicle.sqf' are [CP Cost, Vehicle Type]
1 parent 5e7c558 commit 354ad3b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source/dialog/spawnVehicle.sqf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
_requiredPoints = _this select 0;
2+
_vehicleType = _this select 1;
3+
4+
if (commandpointsblu1 >= _requiredPoints) then {
5+
commandpointsblu1 = commandpointsblu1 - 4;
6+
ctrlSetText [1000, format["%1",commandpointsblu1]];
7+
_spawnPos = (getpos hq_blu1) findEmptyPosition [40, 120, _vehicleType];
8+
_spawnPos = [(_spawnPos select 0), _spawnPos select 1];
9+
vehic = _vehicleType createVehicle _spawnPos;
10+
hint "Vehicle ready !";
11+
} else {
12+
hint "Not enough command points";
13+
};

0 commit comments

Comments
 (0)