Updated Wuut's Anomaly Dynamic Economy mod to 1.5.1. See description.
This addon has been updated and re-uploaded with the permission of Wuut. Original addon can be found at this link:
Moddb.com
Disclaimer
- This addon will make your game more difficult. If you dont like that, this addon is NOT for you.
My biggest gripe with the economy of stalker is that it does not make sense. Traders would get always the same amount of the same products. Not even my local supermarket can do that.
This is my attempt to make the economy how it should be in an exclusion zone.
-
Supply
- Regulary trader supply is now gone.
- Traders (also technician and medics) will now only resupply stock after someone sold them artefacts. (a NPC or the player)
- The resupply rate is at 10 percent stock for one artefact with 100 percent as the maximum.
-
Trading
- Trading is less restrictive. Traders will buy all kind of items and NPC's will sell them. Main goal here is to make the traders stock grow more naturally.
- NPC's will perform offline trades, this was not possible before.
-
Offline trades
- Offline trades are necessary because online trading is slow and not every NPC is likely to trade.
- After visiting a location for the first time traders from that location are registered and will perform offline trades with stalkers within a radius.
- As you visit more locations the amount of traders will go up and this will cause some initial lag spikes after each level reload. I am still working on this problem and hope that I can at least even out the workload so it does not hit that hard.
- Update: Offline trades are now processed in batches. Batch size is adjustable via OFFLINE_TRADING_MAX_JOBS parameter.
-
Adjusting parameters(in wuut_economics.script)
- INITIAL_TRADER_STOCK:
- How much stock traders have at game start, 10 = 100 %
- STOCK_PERCENT_PER_ART:
- How much traders restock per artefact sold.
- OFFLINE_TRADING_MAX_JOBS:
- Max number of traders that are processed at once, reduce this if you encounter performance issues.
- RECURRENT_RESTOCK_ENABLED:
- This enables recurrent restock of a trader, disabled by default.
- RECURRENT_RESTOCK_DAYS
- Days until the next restock.
- Note that you have to go to a trader and let him restock normally to set the next cycle.
- RECURRENT_RESTOCK_ARTS:
- Equivalent in artifacts of the restock amount.
-
Other notes
- This addon has been in testing for some days but I did not visit every location yet so expect bugs.
- I was able to survive without selling artefacts so far. So if you like survival this is the way to go.
- A new game start is not necessary but highly recommended so you feel the impact of the addon.
- Testing this addon is very difficult because the effects can only be seen after a long period. Any feedback is invaluable, it will help to balance the addon.
- Change log
- 0.1.0 Initial version
- 0.1.1
- Fixed crash when the game attempts to spawn a non existing section (wpn_l85a)
- Excluded PDA's from trades
- Changed how offline trades work, for details see Adjusting parameters -> OFFLINE_TRADING_MAX_JOBS
- 0.1.2
- Excluded artefacts from resupply lists, this makes addons like TOC safe to use.
- 0.1.3
- Fixed a rare bug that lead to a crash under certain circumstances
- Fixed a rare bug that stopped the script from working
- 0.1.4
- Added support for Tiered progression addon, trader now get coffaine for each artefact.
- Added expiration dates (3 in game days) for outfits, helmets and weapons that have a condition below 75%. This should help keep inventories clean.
- 0.1.5
- Added the requested "restock every x days by y amount" feature. Read above in the "Adjusting parameters" section.
- 0.2.0
- Resolved various issues and script changes to bring this phenomenal addon up-to-date with 1.5.1 - Beef
- 0.2.0.1
- Added Trader Overhaul patch, and an optional version of both default and Trader Overhaul patch that keeps vanilla Trader Restrictions on what they buy / sell. The downside is that selling artifacts to many traders won't happen, so they won't restock unless you enable the recurrent restock.
Yea it's working really well, awesome job mate.
I'm trying to use with TRADER OVERHAUL and FACTION BASED ECONOMY and seems that is working as intended, good job.
I know for a fact it works with Faction Based Economy since that's what I've been using alongside it.
yea plus should be working with trader overhaul as long you don't use the outfit version of it
Uploaded a patch for TO since it wasn't working correctly - trade_presets.ltx conflicted
Many thanks! Was waiting for it for months!
Make a text asking for feedback more in size. I will follow your addon, it looks very, very good
👍
Is this compatible with Escape from Maid Plasticine Icons pack of modpacks1!)??'''?
xd
It depends whether I actually escape from maid or not
There seems to be some kind of incompatibility with your mod and Trader Overhaul (without any of its optional files).
I've narrowed it down to only having these two mods active in my load order, and whenever I first talk to Spore most of the time (like a 75% chance when INITIAL_TRADER_STOCK is 4) the game crashes, and most of the time the end of my log has this:
npc id: 20773 name: mar_base_owl_stalker_trader20773 adding item sec:1p29 id: 4445
stack trace:
at address 0x000000014028E8C1
or this:
* Register UI: Dialog
stack trace:
at address 0x000000014028E8C1
This crash could also potentially happen to other traders but i haven't tested it.
I hope this could get fixed soon, as i love the idea of this mod working together with TO.
Many thanks.
Thanks for the heads up, I'll take a look - probably its something to do with the trade_presets.ltx if I had to guess.
Updated with Trader Overhaul patch. Since it appears out of all the possible trader overhaul patches there is only one conflict and trade_presets.ltx doesn't change regardless of what you use, it should work with whatever combo of the Trader Overhaul options you choose.
unfortunately the trade_presets.ltx has nothing to do with the crash I'm talking about as it can still happen with this patch you provided for TO. I'm no modder but i think it has something to do with how the scripts in this mod interpret the different stock TO has.
Here are the whole crash logs I've been getting if your interested:
This one mentions the 1p29 scope at the end(I've ONLY seen it mention 1p29, never anything else): Pastebin.com
And this one doesn't mention the 1p29 scope: Pastebin.com
Last thing to mention is the crash happens more often the higher value INITIAL_TRADER_STOCK is. The crashes here were with INITIAL_TRADER_STOCK = 3. Sorry if I'm giving you a headache, but I hope you can figure something out!
Interesting. Just to ensure we're on the same page, can you share the moddb link to which Trader Overhaul mod you're using since there's a few laying around?
I have same crash. Using Trader Overhaul from here Moddb.com only "Trader Overhaul (Main Folder)" from archive.
Then this mod, folders "Wuuts Anomaly Dynamic Economy v0.2.0 - With Trader Restrictions" + "Opt - Wuuts ADE - Trade Overhaul Patch - With Trader Restrictions"
When i talk to Spore in CS base i have same "mar_base_owl_stalker_trader21387 adding item sec:1p29" crash.
INITIAL_TRADER_STOCK is just a dice roll to have bugged item and crash or not.
Thanks for bringing this up, I'm looking into it and hope to have a patch tonight.
As an update, no closer to a solution as its an unhandled exception ... but i did recreate the error and have the minidump so once I finish compiling xray engine and get .pdb I will get more info and figure out how to solve.
great mod, and very thorough! the lag from offline trades is manageable during the day, but i've noticed at night it gets ridiculous -- eight times in one in-game hour it was running batches, and that was after lowering the batch amount in the script. is that by design, or just a coincidence? thanks.
It's unfortunately just the way it goes with this mod - it's quite CPU intensive once you've visited a large enough number of maps - Wuut indicates that there is a performance cost to it, and although I'd like to completely refactor this script one day to improve it, all I did for now was fix a couple typos that caused certain functions to not work and edit the existing functions to bring it up to date with the newscript structure of 1.5.1.
This comment is currently awaiting admin approval, join now to view.
after reading the addon's description and looking into the code, i need to retract my previous comment - i had no idea. with all those heavy functions being constantly called, performance problems seem unavoidable. i also recall not being able to work with the "db.storage" on game load, don't know if that's (still) a thing though.
therefore, the only suggestion i might have is to get rid of the wasteful offline trade and focus on a current level where the game actually happens. that would significantly reduce the data processed and the most expensive tasks (done in batches) could hide better, eg behind (some of) the "ActorMenu_on_mode_changed" callbacks. the authenticity and variety lost can be substituted with a carefully tailored, time based (vanilla like) resupply system. not so "realistic" or "natural" solution but acceptable, i think.
on a different note, there's a part of the "axr_trade_manager" script that i don't understand. the first definition of the "npc_trade_buy_sell" function, which btw results in an infinite (inescapable) recursion, is replaced by the second one so... are lines #229, #230, #231 unnecessary or am i missing something there?
when i went to the wild territory to send a group of three stalkers and went back to rostok i got a memory crash when loading the map, this happened when i complete that task "Search and Resque" and load back rostok; i tried again without the dynamic economy and no memory crash so far
npc id: 39008 name: sim_default_stalker_039008 adding item sec:wpn_toz34_obrez id: 19727
npc id: 20094 name: bar_visitors_barman_stalker_trader20094 adding item sec:wpn_sks id: 52495
npc id: 20094 name: bar_visitors_barman_stalker_trader20094 adding item sec:stalker_bear_outfit id: 34065
npc id: 20094 name: bar_visitors_barman_stalker_trader20094 adding item sec:stalker_drought_outfit id: 34066
npc id: 20094 name: bar_visitors_barman_stalker_trader20094 adding item sec:stalker_outfit id: 34068
npc id: 20094 name: bar_visitors_barman_stalker_trader20094 adding item sec:stalker_predator_outfit id: 34069
npc id: 20094 name: bar_visitors_barman_stalker_trader20094 adding item sec:stalker_salamander_outfit id: 34071
npc id: 20094 name: bar_visitors_barman_stalker_trader20094 adding item sec:af_mask_filter_1 id: 40215
npc id: 20094 name: bar_visitors_barman_stalker_trader20094 adding item sec:stalker_tigerstripe_outfit id: 34072
* [x-ray]: OOM requesting 16345988023 bytes
* [x-ray]: Full Memory Stats
* [win32]: free[137407918856 K], reserved[4657336 K], committed[26377216 K]
* [ D3D ]: textures[3804567 K]
* [x-ray]: process heap[3826072 K]
* [x-ray]: economy: strings[-1573917 K], smem[296865 K]
FATAL ERROR
[error]Expression : <no expression>
[error]Function : out_of_memory_handler
[error]File : xrDebugNew.cpp
[error]Line : 472
[error]Description : fatal error
[error]Arguments : Out of memory. Memory request: 15962878 K
stack trace:
EDIT:
BEWARE THAT EVEN WITH A HIGH END PC, IF YOU USE A LOT OF ADDONS AND TRAVEL FROM MAP TO MAP CAN HAPPEN TO HAVE A CRASH FOR MEMORY WHEN LOADING, I FIXED SETTING IN wuut_economics.script local OFFLINE_TRADING_MAX_JOBS = 4
local OFFLINE_TRADING_RADIUS = 300
Out of Memory errors are generally related to texture and sound mods - while Wuut's does use some memory, a single texture should take up much more. There's some tips and tricks for out of memory issues you can find on Anomaly Discord to help
yea, hope you're right but back then i tried several times lowering all the graphics to the lowest, from texture, object distance and grass even lowering on potato mode dx11 but didn't work, i tried several times; dunno, maybe it's a coincidence but for now i keep that settings until the next crash comes (hope not lol)
This mod is great for hardcore survivalist like myself!
One question, down the line would it be possible to make it so that you can adjust the INITIAL_TRADER_STOCK for each trader?
I like to imagine that traders south of the map can easier get resupplied then traders at the north side of the map. so if each traders inital stock could be configured, you could make it so the more north you venture, the harder it will be to sustain yourself. Would be perfect in my opinion.
Anyway, thanks for the mod!
This is a clever idea - I'm not sure how to implement just yet but I've added it to the future features list. Adding MCM configurations for the script options as well would be a nice step so people don't have to open .script
This comment is currently awaiting admin approval, join now to view.
In conjunction with
Arszi's Dynamic Radiation Zones and Radiation Overhaul V2.1 for Anomaly 1.5.1
there is just not enough water without restocking. I think some soft restock with most basic items would be great.
Also restock with Zone produced items is logical. No need to wait for an artifact to have more dog stew xD OR make traders restock on animal food after being supplied with animal parts (if it's possible)))
You can reply in Russian, I write in English for the benefit of other ppl)
woops, forgot to login.. should I post it again?
There's an option to enable recurrent restock (details up top in the description), so that you get some amount of restock regardless of whether you actually dropped artifacts off or not. I think this isn't a 'full' solution to your issue, but would definitely mitigate it without giving too much overabundance of equipment at traders.
As far as restock of zone produced items, I agree - but something like this will have to wait until I release my own version of this mod written entirely by me instead of updating Wuut's amazing work, as I don't fully comprehend the structure of this mod to where I could make such a change successfully.
Hi,
I have just checked the trader presets file and noticed that it's incompatible with mods like BaS and Outfit Attachment Overhaul because it's missing their related item records. Actually the file that I'm using is working fine, but I noticed one difference at the end of your file where I'm unsure if those changes are made for your mod.
Edit: It's ok. those are necessary for the restrictions to be (not) removed.
I just added the BaS and outfit attachments records to it.
The trade_presets.ltx can be merged fairly easily to be compatible with various mods. If you merged it to be compatible with some specific mod(s), can you send it my way (@Beef "Fanatic") on discord and I'll include it in the next release?)
Sorry, didn't see your answer before. Yes, the merges are very easy. But I don't recommend my file because I'm not only using multiple mods that edit the presets, but also my own mods (some of them are not yet released). However, merging with any other addon is a matter of minutes when using a tool like BCompare. But actually there is no need to really merge, becaus any user just needs to change the very last section on the bottom by adding some ";", just like seen in your file.
I have tried this mod with new game and played for a bit, then disabled when got crashes with Trader Overhaul.
Now i decided to enable it again to just have offline trades (on same save but later), but getting crashes on said trades:
FATAL ERROR
[error]Expression : <no expression>
[error]Function : CScriptEngine::lua_error
[error]File : ..\xrServerEntities\script_engine.cpp
[error]Line : 191
[error]Description : fatal error
[error]Arguments : LUA error: n:/games/anomaly\gamedata\scripts\wuut_economics.script:337: attempt to index a nil value
stack trace:
Is it because i have visited some levels since disabling addon? And is it possible to enable mid-playthrough at all?
Okay i think i have got around that. I enabled this addon on every location i have visited before and quickly saved before it crashed, then disabled it. After visiting everything looks like i can play and have offline trades without crashes.
Thank you for updating this, really improves immersion and vendor stock variety!
P.S. No performance problems whatsoever even on heavily modded game. CPU is i5 8600K
There's some kind of random crash related to Trader Overhaul that I haven't been able to pin down the cause yet as it throws an unhandled error, and therefore doesn't give me a clue as to what it is specifically.
used the fast travel of PDA from great swamps base to garbage hangar and after a few seconds of standing in the garbage hangar i get the following crash:
FATAL ERROR
[error]Expression : <no expression>
[error]Function : CScriptEngine::lua_error
[error]File : ..\xrServerEntities\script_engine.cpp
[error]Line : 191
[error]Description : fatal error
[error]Arguments : LUA error: c:/stalker/stalker\gamedata\scripts\wuut_economics.script:337: attempt to index a nil value
stack trace:
heres the full log if you want:
Easyupload.io
The problem with Trader Overhaul has been fixed thanks to Mr.FlashMode
It turns out that there are 5 weapons with a mismatch of upper/lower case between their definition and their usage in each of the trader presets
Wpn_addon_scope_zf4
Wpn_addon_scope_pu
Ps01
Pso1m21
Wpn_addon_scope_galil
And this was causing the unhandled exception crashes. I imagine the author of TO will update these, but if you are impatient in waiting for a fix then you can use Notepad++ to find and replace in files while using "Match Case" and replace them with a version that uses all lowercase letters. There are too many options under TO for me to safely include a simple "patch" here.
Looking through TO, I noticed "Wpn_pkm" as well. However after making your suggested changes I still get this error about 5 seconds after loading.
The log mentions the error happening with trader 3108, if that helps
Thanks for the info!
Hermano me gusta la idea del parche, pero tengo un problema cuando instale el parche el juego empezó a dar lags cada 5 segundos. Pense que era otros addons pero este, no se cual sera el problema pero agradecería que lo revisaran gracias
creo que es inevitable, ya que el propio autor dice que es una carga bastante pesada a la CPU, supongo que por los trades offline que hacen los npc y los cambios que se van aplicando a los traders cada x tiempo, yo tengo una pc de gama alta y aun asi sufro lags/mini stutters, en especial a la noche cuando los npcs estan en la base
Since you have performance issues, I would first start by reducing the radius inside wuut_economics.script to something like 150, and then reducing the number to trades to 5.
This is how I have resolved the lag on my end.
Long-term, I will write my own dynamic economy from scratch and hopefully solve the lag, but in the short-term Wuut had already made this mod, and so I really only updated this mod to work with 1.5.1 with his permission, since he wasn't interested in updating/maintaining it anymore since he's got other projects.
Liked the idea of the mod but there are a few things i encountered,
1. Traders tend to overstock things like ammo and sigths over time. Started selling like 30 -60 ammo, now some stocks are in 300 and growing,
2. Mysteries of the zone: If i sell things like "anomalous bread" to Sid, now in time i see like 15 anomalous breads. Same happens for items such as recipes
3. Also, but i don't know if its related to this mod or one of the repair mods, technicians get almost any sewing thread and no dissasembling tool, so making repairs is almost impossible.
Thanks for sharing - about the anomalous bread is somewhat humorous, but I think its indicating some deeper problem with the resource management behind the scenes
As far as the types of loot that show up at traders, its almost entirely dictated by what types of loot spawn on death in your game, as the entire economy is basically driven by those loot drops. You could enable recurrent restock so that traders get some % of their inventory regardless, which would allow some of the specialty stuff to spawn. In general, its supposed to also force you to sell artifacts to traders.
Is it possible that this mod is responsible for NPCs appearing for a very short moment somewhere in front of the player, while the game lags very shortly at the same time? Whenever cleaning jobs for traders apear in the log, some NPCs (sometimes one, sometimes more of them) appear for half a second and then immediately disappear.
It seems like the script kinda moves them around for trading during offline processes. Not sure if that's the case, I didn't check the script in detail, but it stopped happening after I disabled the mod.
Or does this belong to the initialization of traders and trading NPCs, when entering a location for the first time? If so, I could live with it, since the mod doesn't cause lag for me most of the times. But on the long term it would be very disturbing.
If I'm right, would it help to increase the radius for NPCs in the script? For example, when I entered The Wild Territory for the first time in my current run, the "blinking NPCs" were happening multiple times, the deeper I moved into the area. If it would take all NPCs from the area into account right upon entering it, the lagging would be at least limited to the very first time entering the place. On the other hand it processes them in batches... I don't know.
Drive.google.com
Google drive link for Trader Overhaul with the fixed item naming, until TO updates.
I hate you ;). this addon feels like - when you play with it, difficult and stressful. but once you taste it, you feel empty to play without it in next run. thanks for the great addon.
one question, Butcher in Hanger doesn't buy artefact so that no restock. is it intended?
Have the same issue, no restock for all technician and medics, is't sad. Repairing is broken.
Okay, I found a workaround for this - you need to donate artifacts to technicians and medics.
But now I have another problem - no one sells water ...