Jump to content

[RELEASE] TradeFromVehicle - Version 2.0 is here!


Csus

Recommended Posts

 

As far as I understand it, you need one list entry per trader, you cannot use an array of traders.

Nevertheless you can define variables to hold a list of tradeable items and reference to them, thus avoiding multiple identical entries. Look at my example in post #160:

 

Expanding on this you can even define several disjunct arrays, e.g. ListSniper, ListAssault, ... and then combine them, the syntax should be something like

tfv_TRADERS_ITEMS = [
["RU_Citizen4", ListSniper, ["weapons","magazines"],0],
["RU_Citizen1", [ListSniper, ListAssault], ["weapons","magazines"],0]
];

 

Thanks got it working, and saves alot of time, thanks!

Link to comment
Share on other sites

 

As far as I understand it, you need one list entry per trader, you cannot use an array of traders.

Nevertheless you can define variables to hold a list of tradeable items and reference to them, thus avoiding multiple identical entries. Look at my example in post #160:

 

Expanding on this you can even define several disjunct arrays, e.g. ListSniper, ListAssault, ... and then combine them, the syntax should be something like

tfv_TRADERS_ITEMS = [
["RU_Citizen4", ListSniper, ["weapons","magazines"],0],
["RU_Citizen1", [ListSniper, ListAssault], ["weapons","magazines"],0]
];

@ekroemer could you please help me (and others) is this correct? i have made it simple.

 

I only added the tfv_ALL_ITEMS, nothing else changed.

 

Ive got the sell weapons/items from the trader, and the cycles workes as allways, but i dont get paid. my guess is that the tfv_ALL_ITEMS cant "see" the price for each weapon/item.

 

If you got it working, are you willing to share, just a simple part of, your init.sqf (TradeFromVehicle)?

 

tfv_TRADERS_ITEMS = [
["RU_Profiteer3", tfv_ALL_ITEMS, ["weapons","magazines"],0],
["Soldier_GL_PMC", tfv_ALL_ITEMS, ["weapons","magazines"],0]
]; if (tfv_DEBUGGING) then { diag_log "tfv - Traders and their weapons loaded in!"; };
 
tfv_ALL_ITEMS = [
"glock17_EP1",
"M9",
"M9SD",
"Makarov",
"MakarovSD",
"revolver_EP1",
"revolver_gold_EP1"];
 
tfv_TRADERS_PRICES = [
["glock17_EP1",50],
["M9",20],
["M9SD",100],
["Makarov",10],
["MakarovSD",100],
["revolver_EP1",10],
["revolver_gold_EP1",200]
]; if (tfv_DEBUGGING) then { { diag_log format ["tfv - Price loaded - %1",_x]; } forEach tfv_TRADERS_PRICES; };
Link to comment
Share on other sites

Is that above a snippet from your config file?

You should define tfv_ALL_ITEMS before using it in tfv_TRADERS_ITEMS, otherwise it looks fine at first glance.

Tanks for the fast reply.

I have very little experience in coding. So my guess was that:

tfv_ALL_ITEMS = [

"glock17_EP1",

"M9",

"M9SD",

"Makarov",

"MakarovSD",

"revolver_EP1",

"revolver_gold_EP1"];

Was a definition of a variable called tfv_ALL_ITEMS

How do i define a variable then ?

Link to comment
Share on other sites

Yes, that is the definition, but you used it, before it was defined, you have to switch definition and reference to it. That would make your code look like

tfv_ALL_ITEMS = [
"glock17_EP1",
"M9",
"M9SD",
"Makarov",
"MakarovSD",
"revolver_EP1",
"revolver_gold_EP1"];
 
tfv_TRADERS_ITEMS = [
["RU_Profiteer3", tfv_ALL_ITEMS, ["weapons","magazines"],0],
["Soldier_GL_PMC", tfv_ALL_ITEMS, ["weapons","magazines"],0]
]; if (tfv_DEBUGGING) then { diag_log "tfv - Traders and their weapons loaded in!"; };

tfv_TRADERS_PRICES = [
["glock17_EP1",50],
["M9",20],
["M9SD",100],
["Makarov",10],
["MakarovSD",100],
["revolver_EP1",10],
["revolver_gold_EP1",200]
]; if (tfv_DEBUGGING) then { { diag_log format ["tfv - Price loaded - %1",_x]; } forEach tfv_TRADERS_PRICES; };

Link to comment
Share on other sites

We are not getting paid, any idea? I got the above working, and the traders work like allways, but no gold/silver in return

Check your weapons prices in the regular trader menu. I had this issue a couple times when selling out of the vehicle. I'm 99.99% sure it was because one of the weapons defined in the sell from vehicle script had a pricing problem in the DB of the main trade menu. IE: There was no buy or sell price for said weapon on trader menu, a typo in the database on my part. It said this in the main trader menu: "Buy for 6 Sell for 4". Notice it doesn't say gold or silver or briefcase or anything.  Once I fixed that error in my DB, I did not get that issue anymore

Link to comment
Share on other sites

Yes, that is the definition, but you used it, before it was defined, you have to switch definition and reference to it. That would make your code look like

tfv_ALL_ITEMS = [
"glock17_EP1",
"M9",
"M9SD",
"Makarov",
"MakarovSD",
"revolver_EP1",
"revolver_gold_EP1"];
 
