This repository was archived by the owner on Dec 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathspawn_vehicle.sqf
More file actions
58 lines (45 loc) · 1.76 KB
/
spawn_vehicle.sqf
File metadata and controls
58 lines (45 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Author: SpecOp0
Description:
Spawns vehicle (on ground) if no vehicle of same type is nearby (10m radius).
For use in a addAction entry, vehicle and spawn parameter hardcoded.
Parameter(s):
0: -
1: OBJECT - player who wants to spawn the object (i.e. a player who chooses the menu entry)
Returns:
true
Usage (Noticeboard.init):
this addAction ["Spawn Vehicle", { _this call compile preprocessFileLineNumbers "spawn_vehicle.sqf"];
*/
comment "Edit these Entries";
comment "Type of Vehicle";
private _vehicleType = "B_G_Offroad_01_F";
comment "Direction of Vehicle";
private _vehicleSpawnerDirection = 187;
comment "Name of Marker for Vehicle Spawn";
private _markerVehicleSpawn = "marker_spawner";
comment "Hints displayed for Caller";
private _hintSpawnSucessfull = "Fahrzeug gespawned.";
private _hintSpawnPosBlocked = "Ein Fahrzeug steht dort bereits.";
comment "Script start";
params ["",["_caller",objNull]];
private _spawnPos = getMarkerPos _markerVehicleSpawn;
if(isNull _caller) then {
hint "Script Error: Unit which called for Vehicle is null/has no Position attached";
} else {
if( (_spawnPos select 0 == 0 && _spawnPos select 1 == 0 && _spawnPos select 2 == 0)) then {
hint format ["Script Error: Marker '%1' not found",_markerVehicleSpawn];
} else {
private _nearestObject = nearestObjects [_spawnPos,[_vehicleType],10];
if(count _nearestObject > 0) then {
hint _hintSpawnPosBlocked;
} else {
private _vehicle = _vehicleType createVehicle _spawnPos;
_vehicle setDir _vehicleSpawnerDirection;
clearItemCargoGlobal _vehicle;
_vehicle addItemCargo ["ItemGPS",1];
hint _hintSpawnSucessfull;
};
};
};
true