Skip to content

Commit e08cbc6

Browse files
committed
gang can be asked to join resistance
1 parent 66ee8f3 commit e08cbc6

9 files changed

Lines changed: 154 additions & 24 deletions

File tree

addons/overthrow_main.pbo

4.37 KB
Binary file not shown.

addons/overthrow_main/CfgFunctions.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ class CfgFunctions
580580
class formOrJoinGang {};
581581
class formGang {};
582582
class addToGang {};
583+
class gangJoinResistance {};
583584
};
584585

585586
class GUER

addons/overthrow_main/functions/actions/fn_exportAll.sqf

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ sleep 5;
1717

1818
private _combinedItems = OT_allItems + OT_allBackpacks + OT_Resources;
1919
private _total = 0;
20+
2021
{
21-
_x params ["_cls", "_num"];
22+
_x params ["_cls", "_qty"];
2223
private _count = 0;
2324
if((_doillegal || _cls in _combinedItems) && !(_cls in OT_allClothing)) then {
2425
private _baseprice = [OT_nation,_cls,0] call OT_fnc_getSellPrice;
@@ -30,28 +31,58 @@ private _total = 0;
3031
_costprice = round(_baseprice * 0.3);
3132
};
3233

33-
_total = _total + (_costprice * _num);
34-
[_target, _cls, _num] call {
35-
params ["_target", "_cls", "_num"];
36-
if(_cls isKindOf ["Rifle",configFile >> "CfgWeapons"]) exitWith {
37-
[_target, _cls, _num] call CBA_fnc_removeWeaponCargo;
38-
};
39-
if(_cls isKindOf ["Launcher",configFile >> "CfgWeapons"]) exitWith {
40-
[_target, _cls, _num] call CBA_fnc_removeWeaponCargo;
41-
};
42-
if(_cls isKindOf ["Pistol",configFile >> "CfgWeapons"]) exitWith {
43-
[_target, _cls, _num] call CBA_fnc_removeWeaponCargo;
44-
};
45-
if(_cls isKindOf ["Default",configFile >> "CfgMagazines"]) exitWith {
46-
[_target, _cls, _num] call CBA_fnc_removeMagazineCargo;
47-
};
48-
if(_cls isKindOf "Bag_Base") exitWith {
49-
[_target, _cls, _num] call CBA_fnc_removeBackpackCargo;
34+
_total = _total + (_costprice * _qty);
35+
36+
private _noncontaineritems = ((weaponCargo _target) + (itemCargo _target) + (magazineCargo _target) + (backpackCargo _target)) call BIS_fnc_consolidateArray;
37+
private _ncqty = 0;
38+
{
39+
_x params ["_thiscls","_thisqty"];
40+
if(_thiscls isEqualTo _cls) exitWith {
41+
_ncqty = _thisqty;
5042
};
51-
if !([_target, _cls, _num] call CBA_fnc_removeItemCargo) then {
52-
[_target, _cls, _num] call CBA_fnc_removeWeaponCargo;
43+
}foreach(_noncontaineritems);
44+
if(_ncqty > 0) then {
45+
if !([_target, _cls, _ncqty] call CBA_fnc_removeItemCargo) then {
46+
if !([_target, _cls, _ncqty] call CBA_fnc_removeWeaponCargo) then {
47+
if !([_target, _cls, _ncqty] call CBA_fnc_removeMagazineCargo) then {
48+
if !([_target, _cls, _ncqty] call CBA_fnc_removeBackpackCargo) then {
49+
};
50+
};
51+
};
5352
};
5453
};
54+
_qty = _qty - _ncqty;
55+
if(_qty > 0) then {
56+
//still need to find more items in backpacks, uniforms etc
57+
{
58+
_x params ["_itemcls","_item"];
59+
{
60+
_x params ["_c","_q"];
61+
if(_c isEqualTo _sellcls) exitWith {
62+
[_item, _cls, _q] call CBA_fnc_removeItemCargo;
63+
_qty = _qty - _q;
64+
};
65+
}foreach((itemCargo _item) call BIS_fnc_consolidateArray);
66+
if(_qty > 0) then {
67+
{
68+
_x params ["_c","_q"];
69+
if(_c isEqualTo _sellcls) exitWith {
70+
[_item, _cls, _q] call CBA_fnc_removeWeaponCargo;
71+
_qty = _qty - _q;
72+
};
73+
}foreach((weaponCargo _item) call BIS_fnc_consolidateArray);
74+
};
75+
if(_qty > 0) then {
76+
{
77+
_x params ["_c","_q"];
78+
if(_c isEqualTo _sellcls) exitWith {
79+
[_item, _cls, _q] call CBA_fnc_removeMagazineCargo;
80+
_qty = _qty - _q;
81+
};
82+
}foreach((magazineCargo _item) call BIS_fnc_consolidateArray);
83+
};
84+
}foreach(everyContainer _target);
85+
};
5586
};
5687
}foreach(_target call OT_fnc_unitStock);
5788

addons/overthrow_main/functions/actions/fn_requestJobFaction.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ private _jobcode = {};
1010
private _faction = OT_interactingWith getvariable ["faction",""];
1111
private _expiry = 0;
1212
private _pos = getpos player;
13-
private _standing = server getVariable [format["standing%1",_cls],0];
13+
private _standing = server getVariable [format["standing%1",_faction],0];
1414
private _inSpawnDistance = true;
1515
private _town = _pos call OT_fnc_nearestTown;
1616
private _stability = server getVariable [format["stability%1",_town],100];

addons/overthrow_main/functions/actions/fn_talkToCiv.sqf

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,64 @@ if (_canGangJob) then {
119119
_options pushBack [format["Do you have any jobs for me?"], {
120120
OT_jobsOffered = [];
121121
call OT_fnc_requestJobGang;
122-
}]
122+
}];
123+
if(_rep >= 100) then {
124+
_options pushBack [format["Do you want to join the resistance?"], {
125+
params ["_gangid","_gang","_name"];
126+
private _talk = ["Do you want to join the resistance?"];
127+
private _civ = OT_interactingWith;
128+
private _town = (getpos player) call OT_fnc_nearestTown;
129+
private _support = [_town] call OT_fnc_support;
130+
private _code = {};
131+
if(_support > 100) then {
132+
_talk pushback format["We've heard good things about what you've been doing. I guess we're in"];
133+
_talk pushback "Good to have you on board";
134+
_code = {
135+
params ["_civ","","_gangid"];
136+
[_civ,_gangid,player] call OT_fnc_gangJoinResistance;
137+
};
138+
}else{
139+
_talk pushback format["I dunno, you've been a big help to us but support for your 'resistance' isnt great around here."];
140+
_code = {
141+
params ["_civ","_town","_gangid","_gang","_name"];
142+
_gangoptions = [];
143+
_gangoptions pushBack [
144+
"Offer $5000",{
145+
params ["_town","_gangid","_gang","_name"];
146+
private _civ = OT_interactingWith;
147+
private _cash = player getVariable ["money",0];
148+
if(_cash >= 5000) then {
149+
[
150+
player,
151+
_civ,
152+
["What if I gave you $5000?",format["Yeah, OK.",_name]],
153+
{
154+
params ["_civ","_gangid"];
155+
[_civ,_gangid,player] call OT_fnc_gangJoinResistance;
156+
[-5000] call OT_fnc_money;
157+
},
158+
[_civ,_gangid]
159+
] call OT_fnc_doConversation;
160+
}else{
161+
"You cannot afford that" call OT_fnc_notifyMinor;
162+
};
163+
},
164+
[_civ,_town,_gangid,_gang,_name]
165+
];
166+
167+
_gangoptions pushBack ["Cancel",{}];
168+
_gangoptions call OT_fnc_playerDecision;
169+
}
170+
};
171+
[
172+
player,
173+
_civ,
174+
_talk,
175+
_code,
176+
[_civ,_town,_gangid,_gang,_name]
177+
] call OT_fnc_doConversation;
178+
},[_gangid,_gang,_name]];
179+
};
123180
};
124181
};
125182
};

