poly Posted December 15, 2022 Share Posted December 15, 2022 I'd like to know if this is possible, Within traders.xml there is this line: <trader_info id="5" reset_interval="-1" override_buy_markup="1.0" override_sell_markup="1.0" allow_sell="false" rentable="true" rent_cost="2500" rent_time="30"/> The options 'rent_cost' and 'rent_time' would suggest that these settings are changeable, but if I change rent_time from 30 days to any other value, for example 7 days, the change is only superficial. The expiry date still assumes 30 days, and by skipping passed the amended 7 days date this confirms that nothing has changed - the vending machine is still rented by the player. However, if I change the cost from 2500 to 500 for example, this works. I am only charged 500 dukes. If the value for rented days anywhere else in the xml other than traders.xml? Many Thanks Link to comment Share on other sites More sharing options...
BFT2020 Posted December 15, 2022 Share Posted December 15, 2022 They may have been variables in the past, but they might have been hardcoded in recently. From your explanation on what you are seeing, that seems likely (which means c# code changes or maybe something was done accidently by the devs and not realized). I don't see the values anywhere else. To verify, did you leave the chunk area when you skipped days? Also, did you make the changes before you rented the vending machine or after? What I would typically do for a change like this is make the change, then start a new game up. This might not change anything, but I always want a clean slate when I make changes to the traders. Link to comment Share on other sites More sharing options...
poly Posted December 15, 2022 Author Share Posted December 15, 2022 Thanks for reply Yes I always create a new world when playing around with block editing. I didn't leave the chunk area however so I will try that... perhaps that has an effect. For clarity, I didn't amend the trader vending machines, I created a duplicate block with the same properties and placed it in the world to test. Works fine except for the time, so maybe it is hardcoded after all. Link to comment Share on other sites More sharing options...
khzmusik Posted December 16, 2022 Share Posted December 16, 2022 (edited) 4 hours ago, poly said: Thanks for reply Yes I always create a new world when playing around with block editing. I didn't leave the chunk area however so I will try that... perhaps that has an effect. For clarity, I didn't amend the trader vending machines, I created a duplicate block with the same properties and placed it in the world to test. Works fine except for the time, so maybe it is hardcoded after all. It is hard-coded, unfortunately. I just looked in the decompiled C# code. The XML value is read and stored in a C# object's field, but as far as I can tell, that field isn't actually read anywhere, other than the code that displays it in the UI. I confirmed it by looking in the C# code for the vending machines. When you rent it, it is indeed hard-coded to add 30 days to the current game day. My guess is that TFP intended to support that feature but never got around to it. I don't know how many players use rented vending machines, so it might not be a priority for them. If you want, you could probably file a bug report for this. The code to fix it shouldn't be too difficult to add, so hopefully they will have time to put it into the next alpha, if it isn't already fixed. EDIT: If you want to do a Harmony patch, the method to patch is TileEntityVendingMachine.Rent . Basically check to see if that method returned true (meaning renting was successful). If it was, get the "real" value from TraderInfo.traderInfoList[this.traderID].RentTimeInDays, subtract 30 from that, and that's the number to add to the end day. You'll need to add that to both the vending machine's rentalEndDay field and the primary player's RentalEndDay property. Edited December 16, 2022 by khzmusik (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now