Tired of all looted weapons being broken? Then this is the mod for you! For STCoM, including Weapon Degradation + FOV fix!
REQUIRES:
HOW TO INSTALL:
Drop the gamedata folder in your Call of Misery directory, before or after STCoM, should be compatible with any mod that doesn't change death_manager.script.
CHANGELOG:
1.0 - Release
1.1 - Added Weapon Degradation + FOV fix
1.2 - Fixed MP-412 Rex not having any (or enough) zoom
1.3 - Fixed compatibility with latest STCoM Weapons Fix (it added a new Sig 550 variant, which 1.2 lacked causing a crash regarding some traders)
1.4 - Finally included SashaRed's AUTisM compatibility patch
ALSO INCLUDED:
If you prefer no zoom at all, try SashaReds FOV edit here.
ABOUT:
TL;DR: Makes it possible to loot weapons off NPCs that aren't always in low condition.
Details:
In Call of Misery (and Misery by itself), the condition of weapons dropped by enemies are determined by this section of death_manager:
function set_weapon_drop_condition(npc,itm)
local condition = (math.random(40)+5)/100
--printf("condition [%s]", tostring(condition))
itm:set_condition(condition)
What this code does is basically use a random number generator to produce a number between 6 and 45 and set that as the condition. Meaning that the highest possible condition you can ever find a weapon is 45% and lowest is 6%. The reason for this is for balance apparently, so you can't get rich off selling weapons, but I thought this to be unrealistic. With how often you find gun cleaning items, you'd think even lowly bandits would at least a tiny amount of maintenance, no? Maybe the gun took a bullet in the firefight, sure, but I don't think that's quite a common occurrence irl.
I changed the algorithm to what I personally think is more realistic and at least somewhat balanced:
function set_weapon_drop_condition(npc,itm)
local rng = math.random(100)
local condition
if (rng <= 5) then
condition = math.random(80,100)/100
--Good Condition 5% chance
elseif (rng <= 55) then
condition = math.random(65,80)/100
--Average condition 50% chance
elseif (rng <= 85) then
condition = math.random(25,65)/100
--Poor condition 30% chance
else
condition = math.random(25)/100
--Destroyed condition 15% chance
end
--printf("condition [%s]", tostring(condition))
itm:set_condition(condition)
What this does is determine the quality by a roll of the dice, there is a 5% chance to find a weapon in excellent condition (80-100% condition), 50% to find one in average condition (65-80% condition), 30% to find one in poor condition (25-65%) and 15% to find one practically destroyed (1-15%).
Mind that this does not affect weapon distribution and quality types (low level bandits will still carry Worn and Rusty guns, some will have actually been maintained, for example.)
It's up to you if this affects balance or not, personally I don't think its very cheat-like, but for those who want it then there it is.
Average
9.54 votes submitted.
Thanks, this never really made sense to me. Damaged/worn guns, yeah. But unless every gun conveniently gets shot mid-firefight most of them are going to be in working order.
Adjusted FOVs for STCoM? I've already done that. Moddb.com
I know, but I'm making a version for more zoom actually. Mostly to make them consistent, for example, the TT33 has no zoom compared to every other pistol. Rifles for long range should have a bit of zoom, the SVT-40 is awkward to use since it looks like my face is sitting behind the stock rather than holding it like.. y'know, a rifle.
Alright.
Me have already added this very helpful addon on my compilation :) Moddb.com
(for players dont use STCoM).
MORE TO COME:
Adjusted Weapon Degradation rates for STCoM (some weapons degrade ridiculously quickly)
really looking forward to this one mate, some weapons like PP bizon or vintorez degrade really quick! i shoot maybe 50-80 rounds and got 8k bill its unreal.
I know right? SVT-40 degrades a full ten percent after 20 rounds.
I've got a rough version I'm playing on right now, once I polish it up and fix the FOVs I'll add it to this file.
And its up, have fun!
i download now mate, i know it can be tedious editing those weapon configs one by one. thanks for doing it.
i was looking for mod to fix some pistols which zoom out when you aim down sight instead of zooming in! any clues?!
FOV fix just fixes some inconsistencies, like the TT33 having no zoom at all
lmao you ninja-ed me! i was looking for a fix
I merged this mod with Autism if anyone is interested i'll upload the file if you guys want both
Go ahead. Would be great.
mate would it be possible to fix the FOV on MP-412 REX? it suffers from the same issue as TT33
Damn, forgot about that one, I'll fix it soon.
i played with the new update for few hours yesterday and i have to say the gun maintenance feels a lot more reasonable now! you can't go wrong with this mod! thanks for making it.
does this mod need update for the new STCoM fix?
i narrowed it down to this mod! it crashes at the trader due to new weapon profiles added by recent STCoM fix
Yeah looks like its got to do with the new things added, I'll have to investigate and probably will have to re do all the degradation/fov edits, I'll get on it soon.
Fixed it, it had to do with the new Sig 550 variant added, should work now
Here's a patch for AUTiSM, using this mod's condition values. Dropbox.com
Getting an "unhandled exception" crash when using the fov + weapon degradation fix. Weird, because when I compared the modded weapon configs vs. unmodded and there weren't any changes apart from fov and degradation values, so why tf does it crash for me?
Weird, might be some kind of memory issue, have you tried reinstalling?
I am having trouble editing the numbers. Could you please explain how to edit the drop rates in order to adjust them to our own liking? Eventually, could you make it so that there's a 5% chance for perfectly maintained weapons, another 5% for well maintained, 30% for medium maintained and the rest being for poorly maintained and destroyed weapons?
It's pretty easy to adjust if you know a bit of programming, its probably doable without any previous knowledge if you just keep a few things in mind:
What the top part that says local rng = math.random(100) is doing is assigning a variable, rng, with a random number between 1-100.
The the if and elseif are conditionals, basically they only execute the line that's directly below them if they part within the brackets are true. A list of conditionals starts with an if and end with an else, and ifelse in the middle.
So whats basically going on here its checking "if this is true, do this, if not and this is true, do this, if not this is true, do this, if none of the above are true, do this."
So when it says (rng <= 5), its checking whether rng is less than or equal to 5, this is therefore the 5% chance of it happening.
Now the part that actually assigns the weapon condition, where it says condition is a variable that was created earlier, math.random is a number generator, the two numbers in the brackets are the range, so in this case it will pick a number between 80 and 100, if you put only one number in the brackets it will pick between 1 and whichever number is in the brackets. the /100 at the end is to divide it by 100, because STALKER uses a decimal value to represent condition (ie 100% = 1, 75% = 0.75, etc)
In Lua, anything starting with a "--" is a comment, meaning the program does not read it, I put them in there to say what the general percentage is of each.
As you can see, I've listed the rng conditionals starting from low to high on its way down. So to do what you're describing, I would make the top one (rng <= 5), the next one (rng <= 10) and then (rng <= 40), with the last one being the rest. This is because you want to start with lowest percentage first and add it to the next larger percentage.
I hope this helps, I know its a god damn essay at this point, maybe I'll make an edit for it, if I do I'll probably make a few different versions.
Hey, the same guest here.
Thanks for the lightning swift response! Sadly, this is exactly what I've done even before posting a comment, yet I've received errors upon trying to load a game. After you had uploaded the instructions, I tried redoing it but ended up with an error mentioning the death_manager.script in its directory and talk of a nil value. So, I am unsure what I'm doing wrong or if it's perhaps the fact that the changes are conflicting with some mods (though it shouldn't be, as your version of the drop rates work just fine).
In any case, if you do get to uploading several versions of the drop rates, which would be great, please, do include my version if you have the time!
Thanks again for explaining how the script works, it was a fun read.
Yeah when I was trying to make it I had a lot of errors and crashes at first, it was a lot of trial and error to get it to work (especially since I don't actually know lua, I do java and just tried to improvise with googling lua syntax).
In any case, I'll eventually make a few different versions once I get some more ideas, I'll likely include yours.
I tried changing this to, to 5, 35 and 75 and last if destroyed would then be 25%. But my game crashes and calls for error in deathmanager script. But all I did was change values from 5, 55 and 85 to 5, 35 and 75. What could be wrong here?
Could be a lot of things, try copy-pasting your code here and I'll look at it
function set_weapon_drop_condition(npc,itm)
local rng = math.random(100)
local condition
if (rng <= 3) then c
--Good Condition 3% chance
elseif (rng <= 13) then c
--Average condition 10% chance
elseif (rng <= 63) then c
--Poor condition 50% chance
else c
--Destroyed condition 50% chance
end
--printf("condition [%s]", tostring(condition))
itm:set_condition(condition)
Well I see how that wouldn't work, the conditionals are missing the code that actually end up creating the number determining the weapon condition. You seem to have thought the comments did that. With what you posted, the variable condition would be a null value and that's what causes the crash.
Mind that any line beginning with -- is a comment, it's not actual code read by the program. It's essentially notes left by the programmer (in this case me).
Try this:
function set_weapon_drop_condition(npc,itm)
local rng = math.random(100)
local condition
if (rng <= 3) then c
--Good Condition 3% chance
elseif (rng <= 13) then c
--Average condition 10% chance
elseif (rng <= 63) then c
--Poor condition 50% chance
else c
--Destroyed condition 37% chance
end
--printf("condition [%s]", tostring(condition))
itm:set_condition(condition)
If you want to change the condition percentage range (ie, how I have good condition as between 80%-100%), change the two numbers separated by a comma in the math.random(80, 100)/100 parts, here's how it works:
In math.random(x, y)/100, x is the lower range and y is the upper, which means it will pick a number between x and y including x and y.
In math.random(x)/100, as there is no second number in the parenthesis, x is the upper range and the lower range is automatically set as 0.
Do not remove the /100 from any of them, because stalker interprets percentages as decimal (as I've said in another comment, 1 = 100%, 0.75 = 75%, 0.5 = 50% and so on)
Hope this helps
Oh, my mistake, its moddb cuts off part of the code for some reason, I'll pm you what the code should look like
Yes, the code was cut off by Moddb. I think I actually have the same numbers as you wrote and same code but still get crash. Or maybe do I need to do a new game for this to work?
I'll 1:1 inspect your code versus mine and see if it's my fault.
I PM'ed you the snippet I wrote, it should work, it shouldn't need a new game I don't think but if it still occurs try
thanks for this mod. makes it less grindy :)
already finished mysery without addons and since CoM is just freeplay ill use this mod :)
updated the FOV+Weapon Degradation Adjustments config files - Www119.zippyshare.com - for the STCoM Weapon Pack fix (updated Apr 7th, 2017)
What exactly did you change here? I already updated my addon for latest STCoM since 1.3 :/
when i extracted your fov+weapons config files i had a ctd on loading my save game. this is with latest STCoM Weapon Pack fix.
in winmerge i noticed the STCoM Weapon Pack fix weapon files had values that were missing in your fov+weapons config files.
i just changed the zoom levels and degradation values by adding over your values. no more ctd on load up :)
EDIT: Nevermind, my problem is CTD's involving the item condition mod, not the FOV config
I really dont understand why it has a problem with my tweak, keep getting a CTD and all I did was change the numbers to suit my ideal drop rate.
I think ive narrowed down the issue to this segment here.
local function eat(temp,itm)
if (is_weapon(itm:section())) then local c
if (cond > 0.8) then
itm:set_condition(math.random(5,50)/100)
printf("-eaten:"..itm:section())
end
end
end
npc:iterate_inventory(eat,nil)
utils.se_obj_save_var(npc:id(),npc:name(),"items_eaten",true)
end
If im reading this correctly, its saying any time a corpse is spawned, if the condition of the weapon is above 80%, it will set the condition to between 5% and 50% which completely contradicts the other drop specifications.
That's a section I did not touch at all, I'm not really sure whats going on in it but it looks like it some kind of food related thing. You shouldn't have to edit any other part to make your values work though.
Tried editing your code, first with Notepad, game crashed. Then used Notepad++ and it worked. Ty for this mod, I earn a bit more money with it, no more silly broken guns everywhere.
Anybody noticed that in-game inventory custom avatar in a mod preview picture ? cyka :D
Hello would you like help me ???
With it
function set_weapon_drop_condition(npc,itm)
local rng = math.random(100)
local condition
if (rng <= 5) then c
--Good Condition 5% chance
elseif (rng <= 35) then c
--Average condition 30% chance
elseif (rng <= 85) then c
--Poor condition 50% chance
else c
--Destroyed condition 15% chance
end
--printf("condition [%s]", tostring(condition))
itm:set_condition(condition)
BECAUSE!!\Expression : <no expression>
Function : CScriptEngine::lua_error
File : ..\xrServerEntities\script_engine.cpp
Line : 189
Description : fatal error
Arguments : LUA error: e:\call of misery\gamedata\scripts\bind_stalker.script:49: attempt to index global 'death_manager' (a nil value)
stack trace:
0023:0072717C xrCore.dll, xrDebug::fatal()
0023:051FB774 xrGame.dll, CDialogHolder::UseIndicators()