Bifi

Loot Spawnt in der Safezone

14 posts in this topic

Hallo,

Vielleicht kann mir ja hier im Deutschsprachigem Chat jemand helfen.

Ich habe auf meinem Server momentan die 3 Standart Traderzonen, und 3 von mir hinzugefügt Costum Traderzonen. (Alle 3 haben momentan Safezonen)

 

In Silderas Traderzone zum Beispiel, steht eine Repair Garage.

In der Garage spawnt Loot, direkt neben dem Trader.

Das ist zimmlich Uncool, da man hier extrem schnell Geld machen kann.

Den der Loot Spawnt schnell wieder.

 

Meine frage nun:
Ist es irgentwie möglich, der Loot in der Traderzone/Safezone zu deaktivieren?

Vielleicht mit einem Trigger um die Safezone, oder einen custom Code benutzen?

 

 

Vielen dank schonmal für eure Hilfe.

 

MfG

Bifi

Share this post


Link to post
Share on other sites

Heyho,

Mit dem nächsten update kommt der fix, solange kannst du die 

ExileServer_system_lootManager_spawnLootForPlayer.sqf überschreiben und folgenden Code hinzufügen.

Bitte achte darauf das deine Marker den ExileTraderZone Typ haben.

 

{
        _markerName = _x;
        if (getMarkerType _markerName == "ExileTraderZone") then
        {
                _markerCenterPosition = getMarkerPos _markerName;
                if((_building distance _markerCenterPosition) < 150)then
                {
                        throw false;
                };
        };
}
forEach allMapMarkers;

 

Füge den Code block gleich nach dem Flaggen check ein.

 

Gruß,

Onefox

1 person likes this

Share this post


Link to post
Share on other sites
Advertisement

Werden es auch mal mit dem nächsten Restart bei uns testen und Rückmeldung geben

Share this post


Link to post
Share on other sites

Heyho,

Mit dem nächsten update kommt der fix, solange kannst du die 

ExileServer_system_lootManager_spawnLootForPlayer.sqf überschreiben und folgenden Code hinzufügen.

Bitte achte darauf das deine Marker den ExileTraderZone Typ haben.

 

{
        _markerName = _x;
        if (getMarkerType _markerName == "ExileTraderZone") then
        {
                _markerCenterPosition = getMarkerPos _markerName;
                if((_building distance _markerCenterPosition) < 150)then
                {
                        throw false;
                };
        };
}
forEach allMapMarkers;

 

Füge den Code block gleich nach dem Flaggen check ein.

 

Gruß,

Onefox

Mache ich da was falsch?

Hier meine ExileServer_system_lootManager_spawnLootForPlayer.sqf :

