game rule to disallow doomsday weapons

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderator: Committer

Post Reply
Message
Author
User avatar
The Silent One
Graphics
Posts: 713
Joined: Tue Jul 01, 2003 8:27 pm

game rule to disallow doomsday weapons

#1 Post by The Silent One » Mon Sep 11, 2017 11:30 am

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?
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12287
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: game rule to disallow doonsday weapons

#2 Post by Geoff the Medio » Mon Sep 11, 2017 12:00 pm

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.

User avatar
em3
Vacuum Dragon
Posts: 512
Joined: Sun Sep 25, 2011 2:51 pm

Re: game rule to disallow doonsday weapons

#3 Post by em3 » Mon Sep 11, 2017 12:26 pm

Also, you wrote "doonsday" in topic title.
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556

User avatar
Vezzra
Release Manager, Design
Posts: 4686
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: game rule to disallow doonsday weapons

#4 Post by Vezzra » Mon Sep 11, 2017 6:05 pm

em3 wrote:Also, you wrote "doonsday" in topic title.
Fixed. ;)

User avatar
Dilvish
AI Lead, Programmer
Posts: 4733
Joined: Sat Sep 22, 2012 6:25 pm

Re: game rule to disallow doonsday weapons

#5 Post by Dilvish » Mon Sep 11, 2017 7:11 pm

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

User avatar
Dilvish
AI Lead, Programmer
Posts: 4733
Joined: Sat Sep 22, 2012 6:25 pm

Re: game rule to disallow doonsday weapons

#6 Post by Dilvish » Mon Sep 11, 2017 7:15 pm

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

Morlic
AI Contributor
Posts: 252
Joined: Tue Feb 17, 2015 11:54 am

Re: game rule to disallow doomsday weapons

#7 Post by Morlic » Mon Sep 11, 2017 7:58 pm

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

User avatar
Dilvish
AI Lead, Programmer
Posts: 4733
Joined: Sat Sep 22, 2012 6:25 pm

Re: game rule to disallow doomsday weapons

#8 Post by Dilvish » Mon Sep 11, 2017 9:16 pm

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

User avatar
The Silent One
Graphics
Posts: 713
Joined: Tue Jul 01, 2003 8:27 pm

Re: game rule to disallow doomsday weapons

#9 Post by The Silent One » Tue Sep 12, 2017 12:35 pm

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.

User avatar
The Silent One
Graphics
Posts: 713
Joined: Tue Jul 01, 2003 8:27 pm

Re: game rule to disallow doomsday weapons

#10 Post by The Silent One » Tue Sep 12, 2017 2:38 pm

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.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

Morlic
AI Contributor
Posts: 252
Joined: Tue Feb 17, 2015 11:54 am

Re: game rule to disallow doomsday weapons

#11 Post by Morlic » Tue Sep 12, 2017 6:26 pm

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).
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
The Silent One
Graphics
Posts: 713
Joined: Tue Jul 01, 2003 8:27 pm

Re: game rule to disallow doomsday weapons

#12 Post by The Silent One » Wed Sep 13, 2017 12:18 pm

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.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

Post Reply