English Backup all virtual items without configuration

  • Auteur de la discussion Auteur de la discussion I'm the Boss
  • Date de début Date de début

I'm the Boss

Admin
2/1/20
657
3
43
1 100
Hello,

Are you tired of editing your config_master.hpp every time you create an item?
Do you want all your items without exception in player inventories to be saved in a database?

Do as I do, choose the facility.

1 - Go to the root of your mission.
2 - Rendez-vous dans \config\Config_Master.hpp.
3 - Delete this line :
Code:
Développer Réduire Copier
    saved_virtualItems[] = { "pickaxe","fuelEmpty","fuelFull", "spikeStrip", "lockpick", "defuseKit","storageSmall","storageBig","redgull","coffee","waterBottle","apple","peach","tbacon","donuts","rabbit","salema","ornate","mackerel","tuna","mullet","catshark","turtle_soup","hen","rooster","sheep","goat","defibrillator","toolkit" }; //Array of virtual items that can be saved on your player.

4 - See you in /core/functions/fn_saveGear.sqf.
5 - Replace this line :
Code:
Développer Réduire Copier
private ["_return","_uItems","_bItems","_vItems","_pItems","_hItems","_yItems","_uMags","_vMags","_bMags","_pMag","_hMag","_uni","_ves","_bag","_handled","_savedVirtualItems"];
by this one
Code:
Développer Réduire Copier
private ["_return","_uItems","_bItems","_vItems","_pItems","_hItems","_yItems","_uMags","_vMags","_bMags","_pMag","_hMag","_uni","_ves","_bag","_handled"];

6 - Delete this line :
Code:
Développer Réduire Copier
_savedVirtualItems = LIFE_SETTINGS(getArray,"saved_virtualItems");

7 - Replace this code block :
Code:
Développer Réduire Copier
{
    _val = ITEM_VALUE(_x);
    if (_val > 0) then {
        _yItems pushBack [_x,_val];
    };
} forEach _savedVirtualItems;
by this one :
Code:
Développer Réduire Copier
{
    _val = ITEM_VALUE(configName _x);
    if (_val > 0) then {
		_var = getText (_x >> 'variable');
        _yItems pushBack [_var,_val];
    };
} forEach ("true" configClasses (missionConfigFile >> "VirtualItems"));


That's all. That's all. Easy, huh?
 
In your fn_saveGear.sqf you can edit the condition :
Code:
Développer Réduire Copier
if (_val > 0) then {
for example :
Code:
Développer Réduire Copier
if ((_val > 0) && !((configName _x) in ["item_class_blacklisted_1", "item_class_blacklisted_2"])) then {

Replace item_class_blacklisted_1 by the class of the items (find that in your Config_vItems.hpp) that will not be saved
 
Activité
Pour l'instant, il n'y a personne ici