Jump to content

Recommended Posts

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

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 by Ser
Link to comment
Share on other sites

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

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

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

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...