-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbon_arti_fire_advanced.sqf
More file actions
89 lines (61 loc) · 3.25 KB
/
Copy pathbon_arti_fire_advanced.sqf
File metadata and controls
89 lines (61 loc) · 3.25 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//by Bon_Inf*
if(not isServer) exitWith{};
private ['_lasertarget'];
_requestor = _this select 0;
_side = _this select 1;
_cannons_to_fire = _requestor getVariable "requesting_cannons";
_cannons_available = _cannons_to_fire;
{//foreach _cannons_to_fire
_available = Server getVariable format["Arti_%2_Cannon%1_available",_x,_side];
if(_available) then{
_cannonsetup = _requestor getVariable format["Arti_%2_Cannon%1",_x,_side];
Server setVariable [format["Arti_%2_Cannon%1_available",_x,_side],false,true];
[_x,_cannonsetup,_requestor] spawn {
_cannon = _this select 0;
_splashpos = (_this select 1) select 0;
_firedelay = (_this select 1) select 1;
_artitype = (_this select 1) select 2;
_nrshells = (_this select 1) select 3;
_spread = (_this select 1) select 4;
_requestor = _this select 2;
_side = side _requestor;
_requestor setVariable [format["Arti_%2_Cannon%1",_cannon,_side],nil,true];
_requestor setVariable [format["Arti_%2_Cannon%1summary",_cannon,_side],nil,true];
_shellsleft = Server getVariable format["Arti_%1_shellsleft",_side];
Server setVariable [format["Arti_%1_shellsleft",_side],_shellsleft - _nrshells, true];
sleep (15 + (random 5) + _firedelay);
for "_i" from 1 to _nrshells do {
_lasertarget = _requestor call arti_func_getLaser;
if(_spread < 0 && isNull _lasertarget) exitWith{};
if(_spread < 0) then{_splashpos = getPos _lasertarget};
/*******************************************************************************************************************/
/*******************************************************************************************************************/
/*******************************************************************************************************************/
// for further work
// code written here will be assigned to each cannon that was requested to fire and is available as such.
// you have the following information:
// "_splashpos" the 3d-position where artillery should go down
// "_artitype" the type of artillery that is also defined in the "HW_arti_types" array in the bon_arti_init.sqf
// "_spread" an integer representing the size of the area in meters that has to be covered by artillery
// once finished replace the bon_arti_fire.sqf with this file
/*******************************************************************************************************************/
/*******************************************************************************************************************/
/*******************************************************************************************************************/
sleep (7.5 + random 10);
};
sleep (30 * _nrshells);
Server SetVariable [format["Arti_%2_Cannon%1_available",_cannon,_side],true,true];
};
}
else {_cannons_available = _cannons_available - [_x]};
} foreach _cannons_to_fire;
for "_i" from 1 to HW_Arti_CannonNumber do {
if(not (_i in _cannons_to_fire)) then{
_requestor setVariable [format["Arti_%2_Cannon%1",_i,_side],nil,true];
_requestor setVariable [format["Arti_%2_Cannon%1summary",_i,_side],nil,true];
};
};
if(true) exitWith{
_requestor setVariable ["requesting_cannons",nil,true];
Server setVariable [format["Arti_%1_requestor",_side],ObjNull,true];
};