How to create an EffectsGroup that applies to no object?

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

Moderators: Oberlus, Committer

Post Reply
Message
Author
User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

How to create an EffectsGroup that applies to no object?

#1 Post by adrian_broher »

The title already says it. Is it possible to create an EffectsGroup that isn't applied to any object?

I could create a "None" condition in C++, but shouldn't

Code: Select all

EffectsGroup
    scope = <some scope>
    activation = NOT ALL
    effects = <some effect>
do the trick?
Last edited by adrian_broher on Tue Jul 14, 2015 9:10 pm, edited 1 time in total.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

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

Re: How to create an EffectsGroup, that applies to no object

#2 Post by Geoff the Medio »

Depends exactly what you want to do...

Setting the activation to Not All or Not Source should work, I think, but then the scope condition will not be evaluated at all.

If you leave out the activation or set it to Source or All, then the scope will be evaluated, which you could set to Not All to matching nothing.

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

Re: How to create an EffectsGroup, that applies to no object

#3 Post by Dilvish »

Expanding slightly on Geoff's answer, keep in mind how the Universe code processes EffectsGroups-- it first goes through and finds a class of objects that qualify as sources for the current set of EffectsGroups (from species.txt, from buildings.txt, etc). If there is no source object for the EffectsGroup then nothing more happens there. Then it checks the scope clauses for objects meeting them (targets). If it finds no target objects then nothing more is done either.

If, however, by 'applies to' you meant 'changes', then there are examples for you at least with the SitRep generators:

Code: Select all

        EffectsGroup
            scope = Source
            activation = Turn high = 1
            effects = [
                GenerateSitRepMessage
                    message = "SITREP_WELCOME"
                    icon = "icons/specials_huge/ancient_ruins.png"
                    empire = Source.Owner
                ]
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
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: How to create an EffectsGroup, that applies to no object

#4 Post by Geoff the Medio »

Expanding slightly on Dilvish's expansion, it also checks activation conditions, if present, against all the source objects, and only checks scope conditions for sources that meet an effectsgroup's activation condition.

Also, effects could be constructed that do nothing, in the sense of "SetTargetPopulation value = Value". And if "isn't applied to any object" means just "doesn't modify a UniverseObject" then the SetEmpireMeter effects would also qualify, along with a few others like GiveEmpireTech or SetEmpireTechProgress.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: How to create an EffectsGroup, that applies to no object

#5 Post by adrian_broher »

Geoff the Medio wrote:Depends exactly what you want to do...
I want to add some EffectsGroups that should do literally nothing. For example all the 'NO_{INDUSTRY,GROUND_TROOPS,…} string substitutions within the species definitions currently are empty strings. For the thing I want to achieve those substitutions should should contain an EffectsGroup which does not modify any Universe object. I thought this could be achieved best by letting the activation condition not match to any object in the universe.
Geoff the Medio wrote:Setting the activation to Not All or Not Source should work, I think, but then the scope condition will not be evaluated at all.
For my use case this would be ideal.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

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

Re: How to create an EffectsGroup, that applies to no object

#6 Post by Dilvish »

adrian_broher wrote:For the thing I want to achieve...
I think it will be pretty hard to help any more without more info about the real objective.
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
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: How to create an EffectsGroup, that applies to no object

#7 Post by adrian_broher »

Dilvish wrote:I think it will be pretty hard to help any more without more info about the real objective.
I want to move the perk description from the species gameplay description inside the string table to the EffectsGroup, that defines those perks. This should avoid outdated descriptions depending on language file. Some perks like 'No ground troops' are just defined by the absence of an EffectsGroup. To circumvent this I wanted to create EffectsGroups that do nothing but still can contain a description.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

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

Re: How to create an EffectsGroup, that applies to no object

#8 Post by Dilvish »

adrian_broher wrote:I want to move the perk description from the species gameplay description inside the string table to the EffectsGroup, that defines those perks. This should avoid outdated descriptions depending on language file. Some perks like 'No ground troops' are just defined by the absence of an EffectsGroup. To circumvent this I wanted to create EffectsGroups that do nothing but still can contain a description.
Hmm, if you're thinking of trying to piggy back this onto the 'Automatically Generate Effects Descriptions' (or whatever that setting is called), I think you'll find that species in particular get quite bogged down with Effects.

I suppose you could look to implement a new kind of Effect (only having it fire on turn 0 or 1 or whatever), akin to the GenerateSitrepMessage Effect, but instead a GeneratePediaEntry Effect, with some kind of pattern to the name of the entry, and the species pages could be set to scan the pedia for any entries meeting their pattern, and directly incorporate that material into the main species page.
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
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: How to create an EffectsGroup that applies to no object?

#9 Post by adrian_broher »

Dilvish wrote:Hmm, if you're thinking of trying to piggy back this onto the 'Automatically Generate Effects Descriptions' (or whatever that setting is called), […]
No, that's not my intention. The automatic generate efffects description concept is broken anyway.
Dilvish wrote:I suppose you could look to implement a new kind of Effect (only having it fire on turn 0 or 1 or whatever), akin to the GenerateSitrepMessage Effect, but instead a GeneratePediaEntry Effect, with some kind of pattern to the name of the entry, and the species pages could be set to scan the pedia for any entries meeting their pattern, and directly incorporate that material into the main species page.
No, creating a new effect is a completely orthogonal to what I want to achieve. Also it doesn't document the intent of the EffectsGroup like

Code: Select all

EffectsGroup
    target = <the target>
    activation = Not All
    effects = DoSomethingEquivalentToTheEffectsGroupIntent value = Value * 1.0
would.

I already have a working implementation ready, but thanks for your concerns.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

Post Reply