FreeOrion

Forums for the FreeOrion project
It is currently Wed Dec 13, 2017 8:32 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Mon Sep 11, 2017 11:30 am 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 708
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:
((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.


Top
 Profile  
 
PostPosted: Mon Sep 11, 2017 12:00 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12041
Location: Munich
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.


Top
 Profile  
 
PostPosted: Mon Sep 11, 2017 12:26 pm 
Offline
Vacuum Dragon
User avatar

Joined: Sun Sep 25, 2011 2:51 pm
Posts: 500
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


Top
 Profile  
 
PostPosted: Mon Sep 11, 2017 6:05 pm 
Offline
Release Manager, Design
User avatar

Joined: Wed Nov 16, 2011 12:56 pm
Posts: 4289
Location: Sol III
em3 wrote:
Also, you wrote "doonsday" in topic title.
Fixed. ;)


Top
 Profile  
 
PostPosted: Mon Sep 11, 2017 7:11 pm 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4390
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


Top
 Profile  
 
PostPosted: Mon Sep 11, 2017 7:15 pm 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4390
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


Top
 Profile  
 
PostPosted: Mon Sep 11, 2017 7:58 pm 
Offline
AI Contributor

Joined: Tue Feb 17, 2015 11:54 am
Posts: 224
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


Top
 Profile  
 
PostPosted: Mon Sep 11, 2017 9:16 pm 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4390
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


Top
 Profile  
 
PostPosted: Tue Sep 12, 2017 12:35 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 708
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.


Top
 Profile  
 
PostPosted: Tue Sep 12, 2017 2:38 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 708
I've created a "DOOMSDAY_WEAPON_UNLOCK" and made it a prerequisite for the current doomsday weapons. With
Code:
((GameRule name = "RULE_ENABLE_DOOMSDAY_WEAPONS") > 0)
I can check for the game rule, and with
Code:
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.


Top
 Profile  
 
PostPosted: Tue Sep 12, 2017 6:26 pm 
Offline
AI Contributor

Joined: Tue Feb 17, 2015 11:54 am
Posts: 224
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


Top
 Profile  
 
PostPosted: Wed Sep 13, 2017 12:18 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 708
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group