/**
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_playerObject","_spawnRadius","_spawnChance","_notifyPlayer","_playerPosition","_lastKnownPlayerPosition","_radius","_flags","_buildings","_spawnedLootForThisPlayer","_building","_flag","_flagRadius","_buildingConfig","_lootTableName","_localPositions","_spawnedItemClassNames","_lootPosition","_itemClassName","_cargoType","_lootHolder","_magazineClassNames","_magazineClassName","_numberOfMagazines"];
_playerObject = _this;
_spawnRadius = (getNumber(configFile >> "CfgSettings" >> "LootSettings" >> "spawnRadius") max 50) min 200; 
_spawnChance = (getNumber(configFile >> "CfgSettings" >> "LootSettings" >> "spawnChance") max 0) min 99; 
_notifyPlayer = getNumber(configFile >> "CfgSettings" >> "LootSettings" >> "notifyPlayer");
try 
{
	if !(alive _playerObject) then 
	{
		throw false;
	};
	if !(vehicle _playerObject isEqualTo _playerObject) then
	{
		throw false;
	};
	_playerPosition = getPosATL _playerObject;
	_lastKnownPlayerPosition = _playerObject getVariable["ExilePositionAtLastLootSpawnCircle", [0,0,0]]; 
	if (_lastKnownPlayerPosition distance _playerPosition < 11) then
	{
		throw false;
	};
	_radius = getArray(missionConfigFile >> "CfgTerritories" >> "prices");
	_radius = (_radius select ((count _radius) -1)) select 1;
	_flags = _playerPosition nearObjects ["Exile_Construction_Flag_Static", _radius * 2];
	_buildings = _playerPosition nearObjects ["House", _spawnRadius];
	_spawnedLootForThisPlayer = false;
	{
		_building = _x;
		if!(_flags isEqualTo [])then
		{
			{
				_flag = _x;
				_flagRadius = _flag getVariable ["ExileTerritorySize",0];
				if((_building distance _flag) < _flagRadius)then
				{
					throw false;
				}; 
			} 
			forEach _flags;
			{
        _markerName = _x;
        if (getMarkerType _markerName == "ExileTraderZone") then
        {
                _markerCenterPosition = getMarkerPos _markerName;
                if((_building distance _markerCenterPosition) < 150)then
                {
                        throw false;
                };
        };
	}
		forEach allMapMarkers;
		};
		if (isClass(configFile >> "CfgBuildings" >> (typeOf _building))) then
		{
			if !([getPosATL _building, 10] call ExileServer_util_position_isPlayerNearby) then
			{
				if !(_building getVariable ["ExileHasLoot", false]) then
				{
					_buildingConfig = configFile >> "CfgBuildings" >> (typeOf _building);
					_lootTableName = getText(_buildingConfig >> "table");
					_localPositions = getArray(_buildingConfig >> "positions");
					_spawnedItemClassNames = [];
					{					
						if ((floor (random 100)) <= _spawnChance) then
						{
							_lootPosition = _building modelToWorld _x;
							if (_lootPosition select 2 < 0.05) then
							{
								_lootPosition set[2, 0.05];
							};
							_itemClassName = _lootTableName call ExileServer_system_lootManager_dropItem;
							if !(_itemClassName in _spawnedItemClassNames) then
							{
								_cargoType = _itemClassName call ExileClient_util_cargo_getType;
								_lootHolder = createVehicle ["GroundWeaponHolder",_lootPosition,[],0,"CAN_COLLIDE"];
								_lootHolder setDir (random 360);
								_lootHolder setPosATL _lootPosition;
								switch (_cargoType) do
								{
									case 1: 	{ _lootHolder addMagazineCargoGlobal [_itemClassName, 1]; };
									case 3: 	{ _lootHolder addBackpackCargoGlobal [_itemClassName, 1]; };
									case 2: 	
									{ 
										_lootHolder addWeaponCargoGlobal [_itemClassName, 1]; 
										if (_itemClassName != "Exile_Melee_Axe") then
										{
											_magazineClassNames = getArray(configFile >> "CfgWeapons" >> _itemClassName >> "magazines");
											if (count(_magazineClassNames) > 0) then
											{
												_magazineClassName = _magazineClassNames select (floor(random (count _magazineClassNames)));
												_numberOfMagazines = 2 + floor(random 3); 
												_lootHolder addMagazineCargoGlobal [_magazineClassName, _numberOfMagazines];
											};
										};
									};
									default { _lootHolder addItemCargoGlobal [_itemClassName,1]; };
								};
								ExileServerOwnershipSwapQueue pushBack [_lootHolder,_playerObject];
								_spawnedItemClassNames pushBack _itemClassName;
								_spawnedLootForThisPlayer = true;
							};
						};
					}
					forEach _localPositions;
					ExileServerBuildingNetIdsWithLoot pushBack (netId _building);
					_building setVariable ["ExileLootSpawnedAt", time];
					_building setVariable ["ExileHasLoot", true];
				};
			};
		};
	}
	forEach _buildings;
	if (_notifyPlayer == 1) then
	{
		if (_spawnedLootForThisPlayer) then
		{
			[_playerObject, "notificationRequest",["Success",["Loot spawned for you!"]]] call ExileServer_system_network_send_to;
		};
	};
	_playerObject setVariable["ExilePositionAtLastLootSpawnCircle", _playerPosition];	
	_playerObject setVariable["ExileLastLootSpawnTime", time];
}
catch 
{
};
true

Hier der Eintrag in der config.cpp:

class CfgExileCustomCode 
{
	ExileServer_object_vehicle_database_load = "overwrites\exile_server\code\ExileServer_object_vehicle_database_load.sqf";
	ExileClient_gui_hud_renderStatsPanel = "overwrites\exile_server\code\ExileClient_gui_hud_renderStatsPanel.sqf";
	ExileServer_system_trading_network_purchaseVehicleRequest = "overwrites\exile_server\code\ExileServer_system_trading_network_purchaseVehicleRequest.sqf";
	ExileServer_system_lootManager_spawnLootForPlayer = "overwrites\exile_server\code\ExileServer_system_lootManager_spawnLootForPlayer.sqf";
};

Hier die sqf, wo der Marker definiert wird:

/*
	ACD_SZ - Exile Safe Zones
	acd_SZ_Molos_Airfield_props.sqf
	by d4n1ch
	edit by Noldy
	mailto: d.e@acd.su
*/