addons/overthrow_main/functions/factions/CRIM/fn_formGang.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if((count _possible) > 0) then {
6767
private _group = creategroup [opfor,true];
6868
_group setVariable ["VCM_TOUGHSQUAD",true,true];
6969
_group setVariable ["VCM_NORESCUE",true,true];
70-
spawner setVariable [format["gangspawn%1",_gangid],_group];
70+
spawner setVariable [format["gangspawn%1",_gangid],_group,true];
7171
_groups pushback _group;
7272
_groups pushback _leaderGroup;
7373
spawner setvariable [_spawnid,_groups,false];
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
params ["_leader","_gangid","_player"];
2+
3+
private _gang = OT_civilians getVariable [format["gang%1",_gangid],[]];
4+
if(count _gang isEqualTo 0) exitWith {diag_log "Overthrow Error: gang not found (OT_fnc_gangJoinResistance)"};
5+
6+
private _group = creategroup resistance;
7+
private _name = _gang select 8;
8+
private _town = _gang select 2;
9+
10+
[_leader] joinSilent grpNull;
11+
[_leader] joinSilent _group;
12+
_group selectLeader _leader;
13+
_leader enableAI "PATH";
14+
15+
private _cc = _player getVariable ["OT_squadcount",0];
16+
_group setGroupIdGlobal [_name];
17+
_cc = _cc + 1;
18+
_player hcSetGroup [_group,groupId _group,"teamgreen"];
19+
20+
private _gangGroup = spawner getVariable [format["gangspawn%1",_gangid],grpNull];
21+
22+
{
23+
[_x] joinSilent grpNull;
24+
[_x] joinSilent _group;
25+
[_x,getPlayerUID player] call OT_fnc_setOwner;
26+
_x setVariable ["OT_spawntrack",true,true];
27+
player reveal [_x,4];
28+
}foreach(units _gangGroup);
29+
30+
_player setVariable ["OT_squadcount",_cc,true];
31+
32+
private _recruits = server getVariable ["squads",[]];
33+
_recruits pushback [getplayeruid _player,_gangid,_group,[]];
34+
server setVariable ["squads",_recruits,true];
35+
36+
OT_civilians setVariable [format["gangsin%1",_town],[],true];
37+
OT_civilians setVariable [format["gang%1",_gangid],[],true];
38+
spawner setVariable [format["gangspawn%1",_gangid],grpNull,true];
39+
40+
format["%1 has joined the resistance as your squad, use ctrl + space to command",_name] call OT_fnc_notifyMinor;

addons/overthrow_main/functions/fn_initVar.sqf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ if(OT_hasTFAR) then {
227227

228228
if (isServer) then {
229229
cost setVariable ["OT_Wood",[5,0,0,0],true];
230+
cost setVariable ["OT_Lumber",[8,0,0,0],true];
230231
cost setVariable ["OT_Steel",[25,0,0,0],true];
231232
cost setVariable ["OT_Plastic",[40,0,0,0],true];
232233
cost setVariable ["OT_Sugarcane",[5,0,0,0],true];

addons/overthrow_main/functions/virtualization/spawners/fn_spawnCivilians.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private _gangs = OT_civilians getVariable [format["gangs%1",_town],[]];
8989
_group setVariable ["VCM_TOUGHSQUAD",true,true];
9090
_group setVariable ["VCM_NORESCUE",true,true];
9191
_groups pushback _group;
92-
spawner setVariable [format["gangspawn%1",_gangid],_group];
92+
spawner setVariable [format["gangspawn%1",_gangid],_group,true];
9393
if(count _gang > 4) then { //Filter out old gangs
9494
private _home = _gang select 4; //camp position
9595

0 commit comments

Comments
 (0)