Seasonal Trader Fix

This commit is contained in:
He-Man 2018-12-02 00:10:38 +01:00
parent d1a55a5386
commit 6965609e96
9 changed files with 25 additions and 18 deletions

View File

@ -156,6 +156,7 @@ forceRestartTime = 14400; // 4 hour restarts
// "ItemSafe",
// "ItemGoldBar10oz"
};
TraderDeco = "true"; // If true, Traders get around Halloween / Christmas some seasonal decoration
// Spawntables
forcedVehicleSpawnTable = ""; // leave blank for default. Options: "allowedVehiclesList","allowedVehiclesList_CUP","allowedVehiclesList_MAD","allowedVehiclesList_MADCUP"

View File

@ -19,7 +19,7 @@ _missionIndex = lbCurSel 1500;
_missionAllowed = true;
_missionClasses = getArray(getMissionConfig "EpochMissionList" >> "traderMissionClasses");
_nrEnts = player nearEntities ["Man", 20];
_nrEnts = EPOCH_Traders select {alive _x && player distance _x < 20};
_trader = objNull;
{
if ((_x getVariable ["AI_SLOT", -1]) > -1) exitWith {

View File

@ -28,7 +28,7 @@ class prepForDelivery {
faileddialogues[] = {"I guess you have better things to do.","Try again later.","You didn't pick up the document. Misison Failed !"};
completeCondition = "('ItemDocumentMission' in magazines player)";
completedialogues[] = {"That's great, let's get out of here.","Good, you have the document, let's move on.","Ok, well done. We can start now."};
completedCALL = "uiNameSpace setVariable ['axeStartTraders',(player nearentities [['C_Man_1'],500]) apply {_x getVariable ['AI_SLOT',-1]} select {!(_x == -1)}]";
completedCALL = "uiNameSpace setVariable ['axeStartTraders',EPOCH_Traders select {_x distance player < 500 && alive _x}]";
reward[] = {};
cleanUp = 0;
nextTask[] = {"doDelivery"};
@ -63,13 +63,13 @@ class doDelivery {
{"Don't leave that document anywhere.","If you lose that document you will fail the mission."}
},
{
"(count (((player nearentities [['C_Man_1'],42]) apply {_x getvariable ['AI_SLOT',-1]}) select {!(_x == -1)}) > 0) && (count (((player nearentities [['C_Man_1'],42]) apply {_x getVariable ['AI_SLOT',-1]}) select {_x in (uiNameSpace getVariable ['axeStartTraders',[]])}) < 1)",
"({player distance _x < 42 && !((_x getvariable ['AI_SLOT',-1]) == -1) && alive _x && !(_x in (uiNameSpace getVariable ['axeStartTraders',[]]))} count EPOCH_Traders > 0)",
{"Well done, you have a trader nearby, go see him","Looks like you found another trader, well done, deliver the message.","UAV has spotted another trader nearby, go deliver the message."}
}
};
callevents[] = { // {{ARRAY1},{ARRAY2},... }
{ // {"condition",{"Message1","Message2", ...},{"NextTask1","NextTask2", ...}}
"(EPOCH_task_startTime + 480 < diag_tickTime) && (count (((player nearentities [['C_Man_1'],500]) apply {_x getVariable ['AI_SLOT',-1]}) select {_x in (uiNameSpace getVariable ['axeStartTraders',[]])}) > 0)",
"(EPOCH_task_startTime + 480 < diag_tickTime) && ({player distance _x < 500 && !((_x getvariable ['AI_SLOT',-1]) == -1) && alive _x && (_x in (uiNameSpace getVariable ['axeStartTraders',[]]))} count EPOCH_Traders > 0)",
"[""Hey, what are you doing here ? Get on with your task !"", 5,[[0,0,0,0.5],[1,0.5,0,1]]] call Epoch_message",
{}
}
@ -77,7 +77,7 @@ class doDelivery {
abandonTime = 1800;
failedCondition = "false";
faileddialogues[] = {"Looks like you took too long buddy, Mission Over.","You need to be quicker next time, Mission Over !","Misison Failed - You took too long, better luck next time."};
completeCondition = "(count (((player nearentities [['C_Man_1'],6]) apply {_x getvariable ['AI_SLOT',-1]}) select {!(_x == -1)}) > 0) && (count (((player nearentities [['C_Man_1'],6]) apply {_x getVariable ['AI_SLOT',-1]}) select {_x in (uiNameSpace getVariable ['axeStartTraders',[]])}) < 1)";
completeCondition = "({player distance _x < 6 && !((_x getvariable ['AI_SLOT',-1]) == -1) && alive _x && !(_x in (uiNameSpace getVariable ['axeStartTraders',[]]))} count EPOCH_Traders > 0)";
completedialogues[] = {"Hey there pal, it looks like you have something for me ?","Great Job there. Step into my office traveller.","You made it, time to take a look at that message."};
completedCALL = "";
reward[] = {};

View File

@ -9,7 +9,7 @@ class StartFishMission {
markerVisible = 0;
markerRadius = 0;
markerText = "";
initcall = "uiNameSpace setVariable ['axeStartTraders',(player nearentities [[""C_Man_1""],20]) apply {_x getVariable [""AI_SLOT"",-1]}]; EPOCH_Mission_StartPos = getpos player";
initcall = "uiNameSpace setVariable ['axeStartTraders',EPOCH_Traders select {_x distance player < 20 && alive _x}]; EPOCH_Mission_StartPos = getpos player";
cleanUpCall = "uiNameSpace setVariable ['axeStartTraders', nil];EPOCH_Mission_StartPos = nil";
dialogues[] = { // {{ARRAY1},{ARRAY2},... }
{ // {"condition",{"Message1","Message2", ...}}
@ -103,7 +103,7 @@ class BringTheFish {
abandonTime = 1200;
failedCondition = "!alive player";
faileddialogues[] = {"I guess you have better things to do. - Mission Failed","Mission Failed - You took to long."};
completeCondition = "((player nearentities [[""C_Man_1""],20]) apply {_x getVariable [""AI_SLOT"",-1]} isEqualTo (uiNameSpace getVariable [""axeStartTraders"",[]])) && {_x in magazines player} count ([""CfgEpochClient"", ""fishLoots"", [""ItemTuna"",""ItemSeaBass"",""ItemSeaBass"",""ItemSeaBass"",""ItemTrout"",""ItemTrout"",""ItemTrout"",""ItemTrout"",""ItemTrout"",""ItemTrout""]] call EPOCH_fnc_returnConfigEntryV2) > 0";
completeCondition = "({player distance _x < 20 && !((_x getvariable ['AI_SLOT',-1]) == -1) && alive _x && (_x in (uiNameSpace getVariable ['axeStartTraders',[]]))} count EPOCH_Traders > 0) && {_x in magazines player} count (['CfgEpochClient', 'fishLoots', ['ItemTuna','ItemSeaBass','ItemSeaBass','ItemSeaBass','ItemTrout','ItemTrout','ItemTrout','ItemTrout','ItemTrout','ItemTrout']] call EPOCH_fnc_returnConfigEntryV2) > 0";
completedialogues[] = {"Hey, you bring me my Fish? - THANKS!!!","Great Job there. Step into my office traveller.","You made it, thanks for bringing me the Fish."};
completedCALL = "{if (_x in magazines player) exitwith {player removeMagazine _x}} foreach ([""CfgEpochClient"", ""fishLoots"", [""ItemTuna"",""ItemSeaBass"",""ItemSeaBass"",""ItemSeaBass"",""ItemTrout"",""ItemTrout"",""ItemTrout"",""ItemTrout"",""ItemTrout"",""ItemTrout""]] call EPOCH_fnc_returnConfigEntryV2)";
reward[] = {};

View File

@ -24,7 +24,7 @@ class prepForMonsterEscort {
callevents[] = { // {{ARRAY1},{ARRAY2},... }
{ // {"condition",{"Message1","Message2", ...},{"NextTask1","NextTask2", ...}}
"true",
"uiNameSpace setVariable ['axeStartTraders',(player nearentities [[""C_Man_1""],500]) apply {_x getVariable [""AI_SLOT"",-1]}]",
"uiNameSpace setVariable ['axeStartTraders',EPOCH_Traders select {_x distance player < 500 && alive _x}]",
{}
},
{ // {"condition",{"Message1","Message2", ...},{"NextTask1","NextTask2", ...}}
@ -85,11 +85,11 @@ class EscortMonster {
{"Go forward, my Monster will follow you!","Hurry up a bit. My Monster is hungry..."}
},
{
"(count (player nearentities [[""C_Man_1""],42]) > 0) && (count (((player nearentities [[""C_Man_1""],42]) apply {_x getVariable [""AI_SLOT"",-1]}) select {_x in (uiNameSpace getVariable [""axeStartTraders"",[]])}) < 1)",
"({player distance _x < 42 && !((_x getvariable ['AI_SLOT',-1]) == -1) && alive _x && !(_x in (uiNameSpace getVariable ['axeStartTraders',[]]))} count EPOCH_Traders > 0)",
{"Well done, you have a trader nearby, go see him","Looks like you found another trader, well done, deliver the Monster.","UAV has spotted another trader nearby, go deliver the Monster."}
},
{
"(EPOCH_task_startTime + 480 < diag_tickTime) && ((player nearentities [[""C_Man_1""],500]) apply {_x getVariable [""AI_SLOT"",-1]} isEqualTo (uiNameSpace getVariable [""axeStartTraders"",[]]))",
"(EPOCH_task_startTime + 480 < diag_tickTime) && ({player distance _x < 500 && !((_x getvariable ['AI_SLOT',-1]) == -1) && alive _x && (_x in (uiNameSpace getVariable ['axeStartTraders',[]]))} count EPOCH_Traders > 0)",
{"Hey, what are you doing here ? Get on with your task!"}
}
};
@ -98,7 +98,7 @@ class EscortMonster {
abandonTime = 2000;
failedCondition = "!alive EPOCH_Monster || !alive player || EPOCH_Monster distance player > 500";
faileddialogues[] = {"Oh no, you lost my Monster - Mission Failed","My Monster ist gone, Mission Over!"};
completeCondition = "player distance EPOCH_Monster < 50 && (count (player nearentities [[""C_Man_1""],20]) > 0) && (count (((player nearentities [[""C_Man_1""],20]) apply {_x getVariable [""AI_SLOT"",-1]}) select {_x in (uiNameSpace getVariable [""axeStartTraders"",[]])}) < 1)";
completeCondition = "player distance EPOCH_Monster < 50 && ({player distance _x < 20 && !((_x getvariable ['AI_SLOT',-1]) == -1) && alive _x && !(_x in (uiNameSpace getVariable ['axeStartTraders',[]]))} count EPOCH_Traders > 0)";
completedialogues[] = {"Hey, you bring me my friends Monster?","Great Job there. Step into my office traveller.","You made it, thanks for bringing me the Monster."};
completedCALL = "";
reward[] = {};

View File

@ -234,7 +234,7 @@ class uavMission2{
markerVisible = 0;
markerRadius = 220;
markerText = "UAV Trader";
initcall = "_obj = selectRandom (player nearentities [[""C_Man_1""],10500] select {_x getVariable [""AI_SLOT"",-1] > -1 && player distance _x > 50});EPOCH_taskMarkerPos = getPosATL _obj;";
initcall = "_obj = selectRandom (Epoch_Traders select {player distance _x > 50 && alive _x && !((_x getvariable ['AI_SLOT',-1]) == -1)});EPOCH_taskMarkerPos = getPosATL _obj;";
cleanUpCall = "[(driver axeUAV)] joinSilent grpNull; removeFromRemainsCollector [axeUAV]; deletevehicle axeUAV";
dialogues[] = {
{

View File

@ -16,7 +16,7 @@
private [ "_TraderGodMode","_StaticTraderItemPurge","_DynamicTraderRespawnCount","_TraderItemsDeleteRestart","_TraderInit","_TraderItemsClean","_newstock","_agent","_aiTables",
"_arr","_config","_currentStock","_existingStock","_indexStock","_markers","_objHiveKey","_pos","_randomAIUniform","_response","_response2","_schedule",
"_serverSettingsConfig","_staticTrader","_staticTradersArrCount","_staticTradersArray","_storedVehicleLimit","_traderSlotIndex","_work","_arrchanged","_deleteat","_maxrnd",
"_WinterDeco","_HelloweenDeco","_buildingJammerRange"
"_WinterDeco","_HelloweenDeco","_buildingJammerRange","_TraderDeco"
];
//[[[end]]]
params [["_maxTraderLimit",0]];
@ -34,10 +34,11 @@ _StaticTraderItemPurge = [_serverSettingsConfig, "StaticTraderItemPurge", []] ca
_DynamicTraderRespawnCount = [_serverSettingsConfig, "DynamicTraderRespawnCount", 150] call EPOCH_fnc_returnConfigEntry;
_TraderItemCountPerItem = [_serverSettingsConfig, "TraderItemCountPerItem", [100,100]] call EPOCH_fnc_returnConfigEntry;
_TraderItemsDeleteRestart = [_serverSettingsConfig, "TraderItemsDeleteRestart", []] call EPOCH_fnc_returnConfigEntry;
_TraderDeco = [_serverSettingsConfig, "TraderDeco", true] call EPOCH_fnc_returnConfigEntry;
_buildingJammerRange = ["CfgEpochClient", "buildingJammerRange", 75] call EPOCH_fnc_returnConfigEntryV2;
_WinterDeco = (Epoch_ServerRealtime select 1) == 12 && (Epoch_ServerRealtime select 2) > 20;
_HelloweenDeco = ((Epoch_ServerRealtime select 1) == 10 && (Epoch_ServerRealtime select 2) >= 24) || ((Epoch_ServerRealtime select 1) == 11 && (Epoch_ServerRealtime select 2) <= 3);
_WinterDeco = (Epoch_ServerRealtime select 1) == 12 && (Epoch_ServerRealtime select 2) > 20 && _TraderDeco;
_HelloweenDeco = (((Epoch_ServerRealtime select 1) == 10 && (Epoch_ServerRealtime select 2) >= 24) || ((Epoch_ServerRealtime select 1) == 11 && (Epoch_ServerRealtime select 2) <= 3)) && _TraderDeco;
_TraderInit = {
_this allowdamage !_TraderGodMode;
@ -45,6 +46,7 @@ _TraderInit = {
_this setVariable ["AI_SLOT", _i, true];
_this setVariable ["AI_ITEMS", _arr, true];
_this addEventHandler ["Killed", { _this call EPOCH_server_traderKilled; }];
EPOCH_Traders pushback _this;
if (_this iskindof "MAN") then {
addToRemainsCollector[_this];
_this addUniform _randomAIUniform;

View File

@ -15,7 +15,7 @@
//[[[cog import generate_private_arrays ]]]
private [ "_serverSettingsConfig","_acceptableBlds","_agent","_aiClass","_aiTables","_buildingHome","_buildingWork","_buildings","_checkBuilding","_config","_endTime","_home",
"_homes","_markers","_objHiveKey","_pos","_position","_randomAIUniform","_return","_schedule","_slot","_spawnCount","_startTime","_traderHomes","_usedBuildings","_work",
"_WinterDeco","_HelloweenDeco","_buildingJammerRange"
"_WinterDeco","_HelloweenDeco","_buildingJammerRange","_TraderDeco"
];
//[[[end]]]
_serverSettingsConfig = configFile >> "CfgEpochServer";
@ -25,10 +25,11 @@ _config = (configFile >> "CfgEpoch" >> worldName);
_aiTables = getArray(_config >> "traderUniforms");
_acceptableBlds = getArray(_config >> "traderBlds");
_traderHomes = getArray(_config >> "traderHomes");
_TraderDeco = [_serverSettingsConfig, "TraderDeco", true] call EPOCH_fnc_returnConfigEntry;
_buildingJammerRange = ["CfgEpochClient", "buildingJammerRange", 75] call EPOCH_fnc_returnConfigEntryV2;
_WinterDeco = (Epoch_ServerRealtime select 1) == 12 && (Epoch_ServerRealtime select 2) > 20;
_HelloweenDeco = ((Epoch_ServerRealtime select 1) == 10 && (Epoch_ServerRealtime select 2) >= 24) || ((Epoch_ServerRealtime select 1) == 11 && (Epoch_ServerRealtime select 2) <= 3);
_WinterDeco = (Epoch_ServerRealtime select 1) == 12 && (Epoch_ServerRealtime select 2) > 20 && _TraderDeco;
_HelloweenDeco = (((Epoch_ServerRealtime select 1) == 10 && (Epoch_ServerRealtime select 2) >= 24) || ((Epoch_ServerRealtime select 1) == 11 && (Epoch_ServerRealtime select 2) <= 3)) && _TraderDeco;
_usedBuildings = [];
_checkBuilding = {
@ -98,6 +99,7 @@ for "_i" from 1 to _spawnCount do {
_markers = ["NewDynamicTrader",_pos] call EPOCH_server_createGlobalMarkerSet;
_agent setVariable["MARKER_REF", _markers];
};
EPOCH_Traders pushback _agent;
};
};
};

View File

@ -177,10 +177,12 @@ diag_log "Epoch: Loading teleports and static props";
call EPOCH_server_createTeleport;
diag_log "Epoch: Loading NPC traders";
EPOCH_Traders = [];
EPOCH_NPCSlotsLimit call EPOCH_server_loadTraders;
diag_log "Epoch: Spawning NPC traders";
call EPOCH_server_spawnTraders;
publicvariable "EPOCH_Traders";
diag_log "Epoch: Loading vehicles";
// Vehicle slot limit set to total of all allowed limits