Excruciating FOCS doubts
Moderators: Oberlus, Committer
Re: Excruciating FOCS doubts
Looking at monster ship designs, I noticed that they have a uuid.
I didn't find the reason in the documentation, though.
Is it just a number that must be different from all other ship designs ?
Are there rules to build that number or just adding a digit (and doing a grep to check that it's not used elsewhere) is enough ?
I didn't find the reason in the documentation, though.
Is it just a number that must be different from all other ship designs ?
Are there rules to build that number or just adding a digit (and doing a grep to check that it's not used elsewhere) is enough ?
Re: Excruciating FOCS doubts
Also, I guess it's not FOCS strictly speaking, but what are the conditions for icons to "parse" ?
I've made (very badly) some on GIMP and many are not accepted by FreeOrion (no error message, the part that refers them just doesn't appear in the game).
I've made (very badly) some on GIMP and many are not accepted by FreeOrion (no error message, the part that refers them just doesn't appear in the game).
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
As referenced here, the UUIDs of ship designs were added to allow a persistent ordering of the designs in the GUI by players.
According to this comment, a valid UUID looks like 01234567-89ab-cdef-0123-456789abcdefIs it just a number that must be different from all other ship designs ?
Are there rules to build that number or just adding a digit (and doing a grep to check that it's not used elsewhere) is enough ?
I don't know how flexible the conversion is if numbers or letters or dashes are removed or added.
Not clear what you mean. Icon files are loaded as image file by, for instance, the PNG library, which I think does involve some parsing, but I don't think that's what you're talking about. If you just put an icon in the default directory, the game probably won't notice or care, unless you reference that icon in the FOCS for some content. Generally there's something like this:what are the conditions for icons to "parse"
Code: Select all
graphic = "icons/specials_huge/honeycomb.png"
Re: Excruciating FOCS doubts
Well, I don't know how to say it precisely : I've refered some icons in some FOCS files and the FOCS itself parses, but some icons are accepted and some are not, though all are in PNG format.Geoff the Medio wrote: ↑Fri Nov 06, 2020 8:45 amNot clear what you mean. Icon files are loaded as image file by, for instance, the PNG library, which I think does involve some parsing, but I don't think that's what you're talking about. If you just put an icon in the default directory, the game probably won't notice or care, unless you reference that icon in the FOCS for some content. Generally there's something like this:in a content script that specifies what icon / graphic to use for some content, which is where you'd point it to the new icon file.Code: Select all
graphic = "icons/specials_huge/honeycomb.png"
I didn't find rules for what is acceptable and what is not for icons, and anyway I'm not very knowledgeable on icon formatting.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
Well, as I wrote earlier, there is nothing to show as there are no error messages (neither at start when I launch FreeOrion from the console as you explained I should nor during the game; that's what I called "parse" for lack of a better word) and for ship parts the part just doesn't appear in the Ship Design panel.Geoff the Medio wrote: ↑Sat Nov 07, 2020 9:12 amWhat does "accepted" mean for icons? Post an error message or in-game screenshot along with the relevant FOCS and icon file.
I had this appear for a Special, and I'm very surprised since I used the starvation.png icon (which isn't used anymore AFAIK) that I just renamed without any modification of the icon itself .
For the ship parts, icons which didn't appear (I repeat, that meant that the ship part itself didn't appear, not that a slot was there with a missing icon) where icons that I modified in GIMP, either by cropping them or by copying another icon on them . The ones which were accepted are icons that I modified only by using rotation, color saturation and the like .
Here are the corresponding FOCS files (yes, they reference the icon that "parse", not anymore the one that doesn't):
Variable pressure nanocoating :
Code: Select all
Part
name = "ST_COATING_GG"
description = "ST_COATING_GG_DESC"
exclusions = "ST_COATING_GG"
class = Stealth
capacity = 00
mountableSlotTypes = Internal
buildcost = 2 * [[FLEET_UPKEEP_MULTIPLICATOR]] * [[SHIP_PART_COST_MULTIPLIER]]
buildtime = 5
tags = [ "PEDIA_PC_STEALTH" ]
location = OwnedBy empire = Source.Owner
effectsgroups = [
EffectsGroup
scope = Source
activation = ContainedBy And [
System
Contains Planet type = GasGiant
]
stackinggroup = "STEALTH_GG_STACK"
accountinglabel = "GAS_GIANT_FIELD_STEALTH"
effects = [SetStealth value = Value + 20
SetSpeed value = Value - 10
]
]
icon = "icons/ship_parts/gasgianthidden.png"
#include "stealth.macros"
#include "/scripting/common/upkeep.macros"
Gravitic Resonator :
Code: Select all
Part
name = "SP_GRAVITIC_RESONATOR"
description = "SP_GRAVITIC_RESONATOR_DESC"
exclusions = "SP_GRAVITIC_RESONATOR"
class = General
mountableSlotTypes = Internal
buildcost = 10 * [[FLEET_UPKEEP_MULTIPLICATOR]] * [[SHIP_PART_COST_MULTIPLIER]]
buildtime = 10
tags = [ "PEDIA_PC_GENERAL" ]
location = OwnedBy empire = Source.Owner
effectsgroups =
EffectsGroup
scope = WithinDistance distance = 0 condition = Source
activation = ContainedBy And [
System
Contains Planet size = Tiny
]
stackinggroup = "SP_GRAVITIC_RESONATOR_STACK"
accountinglabel = "PLANET_RESONANCE"
effects = SetStealth value = Value - 20
icon = "icons/ship_parts/graviticresonator.png"
#include "/scripting/common/upkeep.macros"
Arrakis Wheat :
Code: Select all
Special
name = "ARRAKIWHEAT_SPECIAL"
description = "ARRAKIWHEAT_SPECIAL_DESC"
stealth = 0
spawnrate = 1.0
spawnlimit = 9999
location = And [
Planet
Not Planet type = [Asteroids GasGiant]
Not ContainedBy And [
System
Contains Capital
]
Not WithinStarlaneJumps jumps = 2 condition = And [
System
Contains And [
Planet
OwnedBy affiliation = AnyEmpire
]
]
]
effectsgroups = [
EffectsGroup
scope = And [
Planet
Focus type = "FOCUS_GROWTH"
OwnedBy empire = Source.Owner
]
activation = And [
Focus type = "FOCUS_INFLUENCE"
HasTag name = "TELEPATHIC"
]
stackinggroup = "ARRAKIWHEAT_STACK"
priority = [[LATE_PRIORITY]]
effects = SetTargetInfluence value = Value + Target.Population * 0.1
EffectsGroup
description = "GROWTH_SPECIAL_POPULATION_ORGANIC_INCREASE"
scope = And [
Source
HasTag name = "ORGANIC"
]
stackinggroup = "ARRAKIWHEAT_STACK"
priority = [[TARGET_POPULATION_AFTER_SCALING_PRIORITY]]
effects = SetTargetPopulation value = Value + 1 * Target.HabitableSize // Provides the bonus locally, no matter the focus
[[CHANCE_OF_GUARD_2]]
]
graphic = "icons/specials_huge/arrakiwheat.png"
#include "monster_guard.macros"
#include "/scripting/common/base_prod.macros"
#include "/scripting/common/priorities.macros"
This one still references the icon that doesn't "parse" since I don't understand what the problem is.
Re: Excruciating FOCS doubts
Here are the screenshots of what is shown for the Special (I wasn't able to upload more than five pictures in the preceding post).
- Attachments
-
- bug arrakis wheat.png (722.38 KiB) Viewed 1150 times
-
- bug arrakis wheat2.png (673.65 KiB) Viewed 1150 times
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
Then there's no parsing error. Rather, you've probably specified a file that doesn't exist or can't be read. The parser doesn't verify that such file exist (or not), but rather the client / UI does when it attempts to display the graphic for the first time. There might be something in freeorion.log that indicates that the texture file couldn't be loaded. As Oberlus noted, the filenames in what you've posted are inconstent.
Re: Excruciating FOCS doubts
It seems you are right, the problem with arrakiswheat was indeed a typo, and the log file¹ showed an error message "inexisting texture".
What really puzzles me is that for the other icons (cropped and copied over), I had double and triple-checked that they were the cause of the problem (copying the exact name with F2 and Ctrl C) but today I tested by replacing "flak.png" in the flak FOCS file by the name of these icons (I used flak so I could test just by going to the ship design panel on turn 1) and the flak appeared with the copied over (at first try) and the cropped (on second test) icon...
So, copied over and cropped icons are accepted by FreeOrion, I guess that's good to know, especially for someone with little graphic skills like me.
I did the first thorough tests some time ago, with version 4.9 I think, so theorically the new version could have a more tolerant texture importing tool, but I'm not aware that something had been changed in the codebase to that aspect.
Sorry for the bother then and thanks for your patience and help.
¹ Which is here in Snap builds, actually : ~/snap/freeorion/current/.local/share/freeorion/freeorion.log - not very easy to find !
What really puzzles me is that for the other icons (cropped and copied over), I had double and triple-checked that they were the cause of the problem (copying the exact name with F2 and Ctrl C) but today I tested by replacing "flak.png" in the flak FOCS file by the name of these icons (I used flak so I could test just by going to the ship design panel on turn 1) and the flak appeared with the copied over (at first try) and the cropped (on second test) icon...
So, copied over and cropped icons are accepted by FreeOrion, I guess that's good to know, especially for someone with little graphic skills like me.
I did the first thorough tests some time ago, with version 4.9 I think, so theorically the new version could have a more tolerant texture importing tool, but I'm not aware that something had been changed in the codebase to that aspect.
Sorry for the bother then and thanks for your patience and help.
¹ Which is here in Snap builds, actually : ~/snap/freeorion/current/.local/share/freeorion/freeorion.log - not very easy to find !
Re: Excruciating FOCS doubts
On another topic, I'm trying to modify the way the Derelict Tanker works.
For memory, here is the original Derelict Tanker FOCS file :
I had some trouble understanding why it created and destroyed a Special but I finally understood that it was to be able to send the sitrep message with the parameter "tag "special". Why it has to add itself to do that is still beyond my comprehension.
I also did not understand why it had to destroy itself twice and I supposed that was to destroy the initial Special and also destroy the new Special of the same name, so I tried creating a different special and destroying each of them separately. Derelict_special4 has no effect, nor location (so it wouldn't spawn on its own).
It more or less works (at least the sitrep message is correctly sent), but if I destroy the Special4 at the second effect group (here above) it doesn't destroy the Derelict tanker : ships are refueled each time they pass through the system, and I'm not sure I understand why (yes, this effect group has its scope in the system and the third and last effect group doesn't, so I might understand why it would not remove the initial Derelict Tanker - Derelict_Special4 - in the last effect group, but then why in the original code is this deletion put in the third effect group ?).
And if I destroy the Special4 at the third effect group (here below) it does destroy the Derelict tanker but the ships are never refueled, and I have even less clue why.
Is the created Special attached to the ship instead of the system ? Is there recursion involved, that's why it won't work if I split the specials ?
BTW, is there a FOCS IDE for Linux ? I've read that Notepad++ has one, but it's for Windows...
For memory, here is the original Derelict Tanker FOCS file :
Code: Select all
Special
name = "DERELICT_SPECIAL3" // FUEL
description = "DERELICT_SPECIAL_DESC"
stealth = 45
spawnrate = 0.5
spawnlimit = 100
location = And [
System
Not Contains Capital
]
effectsgroups = [
EffectsGroup
scope = And [
Ship
InSystem id = Source.SystemID
OwnedBy affiliation = AnyEmpire
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
AddSpecial name = "DERELICT_SPECIAL3"
GenerateSitRepMessage
message = "EFFECT_DERELICT_FUEL"
label = "EFFECT_DERELICT_FUEL_LABEL"
icon = "icons/meter/fuel.png"
parameters = [
tag = "system" data = Source.ID
tag = "special" data = "DERELICT_SPECIAL3"
]
empire = Target.Owner
]
EffectsGroup
scope = And [
Source
System
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
RemoveSpecial name = "DERELICT_SPECIAL3"
]
EffectsGroup
scope = And [
Source
Ship
]
effects = [
SetFuel value = Value + 100
RemoveSpecial name = "DERELICT_SPECIAL3"
]
]
graphic = "icons/specials_huge/derelict.png"
I also did not understand why it had to destroy itself twice and I supposed that was to destroy the initial Special and also destroy the new Special of the same name, so I tried creating a different special and destroying each of them separately. Derelict_special4 has no effect, nor location (so it wouldn't spawn on its own).
Code: Select all
Special
name = "DERELICT_SPECIAL3" // FUEL
description = "DERELICT_SPECIAL_DESC"
stealth = 45
spawnrate = 0.5
spawnlimit = 100
location = And [
System
Not Contains Capital
]
effectsgroups = [
EffectsGroup
scope = And [
Ship
InSystem id = Source.SystemID
OwnedBy affiliation = AnyEmpire
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
AddSpecial name = "DERELICT_SPECIAL4"
GenerateSitRepMessage
message = "EFFECT_DERELICT_FUEL"
label = "EFFECT_DERELICT_FUEL_LABEL"
icon = "icons/meter/fuel.png"
parameters = [
tag = "system" data = Source.ID
tag = "special" data = "DERELICT_SPECIAL4"
]
empire = Target.Owner
]
EffectsGroup
scope = And [
Source
System
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
RemoveSpecial name = "DERELICT_SPECIAL4"
]
EffectsGroup
scope = And [
Source
Ship
]
effects = [
SetFuel value = Value + 100
RemoveSpecial name = "DERELICT_SPECIAL3"
]
]
graphic = "icons/specials_huge/derelict.png"
And if I destroy the Special4 at the third effect group (here below) it does destroy the Derelict tanker but the ships are never refueled, and I have even less clue why.
Is the created Special attached to the ship instead of the system ? Is there recursion involved, that's why it won't work if I split the specials ?
Code: Select all
Special
name = "DERELICT_SPECIAL3" // FUEL
description = "DERELICT_SPECIAL_DESC"
stealth = 45
spawnrate = 0.5
spawnlimit = 100
location = And [
System
Not Contains Capital
]
effectsgroups = [
EffectsGroup
scope = And [
Ship
InSystem id = Source.SystemID
OwnedBy affiliation = AnyEmpire
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
AddSpecial name = "DERELICT_SPECIAL4"
GenerateSitRepMessage
message = "EFFECT_DERELICT_FUEL"
label = "EFFECT_DERELICT_FUEL_LABEL"
icon = "icons/meter/fuel.png"
parameters = [
tag = "system" data = Source.ID
tag = "special" data = "DERELICT_SPECIAL4"
]
empire = Target.Owner
]
EffectsGroup
scope = And [
Source
System
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
RemoveSpecial name = "DERELICT_SPECIAL3"
]
EffectsGroup
scope = And [
Source
Ship
]
effects = [
SetFuel value = Value + 100
RemoveSpecial name = "DERELICT_SPECIAL4"
]
]
graphic = "icons/specials_huge/derelict.png"
BTW, is there a FOCS IDE for Linux ? I've read that Notepad++ has one, but it's for Windows...
Re: Excruciating FOCS doubts
Well, wrong. The special tag uses the not the special universe object, but the special definition name. Does not need an existing object.
Each object can have a special only once (It gets stored in a map with the special name as key).
So, on what kind of object(s) the special gets actually added?
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
When attached to a system, your first DERELICT_SPECIAL3 (second code block) adds DERELICT_SPECIAL4 to ships in the system and removes DERELICT_SPECIAL4 from the system (which probably does nothing unless there happens to also be a DERELICT_SPECIAL4 special in the system). When attached to a ship (which presumably never happens unless in some other code?), it removes DERELICT_SPECIAL3 (itself) from the ship while refueling the ship. You didn't post a DERELICT_SPECIAL4 definition, so I don't know what it does.
When attached to a system, your second DERELICT_SPECIAL3 (third code block) adds DERELICT_SPECIAL4 to ships in the system and removes DERELICT_SPECIAL3 from the system. When attached to a ship (when presumably never happens unless in some other code?), it would remove DERELICT_SPECIAL4 (that isn't present on the ship unless coindidentally added by something else) while refueling the ship. Again, there's no posted DERELICT_SPECIAL4 definition, so I don't know what it does.And if I destroy the Special4 at the third effect group (here below) it does destroy the Derelict tanker but the ships are never refueled, and I have even less clue why.
What is "the created Special"?Is the created Special attached to the ship instead of the system ?
Not clear what you mean.Is there recursion involved, that's why it won't work if I split the specials ?
Re: Excruciating FOCS doubts
OK, with your explanations and a lot of testing, I was finally able to figure it out, so thanks for your answers and your patience.
If I get it correctly (and since I was able to change the code and make it work, I think that I do), the code (there is a commented version of the original code below) first creates a Special (a new instance of itself) that it attaches to the ship that enters the system (if I understand correctly, this code is applied to all ships entering the system in the same turn, which means that each of these ships will get an instance of the Derelict3 Special attached to it). It also sends a sitrep message to the player, telling him that his ships have been refueled in the system by a Derelict Tanker.
Then (second effect group) it removes itself from the system, as the Derelict tanker is supposed to refuel ships only once, so we don't want the Special attached to the system to affect ships next or subsequent turns.
The third Effect Group is actually NOT executed on the Derelict3 Special attached to the system, but only when the code is re-executed on the newly created instance (the "created special" I was refering to in the previous message, and the reason I was talking of recursion). It then refuels the ship and removes itself from said ship as we want the refueling to operate only once.
That is very clever coding but also very hard to understand.
It's especially extremely confusing, for someone who's seen only the frontend, to understand when working on the FOCS file about a Special that is attached to a system, that this Special could actually backend-wise be attached to anything.
It really should be recommended practice to put comments on the FOCS code when it is that much non-obvious, especially if the goal is to allow interested players to contribute to the game by writing FOCS files or modifying existing ones themselves.
Wnat I wanted to do originally is make the Derelict Tanker works in two steps, being discoverd on one turn and refueling fleets the next time a ship enters the system.
This allows for more strategic exploration as a player may want to save it for a more important move later (like an invasion fleet of a Colony ship) instead of simply refueling the ship that discovered the tanker initially.
So I split the code in two FOCS files, the initial Derelict3 that only discovers the tanker but doesn't refill the ship :
And the one that actually refills the fleet(s) entering the system in a later turn (to avoid micromanagement, I didn't want to add any button - that I wouldn't know how to implement anyway - to refuel the fleet : just entering a System where a discovered Derelict tanker is refuels the fleet and destroys the Tanker) :
I tested it and it works (well, it did not at first, but now it does).
I think it would improve the game if it was included in FreeOrion in replacement of the Derelict Tanker (derelict3.focs.txt) that exists as of now.
Is it a problem if I put this code under the AGPL license ?
If I get it correctly (and since I was able to change the code and make it work, I think that I do), the code (there is a commented version of the original code below) first creates a Special (a new instance of itself) that it attaches to the ship that enters the system (if I understand correctly, this code is applied to all ships entering the system in the same turn, which means that each of these ships will get an instance of the Derelict3 Special attached to it). It also sends a sitrep message to the player, telling him that his ships have been refueled in the system by a Derelict Tanker.
Then (second effect group) it removes itself from the system, as the Derelict tanker is supposed to refuel ships only once, so we don't want the Special attached to the system to affect ships next or subsequent turns.
The third Effect Group is actually NOT executed on the Derelict3 Special attached to the system, but only when the code is re-executed on the newly created instance (the "created special" I was refering to in the previous message, and the reason I was talking of recursion). It then refuels the ship and removes itself from said ship as we want the refueling to operate only once.
That is very clever coding but also very hard to understand.
It's especially extremely confusing, for someone who's seen only the frontend, to understand when working on the FOCS file about a Special that is attached to a system, that this Special could actually backend-wise be attached to anything.
It really should be recommended practice to put comments on the FOCS code when it is that much non-obvious, especially if the goal is to allow interested players to contribute to the game by writing FOCS files or modifying existing ones themselves.
Code: Select all
Special
name = "DERELICT_SPECIAL3" // FUEL
description = "DERELICT_SPECIAL_DESC"
stealth = 45
spawnrate = 0.5
spawnlimit = 100
location = And [
System
Not Contains Capital
]
effectsgroups = [
EffectsGroup
scope = And [
Ship
InSystem id = Source.SystemID
OwnedBy affiliation = AnyEmpire
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
AddSpecial name = "DERELICT_SPECIAL3" // we add the Derelict tanker Special to the Ship in order to later be able to affect the ships characteristics
GenerateSitRepMessage
message = "EFFECT_DERELICT_FUEL"
label = "EFFECT_DERELICT_FUEL_LABEL"
icon = "icons/meter/fuel.png"
parameters = [
tag = "system" data = Source.ID
tag = "special" data = "DERELICT_SPECIAL3"
]
empire = Target.Owner
]
EffectsGroup // here we remove the Derelict tanker special from the system, since it's a one-time event
scope = And [
Source
System
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
RemoveSpecial name = "DERELICT_SPECIAL3"
]
EffectsGroup // the code runs here not on the original Derelict3 Special attached to the system, but to the one newly attached to the ship
scope = And [
Source
Ship
]
effects = [
SetFuel value = Value + 100
RemoveSpecial name = "DERELICT_SPECIAL3" // after having refueled the ship, we remove the Special that has been attached to it
]
]
graphic = "icons/specials_huge/derelict.png"
Wnat I wanted to do originally is make the Derelict Tanker works in two steps, being discoverd on one turn and refueling fleets the next time a ship enters the system.
This allows for more strategic exploration as a player may want to save it for a more important move later (like an invasion fleet of a Colony ship) instead of simply refueling the ship that discovered the tanker initially.
So I split the code in two FOCS files, the initial Derelict3 that only discovers the tanker but doesn't refill the ship :
Code: Select all
Special
name = "DERELICT_SPECIAL3" // THE ONE WHICH DISCOVERS THE TANKER
description = "DERELICT_SPECIAL_DESC"
stealth = 45
spawnrate = 0.5
spawnlimit = 100
location = And [
System
Not Contains Capital
]
effectsgroups = [
EffectsGroup // here we send a sitrep message to whoever sent a ship in the system
scope = And [
Ship
InSystem id = Source.SystemID
OwnedBy affiliation = AnyEmpire
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
GenerateSitRepMessage
message = "EFFECT_DERELICT_FUEL_TANKER"
label = "EFFECT_DERELICT_FUEL_LABEL"
icon = "icons/meter/fuel.png"
parameters = [
tag = "system" data = Source.ID
tag = "ship" data = RootCandidate.ID // test
tag = "special" data = "DERELICT_TANKER_SPECIAL"
]
empire = Target.Owner
]
EffectsGroup // here we add a Derelict tanker Special that will be used next time a Ship will enter the system, and remove the Derelict3 Special since the tanker has already been discovered
scope = And [
Source
System
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
]
effects = [
AddSpecial name = "DERELICT_TANKER_SPECIAL"
RemoveSpecial name = "DERELICT_SPECIAL3"
]
]
graphic = "icons/specials_huge/derelict.png"
And the one that actually refills the fleet(s) entering the system in a later turn (to avoid micromanagement, I didn't want to add any button - that I wouldn't know how to implement anyway - to refuel the fleet : just entering a System where a discovered Derelict tanker is refuels the fleet and destroys the Tanker) :
Code: Select all
Special
name = "DERELICT_TANKER_SPECIAL" // THE ONE WHICH ACTUALLY GIVES THE FUEL
description = "DERELICT_SPECIAL_DESC"
stealth = 5
spawnrate = 0.5
spawnlimit = 100
// This one doesn't spawn at Galaxy creation
effectsgroups = [
EffectsGroup // we add the Derelict tanker Special to the Ship in order to later be able to affect the ships characteristics
scope = And [
Ship
InSystem id = Source.SystemID
OwnedBy affiliation = AnyEmpire
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
Turn low = Source.CreationTurn + 1
]
effects = AddSpecial name = "DERELICT_TANKER_SPECIAL"
EffectsGroup // here we remove the Derelict tanker special from the system, since the fictional tanker is destroyed at the end of the refueling operation
scope = And [
Source
System
]
activation = And [
System
Contains And [
Ship
OwnedBy affiliation = AnyEmpire
]
Turn low = Source.CreationTurn + 1
]
effects = RemoveSpecial name = "DERELICT_TANKER_SPECIAL"
EffectsGroup // here the code runs not on the original Derelict tanker Special attached to the system, but to the one newly attached to the ship. It refuels the ship, warns the player of the refueling operation and the destruction of the fictional tanker, then removes the Derelict tanker Special from the ship.
scope = And [
Source
Ship
]
effects = [
GenerateSitRepMessage
message = "EFFECT_TANKER_IMPLODED"
label = "EFFECT_DERELICT_FUEL_LABEL"
icon = "icons/meter/fuel.png"
parameters = [
tag = "ship" data = Source.ID
tag = "special" data = "DERELICT_TANKER"
]
empire = Target.Owner
SetFuel value = Value + 100
RemoveSpecial name = "DERELICT_TANKER_SPECIAL"
]
]
graphic = "icons/specials_huge/derelict.png"
I think it would improve the game if it was included in FreeOrion in replacement of the Derelict Tanker (derelict3.focs.txt) that exists as of now.
Is it a problem if I put this code under the AGPL license ?
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
Feel free to submit some patches / pull requests that do such documentation as you review the scripts.
This sounds a bit awkward to use in practice, as it would seem to require the initial scout to leave the system immediately to avoid triggering the refuel effect.Wnat I wanted to do originally is make the Derelict Tanker works in two steps, being discoverd on one turn and refueling fleets the next time a ship enters the system.
It must be CC-BY-SA 3.0 and GPL 2.0 licensed. See https://github.com/freeorion/freeorion/ ... lt/COPYINGIs it a problem if I put this code under the AGPL license ?