Skip to content

Commit

Permalink
Merge pull request #127 from ArmaOverthrow/dev
Browse files Browse the repository at this point in the history
0.7.3.4
  • Loading branch information
armazac authored Apr 29, 2017
2 parents 36be43a + 1aea537 commit 51fccd7
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ overviewPicture = "\ot\campaign\missions\Overthrow.Tanoa\overthrow_tanoa.jpg";
author="ARMAzac";
briefingName = "Overthrow Tanoa";
OnLoadName = "Overthrow Tanoa";
OnLoadMission = "v0.7.3.3";
OnLoadMission = "v0.7.3.4";
loadScreen = "\ot\campaign\missions\Overthrow.Tanoa\pic.jpg";
onLoadMissionTime = 1;
allowSubordinatesTakeWeapons= 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ while {true} do {
if !(_name in _abandoned) then {
if(_pos call OT_fnc_inSpawnDistance) then {
_nummil = {side _x == west} count (_pos nearObjects ["CAManBase",300]);
_numres = {side _x == resistance} count (_pos nearObjects ["CAManBase",200]);
_numres = {side _x == resistance or captive _x} count (_pos nearObjects ["CAManBase",200]);
if(_nummil < 3 and _numres > 0) then {
_garrisoned = true;
server setVariable ["NATOattacking",_name,true];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ if(isMultiplayer and (!isServer)) then {

call compile preprocessFileLineNumbers "initFuncs.sqf";
call compile preprocessFileLineNumbers "initVar.sqf";
}else{
OT_varInitDone = true;
};

_start = [1385.17,505.453,1.88826];
Expand All @@ -53,7 +55,7 @@ introcam = _introcam;


if(player == bigboss and (server getVariable ["StartupType",""] == "")) then {
waitUntil {!(isnull (findDisplay 46))};
waitUntil {!(isnull (findDisplay 46)) and OT_varInitDone};
sleep 1;
_nul = createDialog "OT_dialog_start";
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ if (!isMultiplayer) exitWith {};

call compile preprocessFileLineNumbers "initFuncs.sqf";
call compile preprocessFileLineNumbers "initVar.sqf";
OT_varInitDone = true;
publicVariable "OT_varInitDone";

if(OT_fastTime) then {
setTimeMultiplier 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EditorData
};
class LayerIndexProvider
{
nextID=234;
nextID=239;
};
class Camera
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,56 @@ _lasthour = 0;
waitUntil {sleep 1;server getVariable ["StartupType",""] != ""};
sleep 20;
while {true} do {
_numplayers = count([] call CBA_fnc_players);
_lasthour = date select 3;
_totalStability = 0;
_totalPop = 0;
private _abandoned = server getVariable ["NATOabandoned",[]];
{
private _town = _x;
private _townPos = server getVariable _town;
private _commsAbandoned = ((_townPos call OT_fnc_nearestComms) select 1) in _abandoned;
private _stability = server getVariable format["stability%1",_town];
private _pop = server getVariable format["population%1",_town];
_totalStability = _totalStability + _stability;
_totalPop = _totalPop + _pop;
if(_town in _abandoned) then {
if(_commsAbandoned) then {
//Resistance controls both, stability goes up if theres police
_police = server getVariable [format["police%1",_town],0];
if (_police > 0) then {
[_town,floor(_police / 2)] call stability;
};
}else{
//NATO owns the tower but not the town, stability goes down
if((random 100) > 80) then {
[_town,-1] call stability;
};
};
}else{
if(_commsAbandoned) then {
//Resistance controls tower but not town, stability goes down
_police = server getVariable [format["garrison%1",_town],0];
_chance = 20;
if(_police < 4) then {
_chance = 50;
};
if(_police < 2) then {
_chance = 80;
};
if((random 100) < _chance) then {
[_town,-2] call stability;
if(_numplayers > 0) then {
_totalStability = 0;
_totalPop = 0;
private _abandoned = server getVariable ["NATOabandoned",[]];
{
private _town = _x;
private _townPos = server getVariable _town;
private _commsAbandoned = ((_townPos call OT_fnc_nearestComms) select 1) in _abandoned;
private _stability = server getVariable format["stability%1",_town];
private _pop = server getVariable format["population%1",_town];
_totalStability = _totalStability + _stability;
_totalPop = _totalPop + _pop;
if(_town in _abandoned) then {
if(_commsAbandoned) then {
//Resistance controls both, stability goes up if theres police
_police = server getVariable [format["police%1",_town],0];
if (_police > 0) then {
[_town,floor(_police / 2)] call stability;
};
}else{
if((random 100) > 50) then {
//NATO owns the tower but not the town, stability goes down
if((random 100) > 80) then {
[_town,-1] call stability;
};
};
}else{
if(_commsAbandoned) then {
//Resistance controls tower but not town, stability goes down
_police = server getVariable [format["garrison%1",_town],0];
_chance = 20;
if(_police < 4) then {
_chance = 50;
};
if(_police < 2) then {
_chance = 80;
};
if((random 100) < _chance) then {
[_town,-2] call stability;
}else{
if((random 100) > 50) then {
[_town,-1] call stability;
};
};
};
};
};
}foreach(OT_allTowns);
server setVariable ["stabilityTanoa",_totalStability / (count OT_allTowns),true];
server setVariable ["populationTanoa",_totalPop,true];
}foreach(OT_allTowns);
server setVariable ["stabilityTanoa",_totalStability / (count OT_allTowns),true];
server setVariable ["populationTanoa",_totalPop,true];
};
waitUntil {sleep 5;(date select 3) != _lasthour}; //do actions on the hour
};
12 changes: 6 additions & 6 deletions addons/overthrow_main/functions/AI/orders/fn_orderLoot.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ format["Looting nearby bodies into the %1",(typeof _target) call ISSE_Cfg_Vehicl
_unit doMove getpos _t;

_timeout = time + 120;
waitUntil {sleep 1; (!alive _unit) or (isNull _t) or (_unit distance _t < 3) or (_timeOut < time) or (unitReady _unit)};
waitUntil {sleep 1; (!alive _unit) or (isNull _t) or (_unit distance _t < 5) or (_timeOut < time) or (unitReady _unit)};
if(!alive _unit or (isNull _t) or (_timeOut < time)) exitWith {};

if !([_unit,_t] call dumpStuff) then {
Expand All @@ -70,7 +70,7 @@ format["Looting nearby bodies into the %1",(typeof _target) call ISSE_Cfg_Vehicl
_unit doMove getpos _deadguy;
[_unit,1] call OT_fnc_experience;

waitUntil {sleep 1; (!alive _unit) or (isNull _t) or (_unit distance _deadguy < 3) or (_timeOut < time)};
waitUntil {sleep 1; (!alive _unit) or (isNull _t) or (_unit distance _deadguy < 5) or (_timeOut < time)};
if((!alive _unit) or (_timeOut < time)) exitWith {};

[_deadguy,_unit] call takeStuff;
Expand All @@ -92,7 +92,7 @@ format["Looting nearby bodies into the %1",(typeof _target) call ISSE_Cfg_Vehicl
}foreach(_unit nearentities ["WeaponHolderSimulated",10]);
if !(isNull _weapon) then {
_unit doMove getpos _weapon;
waitUntil {sleep 1; (!alive _unit) or (_unit distance _weapon < 3) or (_timeOut < time)};
waitUntil {sleep 1; (!alive _unit) or (_unit distance _weapon < 5) or (_timeOut < time)};
if(alive _unit and (_timeOut > time)) then {
_s = (weaponsItems _weapon) select 0;

Expand All @@ -111,7 +111,7 @@ format["Looting nearby bodies into the %1",(typeof _target) call ISSE_Cfg_Vehicl
if(!alive _unit) exitWith {};
_timeout = time + 120;
_unit doMove getpos _t;
waitUntil {sleep 1; (!alive _unit) or (isNull _t) or (_unit distance _t < 3) or (_timeOut < time)};
waitUntil {sleep 1; (!alive _unit) or (isNull _t) or (_unit distance _t < 5) or (_timeOut < time)};
if((!alive _unit) or (_timeOut < time)) exitWith {};

if !([_unit,_t] call dumpStuff) exitWith {
Expand All @@ -136,7 +136,7 @@ format["Looting nearby bodies into the %1",(typeof _target) call ISSE_Cfg_Vehicl

_timeout = time + 120;
_unit doMove getpos _weapon;
waitUntil {sleep 1; (!alive _unit) or (_unit distance _weapon < 2) or (_timeOut < time) or (unitReady _unit)};
waitUntil {sleep 1; (!alive _unit) or (_unit distance _weapon < 5) or (_timeOut < time) or (unitReady _unit)};
if(alive _unit and (_timeOut > time)) then {
_s = (weaponsItems _weapon) select 0;
_cls = (_s select 0);
Expand All @@ -153,7 +153,7 @@ format["Looting nearby bodies into the %1",(typeof _target) call ISSE_Cfg_Vehicl
if(!alive _unit) exitWith {};
_timeout = time + 120;
_unit doMove getpos _t;
waitUntil {sleep 1; (!alive _unit) or (isNull _t) or (_unit distance _t < 2) or (_timeOut < time) or (unitReady _unit)};
waitUntil {sleep 1; (!alive _unit) or (isNull _t) or (_unit distance _t < 5) or (_timeOut < time) or (unitReady _unit)};
if((!alive _unit) or (_timeOut < time)) exitWith {};

[_unit,_t] call dumpStuff;
Expand Down

0 comments on commit 51fccd7

Please sign in to comment.