Page 1 of 1

game rule to disallow doomsday weapons

Posted: Mon Sep 11, 2017 11:30 am
by The Silent One
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

Code: Select all

((GameRule name = "RULE_ENABLE_DOOMSDAY_WEAPONS") > 0)
in the tech script file. Is that already possible somehow?

Re: game rule to disallow doonsday weapons

Posted: Mon Sep 11, 2017 12:00 pm
by Geoff the Medio
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.

Re: game rule to disallow doonsday weapons

Posted: Mon Sep 11, 2017 12:26 pm
by em3
Also, you wrote "doonsday" in topic title.

Re: game rule to disallow doonsday weapons

Posted: Mon Sep 11, 2017 6:05 pm
by Vezzra
em3 wrote:Also, you wrote "doonsday" in topic title.
Fixed. ;)

Re: game rule to disallow doonsday weapons

Posted: Mon Sep 11, 2017 7:11 pm
by Dilvish
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.

Re: game rule to disallow doonsday weapons

Posted: Mon Sep 11, 2017 7:15 pm
by Dilvish
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.

Re: game rule to disallow doomsday weapons

Posted: Mon Sep 11, 2017 7:58 pm
by Morlic
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.

Re: game rule to disallow doomsday weapons

Posted: Mon Sep 11, 2017 9:16 pm
by Dilvish
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.

Re: game rule to disallow doomsday weapons

Posted: Tue Sep 12, 2017 12:35 pm
by The Silent One
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.

Re: game rule to disallow doomsday weapons

Posted: Tue Sep 12, 2017 2:38 pm
by The Silent One
I've created a "DOOMSDAY_WEAPON_UNLOCK" and made it a prerequisite for the current doomsday weapons. With

Code: Select all

((GameRule name = "RULE_ENABLE_DOOMSDAY_WEAPONS") > 0)
I can check for the game rule, and with

Code: Select all

effects = GiveEmpireTech name = "DOOMSDAY_WEAPON_UNLOCK"
I can activate the tech. However, I don't know 1) where to put the FOCS code and (2) how to achieve that it's executed.

Re: game rule to disallow doomsday weapons

Posted: Tue Sep 12, 2017 6:26 pm
by Morlic
The Silent One wrote:I don't know 1) where to put the FOCS code and (2) how to achieve that it's executed.
You could add the effects group to a tech that is given at game start to all empires (see scripting\starting_unlocks\items.inf).

Re: game rule to disallow doomsday weapons

Posted: Wed Sep 13, 2017 12:18 pm
by The Silent One
Morlic wrote:You could add the effects group to a tech that is given at game start to all empires (see scripting\starting_unlocks\items.inf).
Thank you.