Hi Zusammen ich sitze Bereits seit 2 Wochen am Einrichten unseres Marktsystems allerdings Fällt beim verkauf der Preis Dauernd auf 0 Obwohl eine Mingrenze eingestellt ist
Ein Auszug aus der core/market/fn_marketconfiguration.sqf
Code
/*
Main configuration for non-persistent market system
Will need triggers to hook into vanilla pricing methods
*/
//Schema: SHORTNAME, Default, Min, Max, changes in action, [Sales multiplied by 1, Purchase multiplied by -1]
//["gold", 1500, 450, 2300, 8, 5],
////////////MAIN CONFIG
life_market_resources = [
// Default İsler
["oil_processed", 400, 275, 650, 1, 2,
[
["diamond_cut",1],
["iron_refined",1],
["copper_refined",1],
["gold_refined",1],
["cement",1],
["glass",1]
]
],
["diamond_cut", 750, 345, 1000, 1, 2,
[
["oil_processed",1],
["iron_refined",1],
["copper_refined",1],
["gold_refined",1],
["salt_refined",1],
["cement",1],
["glass",1]
]
],
["copper_refined", 350, 155, 550, 1, 1,
[
["diamond_cut",1],
["oil_processed",1],
["iron_refined",1],
["gold_refined",1],
["cement",1],
["glass",1]
]
],
["iron_refined", 450, 175, 650, 1, 1,
[
["diamond_cut",1],
["oil_processed",1],
["copper_refined",1],
["gold_refined",1],
["salt_refined",1],
["cement",1],
["glass",1]
]
],
["salt_refined", 200, 100, 350, 1, 1,
[
["copper_refined",1],
["gold_refined",1],
["glass",1]
]
],
["glass", 300, 190, 500, 1, 1,
[
["diamond_cut",1],
["oil_processed",1],
["iron_refined",1],
["copper_refined",1]
]
],
["cement", 380, 180, 480, 1, 1,
[
["oil_processed",1],
["iron_refined",1],
["copper_refined",1],
["glass",1]
]
],
["goldbar", 1, 0, 2, 2, 1,
[
["diamond_cut",1],
["oil_processed",1],
["iron_refined",1],
["copper_refined",1],
["glass",1]
]
],
["marijuana", 500, 250, 850, 3, 5,
[
["cocaine_processed",1],
["heroin_processed",1]
]
],
["cocaine_processed", 650, 390, 950, 3, 5,
[
["marijuana",1],
["heroin_processed",1]
]
],
["heroin_processed", 850, 420, 1000, 3, 5,
[
["marijuana",1],
["cocaine_processed",1]
]
]
];
publicVariable "life_market_resources";
////////////GENERATED CONFIG
//life_market_changes = []; //[SHORTNAME,SELL,BUY]
life_market_shortnames = []; //shortnames if in market
//life_market_clampprices = []; //[SHORTNAME,MIN,MAX]
{
life_market_shortnames set [count life_market_shortnames, _x select 0];
//life_market_clampprices set [count life_market_clampprices, [_x select 0, _x select 2, _x select 3] ];
//life_market_changes set [count life_market_changes, [_x select 0, _x select 4, _x select 5] ];
}
foreach life_market_resources;
publicVariable "life_market_shortnames";
//publicVariable "life_market_clampprices";
////////////SYNC PRICES WITH SERVER IF EMPTY
//if(isNil("life_market_prices")) then
//{
life_market_prices = []; //[SHORTNAME,CURRENTPRICE,DIRECTIONGLOBAL,DIRECTIONLOCAL]
{
life_market_prices set [count life_market_prices, [_x select 0, _x select 1, 0, 0] ];
}
foreach life_market_resources;
publicVariable "life_market_prices";
systemChat "Market Prices Generated!";
//};
Alles anzeigen
Und hier aus der core/market/fn_marketChange.sqf
Hier habe ich Allerdings nichts Geändert da ich da nicht durchblicke
Code
#include "..\..\script_macros.hpp"
/*
Some random and dynamical stuff for market
*/
private["_rand","_modifier","_price", "_globalchange","_defaultprice","_shortname","_difference"];
_rand = [0,200] call life_fnc_randomRound; //0-200
/*
HINWEIS: obige Zahl in random erhöhen, um alle ereignisse seltener zu machen!
*/
diag_log "[MARKET] marketChange called.";
switch(true) do
{
case (_rand <= 30): //30% default market change value (strong version)
{
{
if(random(10) <= 4) then //Random for each resource
{
/*_price = _x select 1;
_globalchange = _x select 2;*/
_modifier = [-20,20] call life_fnc_randomRound; //Verkaufte/Gekaufte Items
/*_modifier = _price * _modifier;
_price = _price + _modifier;
_globalchange = _globalchange + _modifier;
life_market_prices set [_forEachIndex, [_x select 0, _price, _globalchange, _modifier] ];*/
if(_modifier < 0) then
{
[_x select 0, -(_modifier), true] call life_fnc_marketSell;
}
else
{
[_x select 0, _modifier, true] call life_fnc_marketBuy;
};
};
}
foreach life_market_prices;
};
case (_rand <= 36): //6% Drogenpreis erhöhen
{
[0,format["News: drugs prices increased."]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
//Erhöhe Marktpreis mit marketSell
["marijuana", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["cocaine_unprocessed", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["cocaine_processed", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["heroin_unprocessed", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["heroin_processed", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
diag_log "+Market+ Event drugp";
};
case (_rand <= 44): //8% Ölpreis erhöhen
{
[0,format["News: oil processed price increased."]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
["oil_processed", [20,40] call life_fnc_randomRound, true] call life_fnc_marketBuy;
diag_log "+Market+ Event oilp";
};
case (_rand <= 54): //10% Eisenpreis + zementpreis + glaspreis erhöhen
{
[0,format["News: cement-ironrefined-glass prices increased."]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
["cement", [20,40] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["iron_refined", [20,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["glass", [25,35] call life_fnc_randomRound, true] call life_fnc_marketBuy;
diag_log "+Market+ Event wcc";
};
case (_rand <= 60): //4% Goldpreis sinkt
{
[0,format["News: goldbar price decreased."]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
["goldbar", [15,30] call life_fnc_randomRound, true] call life_fnc_marketSell;
diag_log "+Market+ Event goldm";
};
case (_rand <= 68): //8% Kupfer/Silber erhöht sich
{
[0,format["News: goldbar - copper refined prices increased."]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
["goldbar", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["copper_refined", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
diag_log "+Market+ Event copperp";
};
case (_rand <= 74): //6% Goldpreis erhöht sich
{
[0,format["News: goldbar price increased."]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
["goldbar", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
diag_log "+Market+ Event goldp";
};
case (_rand <= 80): //6% Drogenpreis niedriger
{
[0,format["News: drugs prices decreased"]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
//Erhöhe Marktpreis mit marketSell
["marijuana", [15,30] call life_fnc_randomRound, true] call life_fnc_marketSell;
["cocaine_unprocessed", [15,30] call life_fnc_randomRound, true] call life_fnc_marketSell;
["cocaine_processed", [15,30] call life_fnc_randomRound, true] call life_fnc_marketSell;
["heroin_unprocessed", [15,30] call life_fnc_randomRound, true] call life_fnc_marketSell;
["heroin_processed", [15,30] call life_fnc_randomRound, true] call life_fnc_marketSell;
diag_log "+Market+ Event drugm";
};
case (_rand <= 90): //10% Schildkröten höher
{
[0,format["News: example items prices increased"]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
//Erhöhe Marktpreis mit marketSell
["exampleitem", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["exampleitem", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["exampleitem", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
["exampleitem", [15,30] call life_fnc_randomRound, true] call life_fnc_marketBuy;
diag_log "+Market+ Event exampleitem";
};
default //market change: default version
{
//diag_log format["[MARKET] marketChange did nothing. Rand=%1", _rand];
{
//Get default price
_defaultprice = 0;
_shortname = _x select 0;
_price = _x select 1;
_globalchange = _x select 2;
{
if((_x select 0) == _shortname) exitWith
{
_defaultprice = _x select 1;
};
}
foreach life_market_resources;
if(_defaultprice > 0) then
{
//Get difference
_difference = _defaultprice - _price; //Defaultprice - current price
_modifier = _difference * (random 0.4);
_modifier = round _modifier;
//Protecting hard caps
/*if( _modifier < -700) then {_modifier = -700;};
if( _modifier > 700) then {_modifier = 700;};*/
//_modifier = [-15,25] call life_fnc_randomRound; //Verkaufte/Gekaufte Items
/*if(_modifier < 0) then
{
[_x select 0, -(_modifier), true] call life_fnc_marketSell;
}
else
{
[_x select 0, _modifier, true] call life_fnc_marketBuy;
};*/
diag_log format["+Market+ Correcting market value of %1 from %2 to %3 by %4", _shortname, _price, (_price + _modifier), _modifier];
_price = _price + _modifier;
_globalchange = _globalchange + _modifier;
//New price arr
life_market_prices set [_forEachIndex, [_shortname, _price,_globalchange,_modifier] ]; //set raw values
}
else
{
diag_log format["+Market+ Cannot correct market value of %1", _shortname];
};
}
foreach life_market_prices;
};
};
publicVariable "life_market_prices";
Alles anzeigen
Wenn sich jemand mit dem Script auskennt wäre wirklich Bombe