Skip to content

Commit f949925

Browse files
committed
faction job + bugfixes
1 parent 69355e3 commit f949925

23 files changed

Lines changed: 227 additions & 115 deletions

addons/overthrow_main.pbo

4.08 KB
Binary file not shown.

addons/overthrow_main/CfgFunctions.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ class CfgFunctions
277277
class requestJobResistance {};
278278
class requestJobGang {};
279279
class requestJobShop {};
280+
class requestJobFaction {};
280281

281282
/* Safe */
282283
class safePutMoney {};

addons/overthrow_main/functions/AI/NPC/fn_initCivilianGroup.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ private _activeshops = server getVariable [format["activeshopsin%1",_town],[]];
1717

1818
private _dest = [];
1919

20-
if(count _activeshops > 0) then {
20+
if(count _activeshops > 0 && (random 100) > 50) then {
2121
_shop = selectRandom _activeshops;
22-
_dest = _shop select 0;
22+
_dest = (_shop select 0) findEmptyPosition [3,50,OT_civType_local];
2323
}else{
2424
_dest = _town call OT_fnc_getRandomRoadPosition;
2525
};

addons/overthrow_main/functions/AI/NPC/fn_initCrimLeader.sqf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ _unit setVariable ["hometown",_town,false];
1212
[_unit, (OT_voices_local call BIS_fnc_selectRandom)] remoteExecCall ["setSpeaker", 0, _unit];
1313
_unit forceAddUniform (OT_CRIM_Clothes call BIS_fnc_selectRandom);
1414

15-
private _loadout = (format["gang%1",_gangid]) call OT_fnc_getRandomLoadout;
16-
17-
_unit setUnitLoadout [_loadout,true];
15+
private _gang = OT_civilians getVariable [format["gang%1",_gangid],[]];
16+
_unit setUnitLoadout [_gang select 5,true];
1817

1918
if((random 100) < 50) then {
2019
_unit addItem "OT_Ganja";

addons/overthrow_main/functions/AI/NPC/fn_initCriminal.sqf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ _unit setRank "SERGEANT";
88
_unit setSkill 0.4 + (random 0.4);
99

1010
_unit removeAllEventHandlers "FiredNear";
11-
12-
private _loadout = (format["gang%1",_gangid]) call OT_fnc_getRandomLoadout;
13-
14-
_unit setUnitLoadout [_loadout,true];
11+
private _gang = OT_civilians getVariable [format["gang%1",_gangid],[]];
12+
_unit setUnitLoadout [_gang select 5,true];
1513

1614
if((random 100) < 15) then {
1715
_unit addItem "OT_Ganja";

addons/overthrow_main/functions/AI/orders/fn_squadGetOut.sqf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
private _paras = (units _squad) - [driver _vehicle, gunner _vehicle, commander _vehicle];
99
private _dir = direction _vehicle;
1010
private _chuteheight = 100;
11+
_paras allowGetIn false;
1112

1213
{
1314
spawner setvariable [format["eject_%1",[_x] call OT_fnc_getBuildID],getUnitLoadout _x,false];
1415
removeBackpackGlobal _x;
1516
_x disableCollisionWith _vehicle;// Sometimes units take damage when being ejected.
1617
_x addBackpackGlobal "B_parachute";
17-
unassignvehicle _x;
18-
moveout _x;
18+
unassignVehicle _x;
19+
_x action ["Eject",_vehicle];
1920
_x setDir (_dir + 90);// Exit the chopper at right angles.
2021
sleep 1;
2122
} forEach _paras;
@@ -39,7 +40,7 @@
3940

4041
waitUntil { !(alive _unit) || isTouchingGround _unit || (position _unit select 2) < 1 };
4142

42-
_unit action ["eject",_unit];
43+
_unit action ["Eject",vehicle _unit];
4344
sleep 1;
4445
private _inv = name _unit;
4546
private _id = [_unit] call OT_fnc_getBuildID;

addons/overthrow_main/functions/actions/fn_buy.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if(_money < _price) exitWith {"You cannot afford that!" call OT_fnc_notifyMinor}
1616

1717
//If faction dealer, increase standing
1818
private _civ = OT_interactingWith;
19-
if(!isNil "_civ" && _civ getVariable ["factionrep",false] && !((_cls isKindOf "Land") || (_cls isKindOf "Air"))) then {
19+
if(!isNil "_civ" && _civ getVariable ["factionrep",false] && !((_cls isKindOf "Land") || (_cls isKindOf "Air") || (_cls isKindOf "Ship"))) then {
2020
_faction = _civ getVariable ["faction",""];
2121
if !(_faction isEqualTo "") then {
2222
_increase = floor (_price / 1000);
@@ -46,7 +46,7 @@ if(_cls == "Set_HMG") exitWith {
4646
format["You bought a Quad Bike w/ HMG for $%1",_price] call OT_fnc_notifyMinor;
4747
playSound "3DEN_notificationDefault";
4848
};
49-
if(OT_interactingWith getVariable ["factionrep",false] && ((_cls isKindOf "Land") || (_cls isKindOf "Air"))) exitWith {
49+
if(OT_interactingWith getVariable ["factionrep",false] && ((_cls isKindOf "Land") || (_cls isKindOf "Air") || (_cls isKindOf "Ship"))) exitWith {
5050
private _blueprints = server getVariable ["GEURblueprints",[]];
5151
if !(_cls in _blueprints) then {
5252
_blueprints pushback _cls;

addons/overthrow_main/functions/actions/fn_buyBuilding.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if(_handled) then {
3535

3636
if(_type isEqualTo "buy") then {
3737
private _id = [_building] call OT_fnc_getBuildID;
38-
[_id,getPlayerUID player] call OT_fnc_setOwner;
38+
[_building,getPlayerUID player] call OT_fnc_setOwner;
3939
[-_price] call OT_fnc_money;
4040

4141
buildingpositions setVariable [_id,position _building,true];
@@ -45,7 +45,7 @@ if(_handled) then {
4545
}else{
4646
if ((typeof _building) in OT_allRealEstate) then {
4747
private _id = [_building] call OT_fnc_getBuildID;
48-
[_id,nil] call OT_fnc_setOwner;
48+
[_building,nil] call OT_fnc_setOwner;
4949
private _leased = player getVariable ["leased",[]];
5050
_leased deleteAt (_leased find _id);
5151
player setVariable ["leased",_leased,true];
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
closeDialog 0;
3+
private _gotjob = false;
4+
private _jobdef = [];
5+
private _activeJobs = spawner getVariable ["OT_activeJobIds",[]];
6+
private _completed = server getVariable ["OT_completedJobIds",[]];
7+
private _params = [];
8+
private _id = "";
9+
private _jobcode = {};
10+
private _faction = OT_interactingWith getvariable ["faction",""];
11+
private _expiry = 0;
12+
private _pos = getpos player;
13+
private _standing = server getVariable [format["standing%1",_cls],0];
14+
private _inSpawnDistance = true;
15+
private _town = _pos call OT_fnc_nearestTown;
16+
private _stability = server getVariable [format["stability%1",_town],100];
17+
private _population = server getVariable [format["population%1",_town],50];
18+
19+
{
20+
_x params ["_name",["_target",""],"_condition","_code","_repeat","_chance","_expires"];
21+
_jobdef = _x;
22+
_jobcode = _code;
23+
_expiry = _expires;
24+
call {
25+
if((toLower _target) isEqualTo "faction") exitWith {
26+
_id = format["%1-%2",_name,_gangid];
27+
if(([_inSpawnDistance, _standing, _town, _stability, _population] call _condition) && !(_id in _completed) && !(_id in _activeJobs) && !(_id in OT_jobsOffered)) then {
28+
_gotjob = true;
29+
_params = [_faction];
30+
}
31+
};
32+
};
33+
if(_gotjob) exitWith {};
34+
}foreach([OT_allJobs,[],{random 100},"ASCEND",{_x select 7}] call BIS_fnc_SortBy);
35+
36+
if !(_gotjob) exitWith {
37+
[OT_interactingWith,player,["We don't have any more jobs at the moment."]] spawn OT_fnc_doConversation;
38+
};
39+
40+
private _job = [_id,_params] call _jobcode;
41+
OT_jobShowing = _job;
42+
OT_jobShowingID = _id;
43+
OT_jobShowingExpiry = _expiry;
44+
OT_jobsOffered pushback _id;
45+
if(count _job isEqualTo 0) exitWith {call OT_fnc_requestJobGang};
46+
_job params ["_info","_markerPos","_setup","_fail","_success","_end","_jobparams"];
47+
48+
OT_jobShowingType = "faction";
49+
50+
createDialog "OT_dialog_joboffer";
51+
disableSerialization;
52+
53+
_job params ["_info","_markerPos"];
54+
_info params ["_title","_desc"];
55+
56+
_textctrl = (findDisplay 8000) displayCtrl 1199;
57+
58+
_textctrl ctrlSetStructuredText parseText format["
59+
<t align='center' size='1.1'>%1</t><br/><br/>
60+
<t align='center' size='0.8'>%2</t><br/>
61+
",_title,_desc];
62+
63+
_job

addons/overthrow_main/functions/actions/fn_sellAll.sqf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if(_total > 100) then {[_town,round(_total / 100)] call OT_fnc_support};
3333
private _ocls = _sellcls;
3434

3535
if((player getVariable ["OT_shopTarget","Self"]) isEqualTo "Vehicle") then {
36-
private _noncontaineritems = ((itemCargo _target) + (magazineCargo _target) + (backpackCargo _target)) call BIS_fnc_consolidateArray;
36+
private _noncontaineritems = ((weaponCargo _target) + (itemCargo _target) + (magazineCargo _target) + (backpackCargo _target)) call BIS_fnc_consolidateArray;
3737
private _ncqty = 0;
3838
{
3939
_x params ["_thiscls","_thisqty"];
@@ -42,7 +42,14 @@ if((player getVariable ["OT_shopTarget","Self"]) isEqualTo "Vehicle") then {
4242
};
4343
}foreach(_noncontaineritems);
4444
if(_ncqty > 0) then {
45-
[_target, _sellcls, _ncqty] call CBA_fnc_removeItemCargo;
45+
if !([_target, _sellcls, _ncqty] call CBA_fnc_removeItemCargo) then {
46+
if !([_target, _sellcls, _ncqty] call CBA_fnc_removeWeaponCargo) then {
47+
if !([_target, _sellcls, _ncqty] call CBA_fnc_removeMagazineCargo) then {
48+
if !([_target, _sellcls, _ncqty] call CBA_fnc_removeBackpackCargo) then {
49+
};
50+
};
51+
};
52+
};
4653
};
4754
_qty = _qty - _ncqty;
4855
if(_qty > 0) then {
@@ -57,7 +64,6 @@ if((player getVariable ["OT_shopTarget","Self"]) isEqualTo "Vehicle") then {
5764
};
5865
}foreach((itemCargo _item) call BIS_fnc_consolidateArray);
5966
if(_qty > 0) then {
60-
6167
{
6268
_x params ["_c","_q"];
6369
if(_c isEqualTo _sellcls) exitWith {

0 commit comments

Comments
 (0)