severedsolo

[1.8.x] Oh Scrap!- A ScrapYard based Part Failure and Reliability Mod 2.0.1 (07/12/2019)

Recommended Posts

Just now, severedsolo said:

Basically, assuming that's the actual trait name.

I feel like there is a Repair skill in the game though? Can't remember the exact name, but perhaps that could be leveraged if you didn't want to hardcode.

p.experienceTrait.Effects = "FailureRepairSkill"
  or
p.experienceTrait.Effects = "RepairSkill"

from Squad/Experience/Traits.cfg

Spoiler

EXPERIENCE_TRAIT
{
	name = Engineer
	title = #autoLOC_500103 //#autoLOC_500103 = Engineer
	desc = #autoLOC_500104 //#autoLOC_500104 = Engineers are capable of repairing broken parts, if at all possible.

	EFFECT
	{
		name = RepairSkill
	}
	EFFECT
	{
		name = ConverterSkill
	}
	EFFECT
	{
		name = DrillSkill
	}
	EFFECT
	{
		name = FailureRepairSkill
	}
	EFFECT
	{
		name = GeeForceTolerance
		modifiers = 1.1, 1.2, 1.3, 1.4, 1.5
	}
	EFFECT
	{
		name = EVAChuteSkill
		level = 1
	}	
}

 

should just be swapping the one line of code for the other; am leaning toward FailureRepairSkill rather than RepairSkill. Don't know if their is any difference.

Share this post


Link to post
Share on other sites
Just now, zer0Kerbal said:

should just be swapping the one line of code for the other; am leaning toward FailureRepairSkill rather than RepairSkill. Don't know if their is any difference.

I think FailureRepair is something to do with Missions. As far as I can tell, it doesn't actually do anything in game. Chutes and Wheels use RepairSkill IIRC (I was looking at this a couple of weeks ago for a different project).

Looks like MKS Mechanics have the RepairSkill but not FailureRepairSkill so if you were to do that (and I agree it would make sense) it would need to be patched in.

Share this post


Link to post
Share on other sites
Posted (edited)
2 minutes ago, severedsolo said:

I think FailureRepair is something to do with Missions. As far as I can tell, it doesn't actually do anything in game. Chutes and Wheels use RepairSkill IIRC (I was looking at this a couple of weeks ago for a different project).

Looks like MKS Mechanics have the RepairSkill but not FailureRepairSkill so if you were to do that (and I agree it would make sense) it would need to be patched in.

patching is easy. :D

FailureRepairSkill it will be: unless reason not to is brought up - also providing I can determine the code needed to implement.

currently:

if (p.experienceTrait.Description == "FailureRepairSkill")

wait - it is a list so would have to step through it somehow -

Spoiler

public List<ExperienceEffect> Effects { get; }

 

 

Edited by zer0Kerbal

Share this post


Link to post
Share on other sites

so this looks promising

Spoiler

                    for(int ii = 0; ii < p.experienceTrait.Effects.Count(); ii++)
                        if  (p.experienceTrait.Effects[ii].Name == "FailureRepairSkill")
                        {
                            repairChance += p.experienceLevel * 0.1f;
                            break;
                    }

 

 

Share this post


Link to post
Share on other sites
Posted (edited)

this new method also gives access to:

p.experienceTrait.Effects[ ].Level
p.experienceTrait.Effects[ ].LevelModifiers

so this is the end result *fingers crossed*

Spoiler

                    ProtoCrewMember p = FlightGlobals.ActiveVessel.GetVesselCrew().ElementAt(i);
                    for(int ii = 0; ii < p.experienceTrait.Effects.Count(); ii++)
                        if  (p.experienceTrait.Effects[ii].Name == "FailureRepairSkill")
                        {
                            if (p.experienceTrait.Effects[ii].LevelModifiers.Length > 0)
                            { 
                                repairChance += p.experienceTrait.Effects[ii].LevelModifiers[p.experienceLevel];
                                Debug.Log(String.Format("[OhScrap]: name {0) experiencetrait {1) level {2) modifier {3)", p.name, p.experienceTrait.ToString(), p.experienceLevel.ToString(), p.experienceTrait.Effects[ii].LevelModifiers[p.experienceLevel].ToString()));
                            }
                            else repairChance += p.experienceLevel * 0.1f;
                            break;
                    }

 

I will put it on  It is now on Github as a special build for @Dirk to beta test. Includes new patch for Mechanics (and Engineers). Feedback requested, will not proceed without it.

@Dirk kindly put in an issue request (feature request) in GitHub for this.

 

***

Open beta for KSP 1.9.1 coming soon.

Like now:

https://github.com/zer0Kerbal/OhScrap/releases/tag/2.1.0.0

SOURCE: GitHub
License:
68747470733a2f2f696d672e736869656c64732e

Edited by zer0Kerbal

Share this post


Link to post
Share on other sites

Pretty neat experience I had with OhScrap: Gear failed in flight, so I wound up gliding my SSTO to a very low speed water landing, with total sucess.

Share this post


Link to post
Share on other sites
1 hour ago, dlrk said:

Pretty neat experience I had with OhScrap: Gear failed in flight, so I wound up gliding my SSTO to a very low speed water landing, with total sucess.

nice!

so I take it that Mechanics are happier in your version? If so I will add it to the next release.

Share this post


Link to post
Share on other sites
Posted (edited)
PRE-RELEASE
DO NOT USE ON LIVE SAVES!
YOU.HAVE.BEEN.WARNED.
 
OPEN BETA

@zer0Kerbal zer0Kerbal released this 12 Mar 2020

Version 2.1.1.0

More ways to Fail, and more Kerbals allowed to fix it

  • folder restructuring
  • improved workflow
  • added 'Validate AVC .version files' workflow by @ DasSkelett (thank you @hebar)
Allow 'Mechanics' from USI to affect effets
  • suggested by @dirk
  • current code allowed Engineers (and only Engineers) a bonus to repairs
  • adjusted code to allow any Kerbal with the "FailureRepairSkill" to receive a bonus to repairs
  • FailureRepairSkill is a Stock skill that all Engineers have
  • added a patch that adds FailureRepairSkill to USI MKS Mechanics
  • easy to add "FailureRepairSkill" to other careers if requested by users
New parts can fail!
  • Implement engine under-thrust/under-Isp failures in a way that doesn't depend on thrust limiter.
  • thank you to @bfrobin446
  • code from TestFlight (thank you @Agathorn @linuxgurugamer and et al)
  • section covering this code (CC BY-NC-SA 4.0) inserted into license file
Edited by zer0Kerbal

Share this post


Link to post
Share on other sites
Posted (edited)

New Thread Here

Development thread for both OhScrap! and ScrapYard (new betas (if any) will be posted there)

 

Edited by zer0Kerbal

Share this post


Link to post
Share on other sites

I couldn't find any information about it but, do parts still get worse after they're not new, like the bathtub curve? And if so, is there a way to disable that?

Share this post


Link to post
Share on other sites
35 minutes ago, gooseapple5 said:

I couldn't find any information about it but, do parts still get worse after they're not new, like the bathtub curve? And if so, is there a way to disable that?

better to ask at the new thread:

 

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.