FreeOrion

Forums for the FreeOrion project
It is currently Sun Dec 17, 2017 5:25 pm

All times are UTC




Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Fri Sep 23, 2016 7:40 pm 
Offline
Space Kraken

Joined: Mon Nov 16, 2015 5:57 am
Posts: 105
Geoff the Medio wrote:
xlightwavex wrote:
tag = "empire" data = Source.Owner
tag = "target_empire ?" data = Target.Owner
There was something that I think does what you want for that added a while ago:

https://github.com/freeorion/freeorion/ ... baa278be12

but I don't think it's been used. From what I can see, you'd specify tag = "source" and tag = "target" in the script, and then put %empire:source% and %empire:target% in the stringtable. Haven't tested this, though.

Edit: this post has an example in the test patch: viewtopic.php?f=9&t=8819&p=69183#p69183


Worked re-posted the reflected changes in the previously posted script.

Note for reference: the tag inputs are custom named now.
Code:
tag = "source" data = Source.Owner
tag = "target" data = Target.Owner

EFFECT_PLANETARY_GUN_FULL
The %empire:source% %building% at %planet% fired on the %empire:target% ship %ship% causing %rawtext% damage.

or

tag = "InitiatingAction" data = Source.Owner
tag = "RecievingAction" data = Target.Owner

EFFECT_PLANETARY_GUN_FULL
The %empire:InitiatingAction% %building% at %planet% fired on the %empire:RecievingAction% ship %ship% causing %rawtext% damage.

either way you must know the keyword in the en.txt file is empire that relates to owner.


argg but i think i broke the stacking group now somehow which is weird because to me it looks like that should be working.


Last edited by xlightwavex on Sat Sep 24, 2016 6:11 am, edited 3 times in total.

Top
 Profile  
 
PostPosted: Fri Sep 23, 2016 8:47 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12045
Location: Munich
Another thing to consider is not having separate effectsgroups for damage and destroy, but instead have one that does one or the other action depending on the targets' structure at the effect execution stage. The If effect takes a condition parameter, and filters the targets with that condition, and then can specify effects = [list-of-effects] for targets that do and else = [list-of-effects] for targets that don't.


Top
 Profile  
 
PostPosted: Sat Sep 24, 2016 4:02 am 
Offline
Space Kraken

Joined: Mon Nov 16, 2015 5:57 am
Posts: 105
Geoff the Medio wrote:
Another thing to consider is not having separate effectsgroups for damage and destroy, but instead have one that does one or the other action depending on the targets' structure at the effect execution stage. The If effect takes a condition parameter, and filters the targets with that condition, and then can specify effects = [list-of-effects] for targets that do and else = [list-of-effects] for targets that don't.
Wait whatttt !

I had no idea the if could do that, from the scripting page i got the impression it only was used to return a value 1 or 0 for use only in math assignments. That would work perfectly if i could switch effects with it but im clueless.
Quote:
List
The available statistical calculations that can be performed on the property values of objects matching the sampling condition are:
If - Returns 1 if at least one object matches the selection condition, or 0 otherwise
Count - Returns the number of objects that match the selection condition

But how does it look/work in script.
Code:
if( structure > 5 )   
{ Effect_A(); }
else
{ Effect_B(); }

if condition = structure low = 5 and[effect? ] Else ? [ effect? ] ? im lost.

What is the syntax of a if statement in script, i don't think i've even seen one used yet ?
How do i identify between two different effects if they both use ... effect = [ ... ] ?
Then call to one or the other syntax wise from the if ?

Can you show me a example ?


Ah almost forgot, a unrelated question as well.
Do buildings ships ect... have a age variable that can be matched on, i.e. turns since they were created, similar to CurrentTurn so i could do something like Age low = 3. ?


Top
 Profile  
 
PostPosted: Sat Sep 24, 2016 6:17 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12045
Location: Munich
https://github.com/freeorion/freeorion/ ... s.txt#L212