if (!acd_SZ_Molos_Airfield) exitWith {
	diag_log format ["### ACD: SAFE ZONE IS OFF: NO PROPS WILL BE BUILT: acd_SZ_Molos_Airfield = %1 ###", acd_SZ_Molos_Airfield];
};
diag_log format ["### ACD: SAFE ZONE: LOADING: acd_SZ_Molos_Airfield_props ###"];
/*
#########################################################################################################################################
*/
if (acd_SZ_Molos_Airfield_IS_SAFE) then {
/*
	SZ Marker
*/
acd_SZ_Molos_Airfield_marker = createMarker ["ExileTraderZone",[26871.188,24655.52,22.041519]];
"ExileTraderZone" setMarkerShape "ELLIPSE";
"ExileTraderZone" setMarkerSize [175,175];
"ExileTraderZone" setMarkerBrush "SolidBorder";
"ExileTraderZone" setMarkerColor "ColorGreen";
"ExileTraderZone" setMarkerAlpha 1;
"ExileTraderZone" setMarkerText "Mafia Trader City";
/*
	SZ Sensor
*/
acd_SZ_Molos_Airfield_sensor = createTrigger ["EmptyDetector",[26868.369,24654.316,22.056463]];
acd_SZ_Molos_Airfield_sensor setTriggerArea [175,175,0,true];
acd_SZ_Molos_Airfield_sensor setTriggerStatements ["(vehicle player) in thisList","call ExileClient_object_player_event_onEnterSafezone","call ExileClient_object_player_event_onLeaveSafezone"];
acd_SZ_Molos_Airfield_sensor setTriggerActivation ["ANY","PRESENT",true];

} else {
/*
	Trading Outpost Marker
*/
acd_SZ_Molos_Airfield_marker = createMarker ["acd_SZ_Molos_Airfield",[23334.6,24188.9,4.0095601]];
"ExileTraderZone" setMarkerShape "ICON";
"ExileTraderZone" setMarkerType "MinefieldAP";
"ExileTraderZone" setMarkerSize [0.60000002,0.60000002];
"ExileTraderZone" setMarkerColor "ColorBlack";
"ExileTraderZone" setMarkerText "Black market";	
};

Mache ich etwas falsch?

Den leider Spawnt der Loot immer noch in der SafeZone :S

Share this post


Link to post
Share on other sites

EDIT:

Das sind ja noch die alten acd Dateien merke ich gerade..

 

Hier die neue Datei, wo die Marker definiert werden:

/*
	ACD_SZ - Exile Safe Zones
	acd_fnc_createMarkers.sqf
	by d4n1ch
	mailto: d.e@acd.su

*/
/*#####################################################################################################################################*/
private["_debug_local","_sz_names_arr","_sz_name"];
if(acd_debug)then{
	_debug_local = true;
}else{
	_debug_local = false;
};
_debug_local = true;
if (!isServer) exitWith {diag_log format ["### ACD: acd_fnc_createMarkers: NOT A SERVER ###"];};
if (!isNil "acd_SZ_enabled_list") then {
diag_log format ["### ACD: Creating Markers ###"];
_sz_names_arr = acd_SZ_enabled_list;
{
	_sz_name = _x;
	_sz_marker_var = format["%1_Marker",_sz_name];
	_isSafe = call compile format["%1_IS_SAFE",_sz_name];
	_pos = call compile format["%1_position",_sz_name];
	if(_debug_local)then{diag_log format ["### ACD: acd_fnc_createMarkers: _sz_name = %1, _isSafe = %2, _pos = %3 ###", _sz_name,_isSafe,_pos];};
	if(_isSafe)then{
		/*
			SZ Marker
		*/
		_sz_marker_name = format["Trader_City_%1_Marker",_sz_name];
		_sz_trigger_name = format["_%1_Trigger",_sz_name];
		
		_sz_marker_var = createMarker [_sz_marker_name,_pos];
		_sz_marker_name setMarkerShape "ELLIPSE";
		_sz_marker_name setMarkerSize [175,175];
		_sz_marker_name setMarkerBrush "SolidBorder";
		_sz_marker_name setMarkerColor "ColorGreen";
		_sz_marker_name setMarkerAlpha 1;
		_sz_marker_name setMarkerText "Trader City";
		
	} else {
		/*
			Trading Outpost Marker
		*/
		_sz_marker_name = format["ExileTraderZone",_sz_name];
		
		_sz_marker_var = createMarker [_sz_marker_name,_pos];
		_sz_marker_name setMarkerShape "ICON";
		_sz_marker_name setMarkerType "MinefieldAP";
		_sz_marker_name setMarkerSize [0.60000002,0.60000002];
		_sz_marker_name setMarkerColor "ColorBlack";
		_sz_marker_name setMarkerText "Black market";	
	};
	
	
}forEach _sz_names_arr;

diag_log format ["### ACD: Markers created ###"];
}else{
	diag_log format ["### ACD: acd_fnc_createMarkers: acd_SZ_enabled_list isNil ###"];
};
/*#####################################################################################################################################*/

Wo muß ich jetzt da was ändern? :S

Share this post


Link to post
Share on other sites

Du hast einen Syntax fehler wunder mich das es überhaupt läuft^^

Der eingefügte Block ist eine Zeile zu hoch damit wir die _flags if schleife nicht beendet.
So sollte es gehen:

if!(_flags isEqualTo [])then
		{
			{
				_flag = _x;
				_flagRadius = _flag getVariable ["ExileTerritorySize",0];
				if((_building distance _flag) < _flagRadius)then
				{
					throw false;
				}; 
			} 
			forEach _flags;
};
{
    _markerName = _x;
    if (getMarkerType _markerName == "ExileTraderZone") then
    {
            _markerCenterPosition = getMarkerPos _markerName;
            if((_building distance _markerCenterPosition) < 150)then
            {
                    throw false;
            };
    };
}
forEach allMapMarkers;

 

 

2 people like this

Share this post


Link to post
Share on other sites

Danke, funktioniert super.

Was muss ich ändern damit es auch im Flagbereich funktioniert?

Edited by Scorpi

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.