jaxx0rr

Sell Crates at Wastedump [R3F required]

18 posts in this topic

Ok so I made a little something.. it will not sell the crate from within the vehicle but it will sell its contents when you place it next to the trader. Then you can just grab the money out of it..

like so

 

Only downside is.. the crate will stay there.. it is kinda realistic I guess.. I could make it dissapear after a minute..

Instructions

First you need to have R3F installed and working

Then make sure you have the DMS crate (or any other crate) setup in R3F_LOG\config.sqf under

R3F_LOG_CFG_can_be_moved_by_player = R3F_LOG_CFG_can_be_moved_by_player + [
	"I_CargoNet_01_ammo_F",

and optionally under

R3F_LOG_CFG_can_be_transported_cargo = R3F_LOG_CFG_can_be_transported_cargo + [
	["I_CargoNet_01_ammo_F", 100]

then open up R3F_LOG\objet_deplacable\relacher.sqf and after

R3F_LOG_mutex_local_verrou = true;

put this in
 

	private _foundTrader = false;
	{
		_foundTrader = true;
	} forEach nearestObjects [player, ["Exile_Trader_WasteDump"], 12];

	if (_foundTrader) then {
	
		private _crate = R3F_LOG_joueur_deplace_objet;
		private _cargo = _crate call ExileClient_util_containerCargo_list;	
		private _revenue = _cargo call ExileClient_util_gear_calculateTotalSellPrice;
		hint format ["Cargo was sold for %1 Poptabs. You can pick them up from the crate.", _revenue];
		//str(_revenue);
		
		clearWeaponCargoGlobal 		_crate;
		clearItemCargoGlobal 		_crate;
		clearMagazineCargoGlobal 	_crate;
		clearBackpackCargoGlobal 	_crate;
		
		private _cash = _crate getVariable ["ExileMoney", 0];
	
		_crate setVariable ["ExileMoney",_revenue+_cash, true];
	};

thats it.

EDIT: updated script so you wont lose the money inside the crate if you take the crate a second time and place it down.

 

 

Edited by jaxx0rr
Updated script
  • Like 2

Share this post


Link to post
Share on other sites
Advertisement

Thanks for this. Do you think you can add something in that creates a dialog with the Waste Dump Trader? People use safe zones as a means to go through crates before selling the items they don't want so I can see players dropping the crate too close to the trader and bam, it is all gone. A menu addition to the trader that sees you have a crate on the ground would be a welcome addition so players can sell the crate when they are ready. <-- take this as a suggestion, not criticism. 

Otherwise, thanks for you contribution to the community. 

Share this post


Link to post
Share on other sites

Hi, thanks for this script.  

When I set the crate down I get:

"Cargo was sold for 0 Poptabs. You can pick them up from the crate."  And, as indicated, there are no tabs and the loot is still in the crate.  I've tried with a couple of different crates that I've confirmed are in both categories.  I have Igiload installed, but I'm only interacting withR3F while trying to make this work.  Any ideas?

T

Share this post


Link to post
Share on other sites
On 4/14/2017 at 11:37 AM, Lenzh | 11thAMB said:

not working

what makes you come to that conclusion?

i came across this script last night a hour before your post and added it to my server works great so i made some tweaks like displaying a toast instead of a hint and deleting the crate after 2 minutes...

here is my tweaked code if anyone wants it 
R3F_LOG\objet_deplacable\relacher.sqf

 

/**
 * Passe la variable R3F_LOG_joueur_deplace_objet à objNull pour informer le script "deplacer" d'arrêter de déplacer l'objet
 */
 
private _foundTrader = false;

if (R3F_LOG_mutex_local_verrou) then
{
    hintC STR_R3F_LOG_mutex_action_en_cours;
}
else
{
    R3F_LOG_mutex_local_verrou = true;
    
    {
        _foundTrader = true;
    } forEach nearestObjects [player, ["Exile_Trader_WasteDump"], 12];

    if (_foundTrader) then {
    
        private _crate = R3F_LOG_joueur_deplace_objet;
        private _cargo = _crate call ExileClient_util_containerCargo_list;    
        private _revenue = _cargo call ExileClient_util_gear_calculateTotalSellPrice;
        
        clearWeaponCargoGlobal         _crate;
        clearItemCargoGlobal         _crate;
        clearMagazineCargoGlobal     _crate;
        clearBackpackCargoGlobal     _crate;
        
        private _cash = _crate getVariable ["ExileMoney", 0];
    
        _crate setVariable ["ExileMoney",_revenue+_cash, true];
        
        R3F_LOG_joueur_deplace_objet = objNull;
        sleep 0.25;
    
        R3F_LOG_mutex_local_verrou = false;
        
        ["SuccessTitleAndText", ["Crate Contents Sold", format["Cargo was sold for %1 Poptabs. You can pick them up from the crate. Crate will delete in 2 minutes", _revenue]]] call ExileClient_gui_toaster_addTemplateToast;
        
        sleep 120;
        deleteVehicle _crate;
    
    } else {
    
        R3F_LOG_joueur_deplace_objet = objNull;
        sleep 0.25;
    
        R3F_LOG_mutex_local_verrou = false;
    };
};

Edited by xstreme
  • Like 2

Share this post


Link to post
Share on other sites

Selling crates at the wastedump has been around for a while now. The reason I mention this, is because it seem you all are depending on a timer to remove the crate(s) after the contents are sold. Otherwise you end up with a wall of crates all around the trader. If you look at the following thread, you will see another way to do it. Crates are viewed as vehicles. So, when selling at the wastedump, you can choose to sell cargo or crate and cargo... It's what I use and it works well.

 

Share this post


Link to post
Share on other sites
On 2017-4-15 at 5:56 AM, xstreme said:

what makes you come to that conclusion?

i came across this script last night a hour before your post and added it to my server works great so i made some tweaks like displaying a toast instead of a hint and deleting the crate after 2 minutes...

here is my tweaked code if anyone wants it 
R3F_LOG\objet_deplacable\relacher.sqf

  Reveal hidden contents

/**
 * Passe la variable R3F_LOG_joueur_deplace_objet à objNull pour informer le script "deplacer" d'arrêter de déplacer l'objet
 */
 
private _foundTrader = false;

if (R3F_LOG_mutex_local_verrou) then
{
    hintC STR_R3F_LOG_mutex_action_en_cours;
}
else
{
    R3F_LOG_mutex_local_verrou = true;
    
    {
        _foundTrader = true;
    } forEach nearestObjects [player, ["Exile_Trader_WasteDump"], 12];

    if (_foundTrader) then {
    
        private _crate = R3F_LOG_joueur_deplace_objet;
        private _cargo = _crate call ExileClient_util_containerCargo_list;    
        private _revenue = _cargo call ExileClient_util_gear_calculateTotalSellPrice;
        
        clearWeaponCargoGlobal         _crate;
        clearItemCargoGlobal         _crate;
        clearMagazineCargoGlobal     _crate;
        clearBackpackCargoGlobal     _crate;
        
        private _cash = _crate getVariable ["ExileMoney", 0];
    
        _crate setVariable ["ExileMoney",_revenue+_cash, true];
        
        R3F_LOG_joueur_deplace_objet = objNull;
        sleep 0.25;
    
        R3F_LOG_mutex_local_verrou = false;
        
        ["SuccessTitleAndText", ["Crate Contents Sold", format["Cargo was sold for %1 Poptabs. You can pick them up from the crate. Crate will delete in 2 minutes", _revenue]]] call ExileClient_gui_toaster_addTemplateToast;
        
        sleep 120;
        deleteVehicle _crate;
    
    } else {
    
        R3F_LOG_joueur_deplace_objet = objNull;
        sleep 0.25;
    
        R3F_LOG_mutex_local_verrou = false;
    };
};

Thanks to the OP and to you @xstreme for your edit. Works perfectly apart from this error in the client.rpt for me
 

18:49:40 Error in expression <{
_itemClassName = _x select 0;
};
if !(_itemClassName isEqualTo "") then
{
_lis>
18:49:40   Error position: <_itemClassName isEqualTo "") then
{
_lis>
18:49:40   Error Undefined variable in expression: _itemclassname
18:49:40 File exile_client\code\ExileClient_util_containerCargo_list.sqf, line 39

Happens as you release the crate next to the waste dump trader. Everything still works though, the crate exchanges the items for cash, can take the cash from the crate and it deletes after 2 mins. Just the error....any ideas...?

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.