I'm trying to add a game rule to allow the player to deactivate doomsday weapons. I've added a new rule to game_rules.focs.txt, and had thought to use this rule to remove the nova bomb and planet destroyer techs by checking for

You can modify the cost or research time of a tech using a GameRule lookup, but there's no way to modify or add an Unresearchable tag. For other content, which has a location condition, you can add the GameRule lookup and comparison to effectively make something unusable or not appear.

Geoff the Medio wrote:You can modify the cost or research time of a tech using a GameRule lookup, but there's no way to modify or add an Unresearchable tag. For other content, which has a location condition, you can add the GameRule lookup and comparison to effectively make something unusable or not appear.

Seems like it would probably be ideal, at least in the long run, to be able to make techs unreasearchable based on GameRules. In the interim, to expand on Geoff's suggestion a bit, how is this for a workaround: The tech description notes that the significance and cost of the tech is gated by the GameRule (ideally the description would actually totally change based on the GameRule, but I'm not able to think of a way to accomplish that right now). The Location availability of any parts/buildings enabled by the tech would have a clause for the GameRule, and to help emphasize the unavailability perhaps the time and cost should be made astronomical if the GameRule is Off as well. The tech itself, though should perhaps rather be free if the GameRule is off, rather than being astronomical, since unlike with the parts/buildings the only way I can think of to fully prevent them from wasting points put into researching the tech is to set the tech cost to zero.

If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Dilvish wrote:unlike with the parts/buildings the only way I can think of to fully prevent them from wasting points put into researching the tech is to set the tech cost to zero.

Oops, I think I may have just thought of a better way-- if the GameRule is Off then we do set the tech cost to be very high (higher than anything else that is researchable so it won't get prematurely swept up into the auto-research fallback), but we increase the minimum time even tremendously more, so that even if they tried researching it they could not put more than a small fraction of a point into it each turn.

If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

How about adding a unresearchable trigger tech that is given on turn 1 by an effects group if the game rule is set to allow doomsday weapons. The real tech has that tech as (additional) prerequisite and would thus effectively be unresearchable.

This has the additional benefit of hiding the tech in the tech window.

If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Morlic wrote:How about adding a unresearchable trigger tech that is given on turn 1 by an effects group if the game rule is set to allow doomsday weapons. The real tech has that tech as (additional) prerequisite and would thus effectively be unresearchable. This has the additional benefit of hiding the tech in the tech window.

That does indeed sound like the best idea yet, within current scripting constraints.

If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Morlic wrote:How about adding a unresearchable trigger tech that is given on turn 1 by an effects group if the game rule is set to allow doomsday weapons. The real tech has that tech as (additional) prerequisite and would thus effectively be unresearchable.

Sounds good, I'll try that. Thanks for the suggestions.

If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.