tfv_TRADERS_ITEMS = [
["RU_Profiteer3", tfv_ALL_ITEMS, ["weapons","magazines"],0],
["Soldier_GL_PMC", tfv_ALL_ITEMS, ["weapons","magazines"],0]
]; if (tfv_DEBUGGING) then { diag_log "tfv - Traders and their weapons loaded in!"; };

tfv_TRADERS_PRICES = [
["glock17_EP1",50],
["M9",20],
["M9SD",100],
["Makarov",10],
["MakarovSD",100],
["revolver_EP1",10],
["revolver_gold_EP1",200]
]; if (tfv_DEBUGGING) then { { diag_log format ["tfv - Price loaded - %1",_x]; } forEach tfv_TRADERS_PRICES; };

 

Thanks a lot :-) workes now, just as intended...

 

I really like this forum :-)

Link to comment
Share on other sites

Hi there Csus, I read a few pages back that you wouldn't mind if someone added in backpack functionality and some other people have been requesting it so I went ahead with adding it and I'll put it up on github shortly I hope you don't mind, you did a good job on the original scripts I didn't see any reason to start fresh :)

 

https://github.com/SJossy/Tfvb (Trade from Vehicles and Backpacks)

 

Feel free to check it if you want and make any commits, even if anyone else wants to make changes so it reads from database that would be nice

 

Edit> backpack simulation false wasn't working as intended so I've reverted back to checking counts each cycle.

Hi, I've Been using this trade from vehicle for a while now, and totally love it! Getting all the overpoch weapons and items added in to all the traders was and still is a major pain and is still an ongoing work in progress almost a month later :) Got most of the stuff added, but there's still a few that don't sell yet.

Anyways, tried adding the updated backpack version last night and it didn't work. I get no trade from vehicle or backpack options. The only file I didn't overwrite was the init. I just edited the new one with my traders, weapons and prices. Still has all the backpack stuff at the bottom and backpack switch at the top. Other than that it's a fresh install. Any idea why it wouldn't work?

I can load in my old init and it works fine, add the new one and it doesn't work. I made sure that what I added was correct, all brackets where they need to be etc.. 

Link to comment
Share on other sites

Hi, I've Been using this trade from vehicle for a while now, and totally love it! Getting all the overpoch weapons and items added in to all the traders was and still is a major pain and is still an ongoing work in progress almost a month later :) Got most of the stuff added, but there's still a few that don't sell yet.

Anyways, tried adding the updated backpack version last night and it didn't work. Got not trade from vehicle or backpack options. The only file I didn't overwrite was the init. I edited the new one with my traders, weapons and prices. Other than that it's a fresh install. Any idea why it wouldn't work?

Does that mean you're using the init file from my version? Because you need to, if all you did was put your weapons and trader list into that one then I don't have much idea why else it wouldn't work without seeing the code

Link to comment
Share on other sites

i mean, do you have to add all weapon names to a different file to get this working ? 

No it all runs off the same code, the init has an extra block of code down the bottom which starts the backpack monitor and a backpack=true option up the top, if you want me to check over your code I'm more than happy to

Link to comment
Share on other sites

Hi there,

Map : "Chenarus"

 

I had this working with the default items - and with the trader to "Profiteer4". ( Klen Vehicle Dealer ) as you can see in the paste.

 

So I added more items.  However now - I cannot get the trader menu to appear.

I added in some server echoes to see where it was getting stuck

 

http://pastebin.com/02CXWr00

 

You will notice that I added a comma at the end of line 30.

With this - the "Echo 8" message shows up on the server.

Without the comma - I only get up to "Echo 7".

 

I am not certain where the fault lies or why I cannot get it to load correctly.   Would too many items be causing this?  I do not think so, but need a better coder to review.  

Any help is appreciated.

 

For those interested in how I got the items listed as such; I used this customized query. 

 

select concat(SPLIT_STR(item,',',1), ',', cast(
case SPLIT_STR(sell,',',2)
    when '\"ItemGoldBar10oz\"' then 
    (replace(SPLIT_STR(sell,',',1),'[','')*1000)
    when '\"ItemGoldBar\"' then
    (replace(SPLIT_STR(sell,',',1),'[','')*100)
    when '\"ItemSilverBar10oz\"' then
    (replace(SPLIT_STR(sell,',',1),'[','')*10)
    when '\"ItemSilverBar\"' then
    (replace(SPLIT_STR(sell,',',1),'[',''))
    end  as CHAR) ,'],') as list
    FROM traders_data where afile in ('trade_weapons','trade_items')
    group by item
order by list
 
 
Link to comment
Share on other sites

Does that mean you're using the init file from my version? Because you need to, if all you did was put your weapons and trader list into that one then I don't have much idea why else it wouldn't work without seeing the code

I used your init but copied & pasted the  guns and prices from my old init to it. 

Link to comment
Share on other sites

My Init for the mod

http://pastebin.com/GBs78mKL

 

My server init.

http://pastebin.com/G6hbXSdG

 

Still cannot get the trader's menu to appear for this option.

 

Thank you for the suggestions above.  I have corrected the previous mistakes as seen in the pastebin's.

 

Did you try removing those systemchat commands? They should not be there, I probably should of mentioned that lol If you have and still haven't got it working I will happily fix it locally and send it back to you

Link to comment
Share on other sites

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
  • Advertisement
×
×
  • Create New...