Warezcrawler Posted April 8, 2016 Share Posted April 8, 2016 I'm looking for a way to evaluate if a specific technology have been researched, so that I can have som module behavior depend on that information. However, I just can figure out exactly how to do that. I've tried thing like the following. ResearchAndDevelopment.Instance.GetTechState("basicRocketry") But all I get is null ref errors. Does anybody know how to get that information? Maybe even a list of all researched tech? Link to comment Share on other sites More sharing options...
Ser Posted April 8, 2016 Share Posted April 8, 2016 (edited) 29 minutes ago, Warezcrawler said: I'm looking for a way to evaluate if a specific technology have been researched, so that I can have som module behavior depend on that information. However, I just can figure out exactly how to do that. I've tried thing like the following. ResearchAndDevelopment.Instance.GetTechState("basicRocketry") But all I get is null ref errors. Does anybody know how to get that information? Maybe even a list of all researched tech? Have you tried ResearchAndDevelopment.GetTechnologyState ? Or GameEvents.OnTechnologyResearched.Add(yourCallbackFunction); ... void yourCallbackFunction(GameEvents.HostTargetAction<RDTech, RDTech.OperationResult> targetAction) { if (RDTech.OperationResult.Successful.Equals(targetAction.target) && ( targetAction.host.techId.Equals("basicRocketry") )) { //your code } to catch an event at the moment when a technology is researched? Edited April 8, 2016 by Ser Link to comment Share on other sites More sharing options...
Warezcrawler Posted April 8, 2016 Author Share Posted April 8, 2016 19 minutes ago, Ser said: Have you tried GameEvents.OnTechnologyResearched.Add(yourCallbackFunction); ... void yourCallbackFunction(GameEvents.HostTargetAction<RDTech, RDTech.OperationResult> targetAction) { if (RDTech.OperationResult.Successful.Equals(targetAction.target) && ( targetAction.host.techId.Equals("basicRocketry") )) } ? Thanks for replying. However, I'm not sure if I get the code you propose. So add some event callback for when a technology is researched? I'm not even sure what all the arguments are? As far as I can get from it, the callback will do a check of the tech just researched againt the one I would specify. However, how can I use this for my module when I later try and change the module behavior when flying around the Mün? Link to comment Share on other sites More sharing options...
Ser Posted April 8, 2016 Share Posted April 8, 2016 1 minute ago, Warezcrawler said: Thanks for replying. However, I'm not sure if I get the code you propose. So add some event callback for when a technology is researched? I'm not even sure what all the arguments are? As far as I can get from it, the callback will do a check of the tech just researched againt the one I would specify. However, how can I use this for my module when I later try and change the module behavior when flying around the Mün? Call static ResearchAndDevelopment.GetTechnologyState("basicRocketry"), not on the instance. That works. But I'm not sure what those states mean. Link to comment Share on other sites More sharing options...
Warezcrawler Posted April 8, 2016 Author Share Posted April 8, 2016 33 minutes ago, Ser said: Call static ResearchAndDevelopment.GetTechnologyState("basicRocketry"), not on the instance. That works. But I'm not sure what those states mean. Thanks Ser.... I was hoping for a function that would yield a bool value, but this should work as well. Initial test shows that it returns "Available" or "Unavailable", which should be fine for my needs. 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