Moinsen, Bitte trotzdem bedenken immer ein Backup machen! Auch wenn nichts schiefgehen sollte...
heute wollte ich nochmal einheitlich erklären wie ihr das machen könnt das ihr ebenfall wie man es bei dem hier sehen kann:
class copper_unrefined
{
amount = 2;
zones[] = { "copper_mine" };
item = "pickaxe";
mined[] = { {"copper_unrefined",0,25},{"iron_unrefined",25,95},{"diamond_uncut",95,100} };
};
sieht man dort mined[] = // Das wurde so gemacht das man wie man bei
sehen kann hat man hier 25% auf nicht verarbeitetes Kupfer.
So sehen wir uns das ganz oben bei den Pfirsichen an gibt es keine Möglichkeit Prozente einzufügen.
Dies ändern wir indem ihr eure fn_gather.sqf mit dieser hier ersetzt:
#include "..\..\script_macros.hpp"
/*
File: fn_gather.sqf
Author: Devilfloh
Editor: Dardo
Editor for Percentage: Marius1773
Description:
fn_gather hat hoffentlich nun die Eigenschaft mit Prozenten auch zu handeln
*/
private ["_maxGather", "_resource", "_amount", "_requiredItem", "_gathered"];
if (life_action_inUse) exitWith {};
if !(isNull objectParent player) exitWith {};
if (player getVariable "restrained") exitWith {
hint localize "STR_NOTF_isrestrained";
};
_exit = false;
if (player getVariable "playerSurrender") exitWith {
hint localize "STR_NOTF_surrender";
};
life_action_inUse = true;
_zone = "";
_requiredItem = "";
_resourceCfg = missionConfigFile >> "CfgGather" >> "Resources";
_percent = (floor random 100) + 1; //Make sure it's not 0
for "_i" from 0 to count(_resourceCfg)-1 do {
_curConfig = _resourceCfg select _i;
_resources = getArray(_curConfig >> "gathered");
_maxGather = getNumber(_curConfig >> "amount");
_zoneSize = getNumber(_curConfig >> "zoneSize");
_resourceZones = getArray(_curConfig >> "zones");
_requiredItem = getText(_curConfig >> "item");
_gathered = "";
if (_resources isEqualTo []) exitWith {}; //Smart guy :O
for "_i" from 0 to count (_resources) do {
if (count _resources isEqualTo 1) exitWith {
if (!((_resources select 0) isEqualType [])) then {
_gathered = _resources select 0;
} else {
_gathered = (_resources select 0) select 0;
};
};
_resource = (_resources select _i) select 0;
_prob = (_resources select _i) select 1;
_probdiff = (_resources select _i) select 2;
if ((_percent >= _prob) && (_percent <= _probdiff)) exitWith {
_gathered = _resource;
};
};
{
if ((player distance(getMarkerPos _x)) < _zoneSize) exitWith {
_zone = _x;
};
} forEach _resourceZones;
if (_zone != "") exitWith {};
};
if (_zone isEqualTo "") exitWith {
life_action_inUse = false;
};
if (_requiredItem != "") then {
_valItem = missionNamespace getVariable "life_inv_" + _requiredItem;
if (_valItem < 1) exitWith {
switch (_requiredItem) do {
};
life_action_inUse = false;
_exit = true;
};
};
if (_exit) exitWith {
life_action_inUse = false;
};
_amount = round(random(_maxGather)) + 1;
_diff = [_gathered, _amount, life_carryWeight, life_maxWeight] call life_fnc_calWeightDiff;
if (_diff isEqualTo 0) exitWith {
hint localize "STR_NOTF_InvFull";
life_action_inUse = false;
};
switch (_requiredItem) do {
case "pickaxe": {[player,"mining",35,1] remoteExecCall ["life_fnc_say3D",RCLIENT]};
default {[player,"harvest",35,1] remoteExecCall ["life_fnc_say3D",RCLIENT]};
};
for "_i" from 0 to 4 do {
player playMoveNow "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
waitUntil {
animationState player != "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
};
sleep 0.5;
};
if (([true, _gathered, _diff] call life_fnc_handleInv)) then {
_itemName = M_CONFIG(getText, "VirtualItems", _gathered, "displayName");
titleText[format [localize "STR_NOTF_Mine_Success", (localize _itemName), _diff], "PLAIN"];
};
sleep 2.5;
life_action_inUse = false;
Alles anzeigen
und in der Config_Gather.hpp müsst ihr bei jeder Ressource gathered[] = hinzufügen also müsste es so aussehen
class CfgGather {
class Resources {
class apple {
amount = 2;
zones[] = { "apple_1", "apple_2", "apple_3", "apple_4" };
item = "";
gathered[] = {"apple"};
zoneSize = 30;
};
class peach {
amount = 5;
zones[] = { "peaches_1", "peaches_2", "peaches_3", "peaches_4" };
item = "";
gathered[] = {"peach"};
zoneSize = 30;
};
class heroin_unprocessed {
amount = 3;
zones[] = { "heroin_1" };
item = "";
gathered[] = {"heroin_unprocessed"};
zoneSize = 30;
};
class cocaine_unprocessed {
amount = 3;
zones[] = { "cocaine_1" };
item = "";
gathered[] = {"cocaine_unprocessed"};
zoneSize = 30;
};
class cannabis {
amount = 3;
zones[] = { "weed_1" };
item = "";
gathered[] = { {"cannabis",0,10},{"Wunschprodukt",10,100} }; //Cannabis 90% und Wunschprodukt hat 10%
zoneSize = 30;
};
};
Alles anzeigen
Ich hoffe es hat alles soweit geklappt und es ist verständlich genug.
Mit freundlichen Grüßen
Marius1773