Perraine Posted July 13, 2016 Share Posted July 13, 2016 I wonder if it's within the scope of you guys to fix probably the most totally borked and dreadfully implemented game mechanic in Fallout 4? The settlement raid mechanic is so bad, surely it constitutes the "ultimate bug" in the game? "Small" settlements having no less than 4 enemies spawn location, but "larger" ones only having 2 or 1? Settlements that get singled out and get hit time, after time, after time, after time, after ti ... Yet others that are larger and more productive never getting hit even once? Spawn Points "within" the settlement build borders, completely and totally trivializing any defenses you create? Enemies spawning on fast travel points at the exact same time as the player FT's in? Enemies spawning "inside" buildings and being stuck there? Super Mutants with Rocket Launchers and Fat Man's spawning in settlements of a level 7 player? Enemies "running away" in fear causing "defend xxx" mission to fail? The calculation for unattended Raids being completely broken - A base with over 2000 defense being half destroyed by Raiders? Settlement Raids during "critical" times whilst you are doing main and/or main faction quests? Enemies that spawn in that just wander around for 10 mins, with no-one aggro'ing on them, And even start shooting people with no-one and no defenses aggro'ing on them? I've "failed" this "quest" numerous times, because of ridiculous bugs like these. Raiders stuck in a wall I'd built, and everyone eventually de-aggro'd on them, so I left ... 5 mins later I get the "defend xxx failed" pop-up, and when I went back to the settlement, half my settlers were gone and most of my defenses were destroyed, plus a water purifier that was nowhere near the Raiders that DID actually make it. I have a base with over 100 Heavy Laser Turrets, over 150 Heavy Machine Gun Turrets and 12 Sentry Bots, protecting triple stack height concrete floor foundations encircling the entire settlement, and it still claims I can "fail to defend" ??? If I'm there, even half a dozen Deathclaws or enemy Advanced Sentry Bots and Assaultron's, get melted into indistinguishable goo in mere seconds, but apparently when I'm not there, nothing works? Surely the whole system is as broken as it gets without actually causing the game to stop altogether. The worse part is, if you restrict yourself to no fast traveling (or play on Survival Difficulty) You can be on the entire other side of the map, and never be able to get there in time, yet there is nothing you can do to avoid the dice rll that says, you failed? Link to comment Share on other sites More sharing options...
Korentin Posted July 13, 2016 Share Posted July 13, 2016 I wonder if it's within the scope of you guys to fix probably the most totally borked and dreadfully implemented game mechanic in Fallout 4? The settlement raid mechanic is so bad, surely it constitutes the "ultimate bug" in the game? "Small" settlements having no less than 4 enemies spawn location, but "larger" ones only having 2 or 1? Settlements that get singled out and get hit time, after time, after time, after time, after ti ... Yet others that are larger and more productive never getting hit even once? Spawn Points "within" the settlement build borders, completely and totally trivializing any defenses you create? Enemies spawning on fast travel points at the exact same time as the player FT's in? Enemies spawning "inside" buildings and being stuck there? Super Mutants with Rocket Launchers and Fat Man's spawning in settlements of a level 7 player? Enemies "running away" in fear causing "defend xxx" mission to fail? The calculation for unattended Raids being completely broken - A base with over 2000 defense being half destroyed by Raiders? Settlement Raids during "critical" times whilst you are doing main and/or main faction quests? Enemies that spawn in that just wander around for 10 mins, with no-one aggro'ing on them, And even start shooting people with no-one and no defenses aggro'ing on them? I've "failed" this "quest" numerous times, because of ridiculous bugs like these. Raiders stuck in a wall I'd built, and everyone eventually de-aggro'd on them, so I left ... 5 mins later I get the "defend xxx failed" pop-up, and when I went back to the settlement, half my settlers were gone and most of my defenses were destroyed, plus a water purifier that was nowhere near the Raiders that DID actually make it. I have a base with over 100 Heavy Laser Turrets, over 150 Heavy Machine Gun Turrets and 12 Sentry Bots, protecting triple stack height concrete floor foundations encircling the entire settlement, and it still claims I can "fail to defend" ??? If I'm there, even half a dozen Deathclaws or enemy Advanced Sentry Bots and Assaultron's, get melted into indistinguishable goo in mere seconds, but apparently when I'm not there, nothing works? Surely the whole system is as broken as it gets without actually causing the game to stop altogether. The worse part is, if you restrict yourself to no fast traveling (or play on Survival Difficulty) You can be on the entire other side of the map, and never be able to get there in time, yet there is nothing you can do to avoid the dice rll that says, you failed? Seems to me like you've probably broken it yourself if you have settlements with "over 100 Heavy Laser Turrets, over 150 Heavy Machine Gun Turrets and 12 Sentry Bots, protecting triple stack height concrete floor foundations encircling the entire settlement, " The restrictions Bethesda put in the game are often there for a reason so if you use mods that bypass them beware of the consequences. Although I'm sure there are a few things you mention that could fall under bug fixing category you'll have to be alot more specific on where and how it occurs. Link to comment Share on other sites More sharing options...
Perraine Posted July 13, 2016 Author Share Posted July 13, 2016 Seems to me like you've probably broken it yourself if you have settlements with "over 100 Heavy Laser Turrets, over 150 Heavy Machine Gun Turrets and 12 Sentry Bots, protecting triple stack height concrete floor foundations encircling the entire settlement, " The restrictions Bethesda put in the game are often there for a reason so if you use mods that bypass them beware of the consequences. Although I'm sure there are a few things you mention that could fall under bug fixing category you'll have to be alot more specific on where and how it occurs. The "settlement budget" is there only to stop the game from lagging to badly if having to render too many complex items. It has nothing whatsoever to do with the Settlement Raid system. There is also the fact that even with original settlement budget restrictions, you can easily accumulate defenses equal to or even greater than what I have listed. The other issues I mentioned are now as synonymous with Fallout 4 as Preston's "another settlement needs your help" or the ubiquitous "Arrow to the knee" If you haven't experienced any of these things, then my friend, you haven't actually played Fallout 4. There are literally 100's of thousand's of posts and threads all over the internet complaining about these issues. I'm not sure how much more "specific" you can get as far as information goes, as the bugs aren't caused by anything other than woeful coding by Bugthesda. Link to comment Share on other sites More sharing options...
Arthmoor Posted July 13, 2016 Share Posted July 13, 2016 They're synonymous with Preston only in games with giant numbers of mods or with unlocked settlement limits. Sclerocephalus has posted an exhaustive thread covering these issues here and he's been the one behind our efforts to get the scripting portion of settlements whipped into shape. All of those issues you've listed are things I've never seen in the hundreds of hours I've logged for the game. 28 settlements in the Commonwealth and 2 on Far Harbor and I've never encountered much of what you posted about. "It's all over the internet" isn't exactly trustworthy information. Korentin 1 Link to comment Share on other sites More sharing options...
Perraine Posted July 14, 2016 Author Share Posted July 14, 2016 And there we go, someone else making sweeping judgements and essentially calling me a dirty filthy cheat, not worth listening to or helping. For you information I do NOT have "giant numbers of mods" nor have I "unlocked settlement limits". My computer is a potato, so I can do neither of those things. I have 11 mods installed. That's it! A couple of DD_Productions building items, and the Sanctuary Housing pre-war and post-war build set. I also use the Settlement Management Software.If you can say definitively, that any of those are the cause, then I will happily uninstall them, II also hope that "It's all over the internet" isn't exactly trustworthy information" doesn't mean that you disregard any and all forum threads and/or posts on any other site except yours? If you haven't experienced any of these issues (and I admit I'm a bit confused, because you first say you haven't experienced any, then you say you have only experienced a few, so which is it?) I can only ask, what's it like working for Bethesda? Because the only way I can see that one could NOT have had any of these issues, is if one had a Dev build of the game. Someone even tried to create a "mod" to alleviate the issues somewhat, by moving raid spawn points. Of course it didn't work, because of the trouble you own "Sclerocephalus" has apparently stumbled into, but it was a good try. I never installed the mod, because a quick look at the posts revealed that it pretty much didn't work for anyone. You know I used to think you guys were pretty cool and helpful, the way you fixed Skyrim so well and all (amazing work by the way) , but now I'm not so sure ... Link to comment Share on other sites More sharing options...
Arthmoor Posted July 14, 2016 Share Posted July 14, 2016 You know I used to think you guys were pretty cool and helpful, the way you fixed Skyrim so well and all (amazing work by the way) , but now I'm not so sure ... We get that a lot from people who don't like to hear the harsh truth of things. Sorry that we don't play the political correctness cards here. gameboytj 1 Link to comment Share on other sites More sharing options...
VaultDuke Posted July 14, 2016 Share Posted July 14, 2016 Some things you mention are by design, and while annoying not something the unofficial team might likely address. Some things sound like engine limitations (spawn timer after FT and no boundary check for walls) Some things just sound like the AI not triggering properly on your slow rig (do we have mods to test script latency for FO4 already?) The rest sounds like anecdotal 'evidence' that the RNG is broken, of course you find people who agree on the internet. You basically reported your gut feeling there. You failed to report any of this with reproducible steps or an explanation of which formula in a script is wrong and why. That's the currency that drives the bug hunting economic. You get pissed at Arthmoor for dismissing your 'all over the internet' report, yet in doing so fail repeatedly to produce a single useful link that outlines any of the issues you mention in a way that a) convinces anyone this is more than a fluke in some human brains misinterpreting how random numbers should be and b) sets anyone on track to reproduce and/or fix the issue. It would be better to grow a thicker skin, learn the bug hunting language or leave your ego at the door. Loosing your temper,(or lets say starting to get annoyed) because you were told your reports lead nowhere once is just.... yeah whatever. You write you have few mods yet most concern settlements it seems. You expect the forum to magically know if some are broken. You do not sound like you were able to deceiver whether any of your mods is to blame, yet you seem determined to convince the team that this must be something vanilla they should look into. Btw there is a separate forum for mod issue help and discussion, but even there you'd be asked to provide some detailed info like a full load order. Good luck. This is a forum frequented (non-exclusively) by people that dive into the code of a game to see if they find something wrong and then fix it. As a hobby. While we seem to be a bit more cool headed than you atm, i guarantee you none of us have ever won a coolness contest. So not sure where you got that from in the first place... Link to comment Share on other sites More sharing options...
Sclerocephalus Posted July 16, 2016 Share Posted July 16, 2016 Settlement attacks are handled by a function on WorkshopScript that is called by the DailyUpdate function. That is, chances are calculated for every workshop once a game day. There are a few general parameters that are checked first: (1) attacks on workshop allowed ? - no attack if false (this is a bool property that can be set to false by quest scripts to prevent random attacks, e.g. during main quest BoS or Synth attacks at The Castle) (2) workshop owned ? - attacks on unowned workshops are allowed at certain places (again, this information is in a bool property on the script) (3) population count - no attack if zero (4) days since last attack - no attack if less than 7 game days If all of this is true, an attack chance is calculated as follows: AttackChance = 0.02 + 0.001 * (FoodRating + WaterRating) - 0.01 * SafetyPerNPC - 0.005 * PopulationCount FoodRating is the sum of daily production by crops and all food items in the workbench and/or its linked container. Likewise, WaterRating is the sum of daily water production (from pumps and purifiers) and purified water stored in the workbench and/or its linked container. The attack chance is an absolute value (i.e. 1 = 100%, percentages are relative). If the calculated value is below 0.02 (2%), a base attck chance of 0.02 is assumed. Subsequently, a random float is calculated and compared to the attack chance value. If RandomFloat <= AttackChance, WorkshopParentScript is called to trigger an attack via the story manager. When the attack has been triggered (this is when the message appears on the screen), there are 15 game hours remaining to respond. If you don't make it to the settlement within that time, the attack will be resolved off-screen. The same happens if you leave the scene before all enemies are dead. Resolving off-screen means that attack and defense strengths (both with a random component) will be calculated. If the attack strength is lower than the defense strength, you get a message saying that the settlement did defend itself successfully. If not, a random damage (depending on the difference between the attack strength and the defense strength) is calculated and applied randomly to crops, resource objects (turrets, generators, water pumps/purifiers) and scavenge materials stored intto your workbench (sic! - if attackers win, they 'steal' building materials from your workbench). Off-screen resolution is a purely mathematical process. The game cannot "replay" a real attack (the area is not loaded, so how should it do that ?) and results may be unrealistic in that objects may be damaged that are actually out of reach. But again - including all those factors to make the result more realistic would be difficult to script and put a high workload on the papyrus engine. Seatonsan 1 Link to comment Share on other sites More sharing options...
Rorax Posted July 26, 2016 Share Posted July 26, 2016 Okay look,Clanfriend isn't exactly the most well spoken person on the internet but he does point out some things which could be viewed as bugs depending on your perspective.It has been confirmed and shown by the existence of 2 mods, that settlement attack spawn points do exist within settlement build borders. I'd personally call that a bug, how is a player meant to know that? or heck, even expect that? the player expects that attackers come from outside their borders, especially when this can cause attackers to spawn inside objects that the player unknowingly placed ontop of the spawn point. The two mods by the way are one that moves the spawn locations and another that can show you where they are via rudimentary effects at the location.Settlement attacks beyond: http://www.nexusmods.com/fallout4/mods/12892/? (moves the spawns) Settlement Management Software: http://www.nexusmods.com/fallout4/mods/12032/? (can visibly show the spawns in game) Super mutants spawning with level inappropriate gear was actually addressed in 1.0.4There are infact numerous videos that show that when all attacks have been defeated. That sometimes the settlement defend quest will fail. The universally linking issue in all of these occurrences is that the last enemy to die/ run away was outside the settlement build borders. which makes me think that what ever is checking to see if all enemies were defeated doesn't check far enough in some circumstances. I have never looked at what actually checks that so I couldn't say if that was a factual assumption.The attack resolution does anecdotally seem to favor the attacker a lot of the time, It isn't rare to see a settlement fail to defend itself in attack resolution, that would easily defend itself if you were present (and not fighting, making it more of a simulation) What ever the random element is in the attack resolution it does seem to oddly roll high favoring the attacker.I would suggest looking at the main quest line to ensure that certain goals are marked to stop random attacks. Although I'm not sure I could dig up the number of the episode for you, you can see there are a couple of times that Gopher from Gophersvids does get a settlement attack during an active part of a main quest objective. Now I say that fully understanding there are parts of the main quest that could be considered passive, aka waiting for you to take action but I am talking exclusively about parts of a quest that are active aka inside of a installation taking out enemies or defending bunker hill e.t.c e.t.cAnyhoo. I hope I helped explain things a little better. Link to comment Share on other sites More sharing options...
kawaksallas Posted September 1, 2016 Share Posted September 1, 2016 To add to the discussion, Graygarden is probably the safest place in the commonwealth Over 470 hours in the game, I haven't seen a single attack there. And to add more juice, now you can raid commonwealth settlements with nuka-world raiders. I don't want to spoil nothing, but let's just say I targeted a raid to Graygarden ... and my response was "Sorry, there's no one there to take the settlement from" Link to comment Share on other sites More sharing options...
oxhorn Posted September 12, 2016 Share Posted September 12, 2016 I think this changes from game to game. I get attacked at Graygarden all the time. Link to comment Share on other sites More sharing options...
scbfromnc Posted September 15, 2016 Share Posted September 15, 2016 I realize this may not be something that the Unofficial Patch team is interested in, but I would love to see someone make a mod to address settlement attacks that are resolved off-screen. I've read on Reddit that the chance of successfully defending an attack when the player isn't present is based on a calculation, as described above by Sclerocephalus. In one thread it described the chance of defending against an attack as decreasing as settlement defense increased (i.e. backwards from what intuition would tell you). In another thread it described the chance of success as about 50% regardless of how you have the settlement set up. I've tried Google searches and haven't found a definitive answer to this. Now there is a mod out there that tries to address this, but the mod author admits that he made a mistake and chance of defending the attack decreases with increasing defense rating. There are also reports that the mod caps Happiness at 50%. Not much activity on that mod so I think he may have abandoned it. So I'm coming to this forum because you guys are the ones I trust to make a mod that would work properly. Defense doesn't have to take everything into consideration, but I would think it should include settlement defense rating! And chance of success should increase with increasing defense. Formula might be similar to AttackChance, but without the food and water ratings included in the calculation. Anyway, thanks for all your work on the Unofficial Patch. I'm glad there are folks out there that care about game quality and the details since Bethesda apparently does not. Link to comment Share on other sites More sharing options...
Sclerocephalus Posted September 15, 2016 Share Posted September 15, 2016 It's all on WorkshopParentScript. Install the CK and have a look. int property resolveAttackMaxAttackRoll = 150 auto const ; max allowed attack roll float property resolveAttackAllowedDamageMin = 25.0 auto const ; this is as low as max allowed damage can go ; called by attack quests if they need to be resolved "off stage" ; return value: TRUE = attackers won, FALSE = defenders won (to match CheckResolveAttackk on WorkshopAttackScript) bool function ResolveAttack(WorkshopScript workshopRef, int attackStrength, Faction attackFaction) wsTrace("------------------------------------------------------------------------------ ") wsTrace(" ResolveAttack on " + workshopRef + " attack strength=" + attackStrength) ObjectReference containerRef = workshopRef.GetContainer() if !containerRef wsTrace(self + " ERROR - no container linked to workshop " + workshopRef + " with " + WorkshopLinkContainer, 2) return false endif bool attackersWin = false int totalPopulation = workshopRef.GetBaseValue(WorkshopRatings[WorkshopRatingPopulation].resourceValue) as int int safety = workshopRef.GetValue(WorkshopRatings[WorkshopRatingSafety].resourceValue) as int ; record attack in location data RecordAttack(workshopRef, attackFaction) ; defense strength: safety + totalPopulation int defenseStrength = CalculateDefenseStrength(safety, totalPopulation) wsTrace(" ResolveAttack on " + workshopRef + ": attack strength=" + attackStrength) wsTrace(" ResolveAttack on " + workshopRef + ": defenseStrength=" + defenseStrength) ; "combat resolution" - each roll 1d100 + strength, if attack > defense that's the damage done. int attackRoll = utility.randomInt() + attackStrength wsTrace(" ResolveAttack on " + workshopRef + ": original attack roll=" + attackRoll) ; don't let attack roll exceed 150 - makes high defense more likely to win attackRoll = math.min(attackRoll, resolveAttackMaxAttackRoll) as int int defenseRoll = utility.randomInt() + defenseStrength wsTrace(" ResolveAttack on " + workshopRef + ": attack roll=" + attackRoll) wsTrace(" ResolveAttack on " + workshopRef + ": defense roll=" + defenseRoll) if attackRoll > defenseRoll attackersWin = true ; limit max damage based on defense - but max can't go below 25 float maxAllowedDamage = math.max(resolveAttackAllowedDamageMin, 100-defenseStrength) wsTrace(" ResolveAttack on " + workshopRef + ": maxAllowedDamage=" + maxAllowedDamage) float damage = math.min(attackRoll - defenseRoll, maxAllowedDamage) ; get current damage - ignore if already more than this attack float currentDamage = workshopRef.GetValue(WorkshopRatings[WorkshopRatingDamageCurrent].resourceValue) if currentDamage < damage wsTrace(" ResolveAttack on " + workshopRef + ": New damage=" + damage) float totalDamagePoints = 0.0 ; now set damage to all the resources totalDamagePoints += SetRandomDamage(workshopRef, WorkshopRatings[WorkshopRatingFood].resourceValue, damage) ; use total rating for food, water, safety, power totalDamagePoints += SetRandomDamage(workshopRef, WorkshopRatings[WorkshopRatingWater].resourceValue, damage) totalDamagePoints += SetRandomDamage(workshopRef, WorkshopRatings[WorkshopRatingSafety].resourceValue, damage) totalDamagePoints += SetRandomDamage(workshopRef, WorkshopRatings[WorkshopRatingPower].resourceValue, damage) totalDamagePoints += SetRandomDamage(workshopRef, WorkshopRatings[WorkshopRatingPopulation].resourceValue, damage) ; now calc total points to get "real" max damage float totalResourcePoints = GetTotalResourcePoints(workshopRef) float maxDamage = 0.0 if totalResourcePoints > 0 maxDamage = totalDamagePoints/totalResourcePoints * 100 endif wsTrace(" ResolveAttack on " + workshopRef + ": Actual max damage=" + maxDamage + "=" + totalDamagePoints + "/" + totalResourcePoints) ; max damage = starting "maximum" damage inflicted by the attack SetResourceData(WorkshopRatings[WorkshopRatingDamageMax].resourceValue, workshopRef, maxDamage) ; current damage starts out at the max, then goes down as repairs are made during the daily update SetResourceData(WorkshopRatings[WorkshopRatingDamageCurrent].resourceValue, workshopRef, maxDamage) else wsTrace(" ResolveAttack on " + workshopRef + ": Current damage=" + currentDamage + ", ignore new damage=" + damage) endif ; in any case, remove resources from container based on current damage if containerRef int stolenFood = math.ceiling(containerRef.GetItemCount(WorkshopConsumeFood) * damage/100) int stolenWater = math.ceiling(containerRef.GetItemCount(WorkshopConsumeWater) * damage/100) int stolenScrap = math.ceiling(containerRef.GetItemCount(WorkshopConsumeScavenge) * damage/100) int stolenCaps = math.ceiling(containerRef.GetItemCount(Game.GetCaps()) * damage/100) wsTrace(" ResolveAttack on " + workshopRef + ": Destroy stored resources: " + stolenFood + " food, " + stolenWater + " water, " + stolenScrap + " scrap, " + stolenCaps + " caps") containerRef.RemoveItem(WorkshopConsumeFood, stolenFood) containerRef.RemoveItem(WorkshopConsumeWater, stolenWater) containerRef.RemoveItemByComponent(WorkshopConsumeScavenge, stolenScrap) containerRef.RemoveItem(Game.GetCaps(), stolenCaps) endif endif return attackersWin endFunction Link to comment Share on other sites More sharing options...
scbfromnc Posted September 16, 2016 Share Posted September 16, 2016 Thanks for your reply. I have no knowledge of scripts so I find this difficult to understand. But between this and a couple of articles I found on Reddit, it seems that attack quests (off stage resolution) calculates attackStrength and defenseStrength. Didn't see attackStrength defined above but it's apparently a function of food+water and randomized number with a maximum of 100. defenseStrength is safety + totalPopulation. Is safety your settlement defense value (turrets, etc)? Apparently defenseStrength is also capped at 100, though I didn't see that listed above. A 1d100 roll is added to each strength value to generate an attackRoll and a defenseRoll. attackRoll is capped at 150. If attackRoll > defenseRoll then attackers win. So this means that if you have maximum defense (population + "safety" = 100) then you have at least a 51% chance of winning (more if attack isn't maximized). Seems like a pretty awkward calculation, but it is what it is. Can anyone confirm that safety is the settlement defense value? If that's true then it makes at least some sense. Sorry for taking up space on this forum for this topic -- it's just that the Bethesda forums are worthless now and this is the only forum where you're discussing something other than PS4 mods and whether we got our moneys worth! Link to comment Share on other sites More sharing options...
Sclerocephalus Posted September 16, 2016 Share Posted September 16, 2016 Just read the notes (all lines starting with a semicolon). They explain most of it. Food, water and other esources have no effect here (they play a role in calculation of chances for an attack though). They only appear in this function when the damage values are calculated. Safety is the defense rating you see in your settlement stats.. Defense strength is not capped at 100, but the sum of safety, total population and a random value ranging from 1-100, so it may exceed 100 (tobviously, the chance increases with your safety rating). Attack strength is capped at 150 however. As the script note says: "don't let attack roll exceed 150 - makes high defense more likely to win". Link to comment Share on other sites More sharing options...
oxhorn Posted September 27, 2016 Share Posted September 27, 2016 I published a video today about attack strength and many of my viewers brought up some good points about this snippet of code that make it hard to truly know how unobserved settlement defense works. attackStrengh = What is this? The formula is undefined in the provided snippet of code. How is attackStrength calculated? I realize that there is a limit--150--but are there other restrictions or amplifications that can alter this, like player level, settlement level (what part of the map is it), etc? defenseStrength = The comment for this line infers that this equals safety + totalPopulation, but without reading this function you don't know if limits are applied, similar to how the attack roll limits. Basically, it looks like defense can be infinitely high, but how do we know there is no hidden limiter that is capping defense strength at, say, 200, or 250? defenseRoll = utility.randomInt() + defenseStrength - My assumption was that it is simple math of adding the Safety value to the totalPopulation value. But I do not know if limits are being applied to the resultant returned value that could possibly bring my defense below an attackers 150 max roll. Attackers strength (undefined here) may also vary by playthrough (type, number, levels, loadout of attackers) These two unknowns are where you will find why you are sometimes loosing these battles. I had one viewer argue that defense is actually capped at 100, using this line of code as evidence, but I do not know where he got it (it is not in the sample you supplied): int Property maxDefenseStrength = 100 const auto Hidden int Function CalculateDefenseStrength(int safety, int totalPopulation) int defenseStrength = Math.min((safety + totalPopulation) as float, maxDefenseStrength as float) as int return defenseStrength EndFunction Naturally, if this code is accurate, would it not mean that settlement defense strength is capped at 100? This would explain why it seems like settlement defense success is a 50/50 chance when you are not present, despite the code giving attackStrength a cap of 150. It effectively gives well-defended settlements a 2-in-3 chance of winning, if true. You can see the video here if you want to read the comments: https://www.youtube.com/watch?v=NFk6D-TGTcQ&t=615s scbfromnc 1 Link to comment Share on other sites More sharing options...
oxhorn Posted September 28, 2016 Share Posted September 28, 2016 I may have found it. One of my viewers extracted the complete WorkshopParentScript and shared it here: http://pastebin.com/j8kuzj4P In there, we find that there actually IS a cap on defense. Attack and defense STRENGTH (not the roll) is capped at 100: int Property maxAttackStrength = 100 const auto Hidden int Property maxDefenseStrength = 100 const auto Hidden (lines 2655 and 2656) The attackRoll and defenseRoll determines the outcome of the battle. The attackStrength is capped at 150. The defenseRoll is capped at 200, as you see here: int defenseRoll = utility.randomInt() + defenseStrength (this is on line 2722) So, settlement defenses and population combined make up defense strength. However, the game limits defense strength to 100. But, it does NOT limit the defense roll to 100. The snippet above shows that defense strength (max 100) is added to a 1d100 roll to determine the defense roll. Thus, the defenseRoll can be no higher than 200, but no lower than 101Knowing this, and knowing that attackRoll can be no higher than 150 and no lower than 25:Maxed out settlements have a 75% chance to win, but a 25% chance to lose.Is that right? Link to comment Share on other sites More sharing options...
scbfromnc Posted September 28, 2016 Share Posted September 28, 2016 This is interesting stuff. In the Reddit article referenced by Oxhorn there are suggestions that the script code is borked. I realize this article was 8 months ago, so the scripts may have been updated by now. Can anyone look at what's going on in the attack quest section and speak to whether the code now looks ok? And if not ok, is this something that can be addressed by a modder? @Oxhorn: Thanks for interpreting this. Not sure if I'm calculating this right, but if attack and defense strength are optimized and limited to 100, then seems that the chance for winning comes down to the random number roll. So wouldn't it be 100 to 50, or 67% chance to win since attackRoll is limited to 150? Link to comment Share on other sites More sharing options...
oxhorn Posted September 28, 2016 Share Posted September 28, 2016 Yes that may be the way it works. I'm horrible at math so I'd love some confirmation on this, but if we're reading this correctly, I think that may be accurate. Link to comment Share on other sites More sharing options...
Cyan_Ian Posted October 1, 2016 Share Posted October 1, 2016 I may have found it. One of my viewers extracted the complete WorkshopParentScript and shared it here: http://pastebin.com/j8kuzj4P In there, we find that there actually IS a cap on defense. Attack and defense STRENGTH (not the roll) is capped at 100: int Property maxAttackStrength = 100 const auto Hidden int Property maxDefenseStrength = 100 const auto Hidden (lines 2655 and 2656) The attackRoll and defenseRoll determines the outcome of the battle. The attackStrength is capped at 150. The defenseRoll is capped at 200, as you see here: int defenseRoll = utility.randomInt() + defenseStrength (this is on line 2722) So, settlement defenses and population combined make up defense strength. However, the game limits defense strength to 100. But, it does NOT limit the defense roll to 100. The snippet above shows that defense strength (max 100) is added to a 1d100 roll to determine the defense roll. Thus, the defenseRoll can be no higher than 200, but no lower than 101 Knowing this, and knowing that attackRoll can be no higher than 150 and no lower than 25: Maxed out settlements have a 75% chance to win, but a 25% chance to lose. Is that right? Defense int Property maxDefenseStrength = 100 const auto Hidden int function CalculateDefenseStrength(int safety, int totalPopulation) int defenseStrength = math.min(safety + totalPopulation, maxDefenseStrength) as int wsTrace(" defenseStrength=" + defenseStrength) return defenseStrength endFunction int defenseStrength = CalculateDefenseStrength(safety, totalPopulation) <--- max defenseStrength is 100 int defenseRoll = utility.randomInt() + defenseStrength <--- Defense roll is 0-100 (100-200@100 total safety + population) Attack int Property maxAttackStrength = 100 const auto Hidden int function CalculateAttackStrength(int foodRating, int waterRating) <--- function called in WorkshopAttackScript, not actually called anywhere in this script (WorkshopParentScript) ; attack strength: based on "juiciness" of target int attackStrength = math.min(foodRating + waterRating, maxAttackStrength) as int <--- max attackStrength is 100 int attackStrengthMin = attackStrength/2 * -1 <--- is a negative number, max -50 (100/2*-1) int attackStrengthMax = attackStrength/2 <--- max 50 (100/2) wsTrace(" Base attackStrength=" + attackStrength) wsTrace(" attack strength variation=" + attackStrengthMin + " to " + attackStrengthMax) attackStrength = math.min(attackStrength + utility.randomInt(attackStrengthMin, attackStrengthMax), maxAttackStrength) as int <--- this bit can be tricky - basically food+water + random int between a max of -50 and 50, at 50 food/water it comes out to -25 to 25 and at 100 food/water it comes out to -50 to 50. Assuming max food/water production, that's 100 + -50-50 or 50-150, or 50-100 due to maxAttackStrength cap. wsTrace(" attackStrength=" + attackStrength) return attackStrength endFunction int attackRoll = utility.randomInt() + attackStrength <--- attackStrength max is random between 50 and 100, so 0-100 + 50-100 (50-200 max attackRoll) int property resolveAttackMaxAttackRoll = 150 auto const <--- caps attackRoll to 150 on the high end attackRoll = math.min(attackRoll, resolveAttackMaxAttackRoll) as int <--- Attack roll is 0-100 (50-150@100 total food/water) due to cap ====================================================================================================================================================== So, if attackRoll (0-100 with no food/water production, 50-150 with max food/water production) > defenseRoll (0-100 with no defense, 100-200 with max defense). If you have no food/water production and no defense of any kind, chance to win is more or less 50/50. I haven't tested this but that's the theory, and it should be easy enough to test using a settlement that produces no food/water but instead gets it through supply lines. I'm not sure if happiness factors into the equation anywhere but it doesn't appear to, though it may skew results so I thought it worth mentioning. If the theory holds weight then that settlement should never lose if total defense is greater than or equal to 100. It seems kind of strange that your chance to win or lose an engagement even factors in food and water production in the first place, but it is what it is. Let us just assume that the greater your production, the greater the number of attackers that will show up to the party to carry it all back... From what I've been able to glean from my examination of these scripts, I've come to the conclusion that having excess food and water production is the main driving force behind winning and losing. With max defense and zero food/water production your chance of success should be roughly 100%. I plugged the numbers into a google spreadsheet complete with random number generation and at 0 food/water with 100 total defense I wasn't able to get anything but a 100% win/loss ratio, however the moment I plugged in one food/water, losses started appearing. So if you want to reduce your failure rate to the minimum, only produce as much food/water as you need, else you're only hurting your chances in the long run. It's also important to point out that the max defense you need is 100 - total population, so if you have 30 people, you only need 70 defense to hit the cap. One interesting note is that guard stations which grant two defense effectively triple the defense value of any given citizen. Just something to consider. The 25 value you're referring to is mininum damage dealt to resources, not a min on the attack roll. As stated previously the minimum attack roll is 0-50(@0 food/water and 100 food/water, respectively). float property resolveAttackAllowedDamageMin = 25.0 auto const ; this is as low as max allowed damage can go Link to comment Share on other sites More sharing options...
scbfromnc Posted October 7, 2016 Share Posted October 7, 2016 @Oxhorn: I just saw your YouTube video, Defense Chance Solved based on some of the discussion in this thread. Thanks for doing the video -- I'm a big fan. I talked with a statistician friend of mine about the probability of successfully defending a settlement if attack and defense strength are maxed out (i.e. 100), and the correct answer I believe is 62.5%. This simple diagram explains the reasoning: With a DefenseRoll of 50 or more it's an automatic win for defense (as shown in black hash region of the diagram). In those cases where the DefenseRoll is less than 50, the defense wins 12.5% of the time as shown in the red hash region. And a total winning chance for defense of 62.5%. As you correctly point out in the video, you can substantially improve odds of defense by managing food and water in the workbench. Link to comment Share on other sites More sharing options...
Cyan_Ian Posted October 7, 2016 Share Posted October 7, 2016 @Oxhorn: I just saw your YouTube video, Defense Chance Solved based on some of the discussion in this thread. Thanks for doing the video -- I'm a big fan. I talked with a statistician friend of mine about the probability of successfully defending a settlement if attack and defense strength are maxed out (i.e. 100), and the correct answer I believe is 62.5%. This simple diagram explains the reasoning: With a DefenseRoll of 50 or more it's an automatic win for defense (as shown in black hash region of the diagram). In those cases where the DefenseRoll is less than 50, the defense wins 12.5% of the time as shown in the red hash region. And a total winning chance for defense of 62.5%. As you correctly point out in the video, you can substantially improve odds of defense by managing food and water in the workbench. Food and water in workbenches have absolutely no bearing on success, only production. Link to comment Share on other sites More sharing options...
Jebbalon Posted October 9, 2016 Share Posted October 9, 2016 I read and looked at all this and couldn't find anything 'wrong' with it.... my knowledge is limited about scripts though. But, here is how I think it works.............. Raiders are raiders and will attack a settlement based on what they observe. If a raider scout reports back that a settlement is empty, has no crops, dead water pumps then the boss will slap him upside the head and say "Well go find me a settlement that actually has something to raid you scumbag!" So the scout heads back out and finds another settlement that is full of people, turrets, crops, lots of power running water purifiers and even some cute kitty cats. He runs back to the boss and one of two things happens. The boss slaps him upside the head saying "We need crops and water, not pissed farmers and holes from turret bullets." ... OR because there is a chance he is sadistic cat hater he might say "Good work lets go!" Resulting in no attack or failed attack from the raider point of view. I suppose there would be a chance the raiders win, but the large settlement will just repair equipment and wounds maybe fortify some more and go on with life. Because they planned well even a successful raider attack will have little to no impact on their settlement. The next day the scout heads back out feeling hungry and determined to find somewhere to raid. He comes upon a juicy little target, a simple farm with good crops, a running generator powering a well maintained water pump in the river. There is only a farmer, his wife, two older children and a old guy, maybe grandpa, that has a shotgun pacing between two makeshift guard stations. Returning to the boss the scout relays what he found. The boss slaps him up side the head and says "Well, where's the loot? Surely you could have handled that farm on your own! Do I have to do everything around here?" Resulting in most likely the raiders roughing up the settlers and taking at least 25 items from the farms stores. This would set them back quite a bit, they would have hard time recovering before the next attack. ... OR there is a chance grandpa and his minutemen buddies were really good with that shotgun and now the farmers have some new 'loot'! I think that covers most of the scenarios right? Link to comment Share on other sites More sharing options...
Relight Posted November 6, 2016 Share Posted November 6, 2016 It would be great if the script would prevent two settlements from being attacked at the same time. This happened to me and I was in Far Harbor at the time. I knew there was no way I could make it to both in time, so I had to choose which one to defend. In general it's a hated, illogical aspect of gameplay, and I'll probably eventually look for one the mods to completely stop settlements from being attacked. Besides the defensive abilities of settlements mentioned in this thread, I see roving bands of my Minutemen all the time, yet they can never respond when a settlement is attacked? As the leader of the Minutemen, for some reason I have to personally respond to every single attack myself? I was hoping attacks would be turned off when I'm "off the map" in Nuka World or Far Harbor, but no... How does that news even reach me?! I get the gameplay aspect of the system, but they really should have had Preston ask you something like, "If we hear about an attack, should we send out the closest Minutemen or notify you personally?" And of course you could go back to him at any time and change your choice. That would have allowed the player who wants to constantly interrupt their questing to help settlements to do so, and allow the rest of us to get on with the game. gameboytj 1 Link to comment Share on other sites More sharing options...
gameboytj Posted November 6, 2016 Share Posted November 6, 2016 Im using a mod where i can control raid chance, the mod changes it from 2% to 25% but i changed it to 0% *snarky laugh* 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