https://github.com/freeorion/freeorion/ ... cs.txt#L35


Top
 Profile  
 
PostPosted: Sun Sep 25, 2016 6:24 am 
Offline
Space Kraken

Joined: Mon Nov 16, 2015 5:57 am
Posts: 105
Geoff the Medio wrote:
https://github.com/freeorion/freeorion/blob/master/default/scripting/specials/ANCIENT_RUINS.focs.txt#L212

https://github.com/freeorion/freeorion/ ... cs.txt#L35


Thanks geoff that's awesome, took a minute to figure it out. I think im finally sort of starting to get the hang of this though.

I put the current code at the very top of the very first post, so it's easy to re-post it and see it.

I got slowed down because i broke my test game by changing the en.txt file names.
That's why i didn't fire back any questions for a bit.
I still have to test more stuff, to find the next problem.
[i]


Ok im stumped the message fires but setstructure isnt doing anything now, So im getting a message about doing damage but not actually doing any >

Code:
effects =
      [
             
         SetStructure value = Value -((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
         SetFuel value = Value -(.5+ Target.MaxFuel / 5)
          //   
         // msg to the player firing the gun
         GenerateSitrepMessage
            message = "EFFECT_PLANETARY_GUN_HIT"
            label = "EFFECT_PLANETARY_GUN_LABEL"
            icon = "icons/meter/damage.png"
            parameters =
            [
               tag = "planet" data = Source.PlanetID
               tag = "building" data = Source.ID
               tag = "rawtext" data = ((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
               //tag = "source" data = Source.Owner
               tag = "target" data = Target.Owner
               tag = "empire" data = Target.Owner
               tag = "ship" data = Target.ID
            ]
            empire = Source.Owner
          //   
         // msg to the player that was hit
         GenerateSitrepMessage
            message = "EFFECT_PLANETARY_GUN_HIT_ME"
            label = "EFFECT_PLANETARY_GUN_LABEL"
            icon = "icons/meter/damage.png"
            parameters =
            [
               tag = "planet" data = Source.PlanetID
               tag = "building" data = Source.ID
               tag = "rawtext" data = ((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
               tag = "source" data = Source.Owner
               //tag = "target" data = Target.Owner
               //tag = "empire" data = Target.Owner
               tag = "ship" data = Target.ID
            ]
            empire = Target.Owner
      ]


Top
 Profile  
 
PostPosted: Sun Sep 25, 2016 11:24 am 
Offline
Content Scripter
User avatar

Joined: Sat Mar 17, 2007 12:28 am
Posts: 685
I don't want to spoil the scripting fun here, but a defensive building that can be build on every planet can be quite a micromanagement-pain.

What do you plan to do to mitigate this problem?

_________________
All released under the GNU GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0 licences.


Top
 Profile  
 
PostPosted: Sun Sep 25, 2016 5:35 pm 
Offline
Space Kraken

Joined: Mon Nov 16, 2015 5:57 am
Posts: 105
Sloth wrote:
I don't want to spoil the scripting fun here, but a defensive building that can be build on every planet can be quite a micromanagement-pain.

What do you plan to do to mitigate this problem?


First off this is not actually purely a defensive building as it is. It is possible to build it on a outpost in a enemy system to harass with it as it currently has been made..

Then to answer the main question. Provided this is a actual problem under the current game meta, and that if it were not just for my own personal use atm, as well as a way to learn scripting.
Then it seems to me there is a ton of non military buildings currently, i don't want to do the micro that i do now. We have to micro military buildings like elevators, docks, lighthouses, the industry building, the local tavern (ok its not that bad), But click spamming crappy little troop ships is more 'cost effective' then having a capital sized dedicated troop ship drop troop pods, Might be ok vs a outpost but for a planet that has been around for 20 turns that has to grow its troops these things just produce them. Yet that's how it is and that, is really really tedious (if that is not a build micro i dunno what is).

In effect this is a anti micro mechanism against small cheap troop ships spammed all over the place.
It also works against the idea of fleet repair en mass in a enemy system which breaks expectations.

In short however this is planned for me to be used as a just one of many tactical additions and changes. This one is intended for use, in specific places early to mid game. Especially for people who just don't want cheap troop ship spam. Later it probably wont matter much as you have bigger fleets and at 5 or 6 guns in the largest systems maximum, then is not enough to stop even a sneak attack. I don't like (mindless click micro, unit macro spam, when i click build i want to feel like its a choice, just like i do in the tech tree).

So is it a current concern ? As i was asked to addressed it though, ill give it a shot.
(remember with out any micro its boring, too much its tedious)

There are two primary ways to categorize the removal of micro logically.

1) Automate it.
This falls into the realm of ai or programming this tends to remove micro entirely.
(One exception is 'focus' which is a excellently implemented example of both micro and macro balanced. Conversely however bad examples are, the industry building it is build micro, that should be auto built by industry focus, While mines are instant built every-were macro via one click on a tech).

2) Cost.
Make choosing to build or not build something, a choice that isn't to be taken lightly. e.g. If i die every game i just spam a thing, then ill learn not to.
(The cost vs value needs to be considered. The implementation can be creative, typically you make it better at a higher cost, but this can be in any form you can think up).


Alternate ways to think of cost or restriction:

Say you have to already build something to get something else. This is how tech works, but it could be given by some other building that you already have to micro build, maybe one you really don't want too, in order to make it feel less tedious, like a (lighthouse or scanner) or (industry factory). There are other ways to make things have a cost. You could have to build a System military factory on just one planet, That might automatically provide a gun per planet this might have a high cost but be worth it only in certain places of high value. Maybe the gun requires a lighthouse a scanner and a industry or space elevator or drydock maybe all of them or some combination of them to be built on a planet. In that it is a restriction and the cost to spam it is to have unnecessary things making it 'really' have a cost.

It might only be built in the presence of something else, that you normally don't build many of at because you don't need more then one. This makes it a cost of being, tactically dependent and strategically planned for. This need not be a building either in that way you might have even less of them even as backup.
e.g.
That could be a ship that has a very expensive construction part on it were you cannot initiate building unless its present. So that you can't even build the gun unless that ship is in the system, were you don't build a ton of the construction ships because it would put you behind and make you vulnerable. So that the cost becomes your decision vs the other guys.

However this is a gun that is a military investment it gets stronger over time. As such i planned to have it come out early were you don't have much to build on each planet and not rely on a construction ship (Edit: though maybe that would be a cool idea and interesting to script). Cheap tech wise, building the gun itself will have the cost. It would also make focusing on non aggressive expansion a bit more viable early game.

And right now i can't get it to work right anyways.


Last edited by xlightwavex on Mon Sep 26, 2016 12:54 am, edited 3 times in total.

Top
 Profile  
 
PostPosted: Sun Sep 25, 2016 9:22 pm 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 28, 2013 11:45 pm
Posts: 3295
xlightwavex wrote:
Then to answer the main question. Provided this is a actual problem under the current game meta, and that if it were not just for my own personal use atm, as well as a way to learn scripting.

That's cool, working out how to do something like this is fine just to learn, and I definitely want to encourage more scripters. Plus, it might sort of fit into some nascent ideas I've had for giving some buildings a tag like "megastructure" and having some way to limit the number of them you can build per planet—you can build your Gun on Ice Planet Zero, but that planet then can't have other things and/or those other things are more expensive.

Plus, I'd insist this sort of thing were balanced by, for example, having a massive planetary shield penalty and/or only being able to fire if the planet is on Defence focus.

However, until/unless we introduce such a mechanic this sort of thing is, as per Sloth's point, not something we'd want that you feel the need to build everywhere.
Quote:
Then it seems to me there is a ton of non military buildings currently, i don't want to do the micro that i do now.

We are trying to both reduce the amount of these things and not introduce new ones, redoing the mechanics in such a way that anything that is currently micromanagement is reduced.
Quote:
We have to micro military buildings like elevators, docks, lighthouses,

Elevators shouldn't be needed in that many places if at all, even on Low Planets/Low Starlanes they should be a rare build not a constant build, they certainly are for me so I haven't considered them a problem. Drydocks and shipyards are meant to be built rarely and at strategic locations—that's not currently the case but the main reason it hasn't been fixed is it requires an AI rewrite and the AI team have more important stuff to work on currently.

Lighthouses are a problem I agree, I personally rarely build them (starlane drive is my main use for them), and I'm considering fixing them in some way, possibly replacing their current bonus with something that complements Interstellar Logistics, increasing the range of that bonus would work and mean you choose where to put them.

Quote:
the industry building,
Specifically and definitely not, that's a one-per-empire building and works for all supply-connected worlds.
Quote:
But click spamming crappy little troop ships is more 'cost effective' then having a capital sized dedicated troop ship drop troop pods,

Last time I checked the maths, the reverse is normally true, larger ships tend to be cheaper on overall slots/point, there are exceptions (the Flux hull is too cheap but far too fragile) but generally bigger=cheaper, that's deliberate. In addition, each ship in your fleet increases upkeep for all other ships being built, so spamming lots of little ships increases the costs of everything.

With the exception of the Flux hull, can you give examples of what you think is more cost effective for troop ships, I may need to adjust the numbers (again) if you feel that's currently the case, personally I don't think it is.
Quote:
In effect this is a anti micro mechanism against small cheap troop ships spammed all over the place.
It also works against the idea of fleet repair en mass in a enemy system which breaks expectations.

Fleets shouldn't be able to repair in enemy systems, all of the repair techs are gated to require no combat and virtually all of the ship repair effects from elsewhere have been toned down or eliminated now.

Quote:
There are two primary ways to categorize the removal of micro logically.

1) Automate it.
This falls into the realm of ai or programming this tends to remove micro entirely.
(One exception is 'focus' which is a excellently implemented example of both micro and macro balanced. Conversely however bad examples are, the industry building it is build micro, that should be auto built by industry focus, While mines are instant built every-were macro via one click on a tech).

I agree with this except the industry building, again it isn't necessary to build more than one.

A better example would be the Gas Giant Generator and that's something we've discussed changing a few times.
Quote:
2) Cost.
Make choosing to build or not build something, a choice that isn't to be taken lightly. e.g. If i die every game i just spam a thing, then ill learn not to.
(The cost vs value needs to be considered. The implementation can be creative, typically you make it better at a higher cost, but this can be in any form you can think up).

Alternate ways to think of cost or restriction:

Say you have to already build something to get something else. This is how tech works, but it could be given by some other building that you already have to micro build, maybe one you really don't want too, in order to make it feel less tedious, like a (lighthouse or scanner) or (industry factory). There are other ways to make things have a cost. You could have to build a System military factory on just one planet, That might automatically provide a gun per planet this might have a high cost but be worth it only in certain places of high value.

Agree with this, definitely, having choices that push you to an either/or or have a strong disadvantage is a good thing, far too often people think of costs in pure production cost, but time and other resources effects can be costs. If having this gun reduced planet shields substantially that would be an interesting different cost and provide a choice, etc.

_________________
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
PostPosted: Sun Sep 25, 2016 10:58 pm 
Offline
Space Kraken

Joined: Mon Nov 16, 2015 5:57 am
Posts: 105
You know reading that i have been playing this game all wrong. Im not sure i can imagine playing it right i can spam non stop even with the messed up way i've been playing. Up till now i actually didn't realize how op supply is.

Quote:
Drydocks and shipyards are meant to be built rarely and at strategic locations—that's not currently the case but the main reason it hasn't been fixed is it requires an AI rewrite and the AI team have more important stuff to work on currently.

This is the first thing players are introduced to so what idea will they get about how you play the game ? Besides they are cheap. I build the lighthouses every-were cloaked planets are invincible. As far as repair if i have to back out one system its not really a big deal ill be right back. Sometimes i just send in alternates while the main repairs its easy to just mass and sit in a enemy system once you dispatch its fleet with little penalty.

Quote:
With the exception of the Flux hull, can you give examples of what you think is more cost effective for troop ships, I may need to adjust the numbers (again) if you feel that's currently the case, personally I don't think it is.


The Flux is what im talking about. that's actually all i use for troop ships till i don't care about production, the ai does it too, after getting the flux, i even make scout troopers. Unless i change up the game by editing. Why would i use anything else. I thought that was intentional basically you have a 8 or12 to 1 troop ship to colony ship cost ratio. Why not just build armed ships plus cheap troop ships and wait for some sucker to drop a colony then pounce all thru the early game.

Tactically if i stop a troop ship in que no big deal, if i stop a colony or outpost it's a huge hit / slow down it's like stop 10 troop ships at once. 10x troop ships can easily pop most planets i don't even have to wait for troops to repopulate i just click spam them from industry.

Then again i guess ive been playing the game wrong either way this is just to learn the scripting and i still can't get it to work. Im already frustrated with that and this is all just conjecture on what is just a practical experiment for learning the scripting. Far more concerned with why the script doesn't work then how building could work.


Last edited by xlightwavex on Mon Sep 26, 2016 7:53 am, edited 4 times in total.

Top
 Profile  
 
PostPosted: Sun Sep 25, 2016 11:07 pm 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 28, 2013 11:45 pm
Posts: 3295
The problem is what you're trying to do as a learning project is actually incredibly complex: I'm not giving advice on it as I'm fairly sure it'd be beyond me (I'm not a good coder, I balance/test/document stuff). Starting with amending existing effects, adding or changing existing numbers is always going to be easier than adding something completely new, and this is a very specific scope thing that, while it has potential, is going to be frustrating to get right.

I genuinely recommend starting with something like a new hull (or even changing stats on an existing hull, double the price of the Flux hull, see how many the AI then builds—the shipbuilding AI is adaptive).

But yeah, Supply is powerful, intentionally, defending your supply lines is meant to be a key part of the game, disrupting them is deadly.

_________________
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
PostPosted: Sun Sep 25, 2016 11:39 pm 
Offline
Space Kraken

Joined: Mon Nov 16, 2015 5:57 am
Posts: 105
MatGB wrote:
The problem is what you're trying to do as a learning project is actually incredibly complex: I'm not giving advice on it as I'm fairly sure it'd be beyond me (I'm not a good coder, I balance/test/document stuff). Starting with amending existing effects, adding or changing existing numbers is always going to be easier than adding something completely new, and this is a very specific scope thing that, while it has potential, is going to be frustrating to get right.

I genuinely recommend starting with something like a new hull (or even changing stats on an existing hull, double the price of the Flux hull, see how many the AI then builds—the shipbuilding AI is adaptive).


Im learning this atm, learning one thing at a time is usually less time consuming then giving up to learn something else then coming back. Though it may make it easier (that is not guaranteed) its both far easier and quicker to have good teachers be they reading, examples, or input from your betters (more experienced knowledgeable people). Really im learning it all just somethings i can learn from reading, some i need to learn by doing while ive learned a lot by reading so far, there is not exactly a msdn for fo scripting.

Besides i already did some of the other stuff you mentioned and its not like i have a deadline :)

Really this problem were im at is baffling not because i don't see what to do this time, but because i do. It seems like this should be executing in fact it executes in the previous code without the if statements but i need some type of switch which the if gives.

Code:
effects =
      [
             
         SetStructure value = Value -((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
         SetFuel value = Value -(.5+ Target.MaxFuel / 5)
          //   
         // msg to the player firing the gun
         GenerateSitrepMessage


The sitrep executes in the same block as the SetStructure call, however the SetStructure is not executing. Clearly the effect is however active, the sitrep is reporting the target as the one in the system. While the newest code adds sitreps for the target empire and is even larger. These two lines are still stumping me as to why they are getting bypassed.

If i go back to the other way it will work in general but the hits vs destroy will not function properly in specific cases, as the stacking groups don't want to then exclude each other. To solve it i that way i have to remove the destroy segment altogether and the low check, that is actually more ambiguous to hide what will occur anyways as it makes the message to the player forced to occur on separate turns or it just looks wrong. This way with the if statements it is step wise logic and should work, but again its giving me trouble, in that now the messages are right but the actual damage is not occuring.


Last edited by xlightwavex on Mon Sep 26, 2016 7:57 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Sep 26, 2016 7:32 am 
Offline
Space Kraken

Joined: Mon Nov 16, 2015 5:57 am
Posts: 105
Ok im pretty sure this is a bug, SetStructure and as far as i can tell SetFuel wont fire inside a nested effects = [ properly.

Destroy however will.

I made the following test... which works as shown, however.

If you comment the first two lines.
SetStructure value = Value -((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
SetFuel value = Value -(.5+ Target.MaxFuel / 5)

Then un-comment the corresponding two lines within the second nested call, inner effects = [ , they will not fire on un-moving ships in the system, even if they meet the conditions and are over the threshold structure value and the message is sent. They don't seem to always fire on moving ships entering the system either.

The destroy command will however fire on moving or un-moving ships, if they have hp below the target threshold value. This bug for the moment means that i can't solve a 4 branch conditional jump with if else at least not without some other conceived work around.

Unless someone can see how this is intended behavior and can explain why it works that way ?


Code:
BuildingType
name = "BLD_PLANETARY_GUN"
description = "BLD_PLANETARY_GUN_DESC"
buildcost = 10
buildtime = 1
location = And
[
    Planet
    Not Contains Building name = "BLD_PLANETARY_GUN"
    Not Planet type = [GasGiant]
    OwnedBy empire = Source.Owner
]
EnqueueLocation = And
[
    Not Contains Building name = "BLD_PLANETARY_GUN"
    Not Enqueued type = Building name = "BLD_PLANETARY_GUN"
    Not Planet type = [GasGiant]
    OwnedBy empire = Source.Owner
]
effectsgroups =
[
    EffectsGroup
    scope = NumberOf number = 1 condition = And   
    [
        Ship
        InSystem id = Source.SystemID
        OwnedBy affiliation = EnemyOf empire = Source.Owner         
    ]
    effects =
    [
        //
        // non cloaked ships
        //

         // test this works as expected but should be in the second nested call
        //
        SetStructure value = Value -((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
        SetFuel value = Value -(.5+ Target.MaxFuel / 5) 
       
        If condition = and
        [
            Structure high = ((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
            VisibleToEmpire empire = Source.Owner 
        ]
        effects =
        [
            Destroy
             //
            // msg to the player firing the gun
            GenerateSitrepMessage
                message = "EFFECT_PLANETARY_GUN_HIT_DESTROYED"
                label = "EFFECT_PLANETARY_GUN_LABEL"
                icon = "icons/sitrep/combat_destroyed.png"
                parameters =
                [
                    tag = "planet" data = Source.PlanetID
                    tag = "building" data = Source.ID
                    tag = "source" data = Source.Owner
                    tag = "target" data = Target.Owner
                    tag = "ship" data = Target.ID
                ]
                empire = Source.Owner
        ]
        else = if condition = and
        [
            Structure low = ((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
            VisibleToEmpire empire = Source.Owner 
        ]
        effects =
        [
             // test cannot be placed here it wont work correctly, it acts buggy
            //
           //SetStructure value = Value -((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
           //SetFuel value = Value -(.5+ Target.MaxFuel / 5) 

             //
            // msg to the player firing the gun
            GenerateSitrepMessage
                message = "EFFECT_PLANETARY_GUN_HIT"
                label = "EFFECT_PLANETARY_GUN_LABEL"
                icon = "icons/meter/damage.png"
                parameters =
                [
                    tag = "planet" data = Source.PlanetID
                    tag = "building" data = Source.ID
                    tag = "ship" data = Target.ID
                    tag = "rawtext" data = ((CurrentTurn / 14 + Target.MaxStructure / 6) +4 - Target.Shield)
                    tag = "source" data = Source.Owner
                    tag = "target" data = Target.Owner
                    //tag = "empire" data = Target.Owner
                ]
                empire = Source.Owner
        ]
    ]
]
icon = "icons/meter/damage.png"
#include "/scripting/common/priorities.macros"
#include "/scripting/common/base_prod.macros"


Top
 Profile  
 
PostPosted: Mon Sep 26, 2016 8:48 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12045
Location: Munich
Can you simplify the script to identify what the problem actually is? Does it work if you put Destroy in both the if and else cases? Does it work if you remove the if and just have SetFuel / SetStructure effects that always fire on something that matches the scope?

Also, for what you have so far, the VisibleToEmpire empire = Source.Owner should be in the scope, not the if/else tests.

I'm also not clear on what your intended if/else logic is... You want to put an if inside an if that is itself in the else of another if?


Top
 Profile  
 
PostPosted: Mon Sep 26, 2016 11:36 am 
Offline
Space Kraken

Joined: Mon Nov 16, 2015 5:57 am
Posts: 105
Geoff the Medio wrote:
Can you simplify the script to identify what the problem actually is? Does it work if you put Destroy in both the if and else cases? Does it work if you remove the if and just have SetFuel / SetStructure effects that always fire on something that matches the scope?

Also, for what you have so far, the VisibleToEmpire empire = Source.Owner should be in the scope, not the if/else tests.

I'm also not clear on what your intended if/else logic is... You want to put an if inside an if that is itself in the else of another if?


Test case

Code:
effectsgroups =
[
    EffectsGroup
    scope = NumberOf number = 1 condition = And   
    [
        Ship
        InSystem id = Source.SystemID
        OwnedBy affiliation = EnemyOf empire = Source.Owner         
    ]
    effects =
    [

        //SetFuel value = Value -3.33 // works
        //SetStructure value = Value -10 // works
        //Destroy // works
        //sitrep... // works
       
        If condition = and
        [
            OwnedBy affiliation = EnemyOf empire = Source.Owner // true   
            // Structure ... low high ... // works
            // Visibility ... // pretty sure this worked i think ya it did ai wasn't cloaking till i went far in
        ]
        effects =
        [
            //SetStructure value = Value -10 // >>> FAIL
            //SetFuel value = Value -3.33 // >>>>>> FAIL
            //Destroy // works
            //sitrep... // works

        ]
        else =
        [
            //SetStructure value = Value -10 // >>> FAIL
            //SetFuel value = Value -3.33  // >>>>> FAIL
            //Destroy // works
            //sitrep... // works
        ]
    ]
]


I don't need to have it be if else
4 straight out conditional if's would be fine.

if[ +arg1 , +arg2 ]effect[]
if[ -arg1 , +arg2 ]effect[]
if[ +arg1 , -arg2 ]effect[]
if[ -arg1 , -arg2 ]effect[]

The conditions work, the messages print properly on visibility and structure low high, which is what im trying to switch on.

Unfortunately not even with just a lone if will the failing items execute in those inner effects areas as listed :(

Im guessing the AddSpecial in that link you shot to me earlier works in the inner effects as well.

https://github.com/freeorion/freeorion/ ... s.txt#L212


Last edited by xlightwavex on Mon Sep 26, 2016 12:00 pm, edited 3 times in total.

Top
 Profile  
 
PostPosted: Mon Sep 26, 2016 11:55 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12045
Location: Munich
Hmm. I suspect that there's some code that is set up to only execute SetMeter effects but isn't recognizing that the If effect might contain SetMeter effects, so is skipping over them when updating meters.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: Exabot [Bot], Magpie 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