# How to modify 0 A.D.?

## Recommended Posts

Thanks again for your help. I think I'm starting to understand the game session GUI:

However, I still have to figure out a way to solve that techtree GUI problem.

##### Share on other sites

Started to work with the gastraphetes today (idk if it should be posted here, but here i was summoned)

##### Share on other sites

@Alexandermb If I were you I'd create another dedicated thread for it. One of the reasons would be for an easy way to find it. It will be easier to find the thread when we need the model, and also you will get better feedback if it's separated from this thread.

• 1
• 1

##### Share on other sites

Gastraphetes Ready, now is in the hands of 2D experts to make the icon, and modders or 0 ad dev team to assing their training building - attack values.

Edited by Alexandermb

##### Share on other sites

38. Could anyone remove those obelisks from the Ptolemaic civil centre and military colony?

Edited by Nescio
ce

##### Share on other sites

8. Something I still want is the ability to allow units to occupy more than one garrison slot (e.g. infantry one, cavalry two, elephant six).

On 04/09/2016 at 1:17 PM, fatherbushido said:

8. That's something I had yet thought too. You need to modify a bit GarrisonHolder.js

On 18/10/2017 at 5:22 PM, leper said:

We had different garrison slot sizes once, it was a mess, didn't really add anything and was removed.

Any suggestions on how to re-implement it then into a mod? (My C++ and js skills are rather limited, so I'd appreciate any help.)

27. How to add diff proposals to phabricator by using a git clone (instead of using svn)? And how to load an existing diff into a local git repository?

38. Many thanks for creating that Greek/Macedonian gastraphetes soldier! Three more unit actors I'd like to have:

• Indian/Mauryan battering ram
• Arab/Bedouin camel spearman
Spoiler

Cf. Nabatean camel archer (ptol cavalry [sic] archer)

Note: a camel is not a horse. You can actually sit on a dromedary camel with your legs crossed:

• Libyan/Egyptian chariot
Spoiler
• biga (two-horse chariot); one driver and one composite bow archer (or javelinist)
• lighter and nimbler than chariots elsewhere
• small D-shaped platform, axis at the end
• six-spoked or four-spoked wheels
• Carthage and the Persians recruited large contigents of them in Classical times
• very approximate dimensions (as you can see, my drawing skills are limited):
• they also formed the core of Bronze Age Egypt's armies; reproductions and specimina preserved in tombs:
• epigraphical evidence:
• artist's impressions:
• modern reenactment:

43. Something else I'd want is the diplomacy-and-espionage panel displaying in which phase each player is, as well as including a n×n panel which shows what the diplomatic stance between each pair of players is.

44. Is it possible to change farmstead as a dropsite for food.fruit and food.grain (but not food.meat) and the corral as a dropsite for food.meat (but not food.grain and food.meat)?

45. Furthermore, I'd like to implement a special resource, silver (call it cash, coins, currency, gold, or whatever you like), which can not be gathered directly, but can be acquired by:

• selling resources
• traders (gain is 100% silver, no other resources)
• catafalque, palace, and wonder trickle rates
• looting centres, libraries, palaces, temples, and wonders and killing heroes

And it's the only resource which can be used for:

• diplomacy (paying other players to become your ally)
• espionage (bribing units or structures to temporarily share their vision)
• and perhaps also for directly promoting individual units to a higher rank (as a quick and expensive alternative to the default and free option of acquiring experience from fighting)

Silver is not required for any researches, structures, or units (I don't intend to penalize (AI) players unnecessarily)

Ordinary resources can no longer be directly bartered for each other (trade uses silver exclusively); furthermore, buying and selling resources is always possible (even without a market; I'd like to remove that AoE requirement). Also, I'd like to remove the barter and trade panels, as well as the resources from the top panel, and replace all that with a new permanent panel in the top left corner:

\begin{tabular}{lcrcc}
PopulationIcon &                                    & total/maximum &             &              \\
SilverIcon     & (number of active traders)         &  SilverAmount &             &              \\ %#0
FoodIcon       & (number of active food gatherers)  &    FoodAmount & Buy100Food  & Sell100Food  \\ %#1
WoodIcon       & (number of active wood gatherers)  &    WoodAmount & Buy100Wood  & Sell100Wood  \\ %#2
MetalIcon      & (number of active metal gatherers) &   MetalAmount & Buy100Metal & Sell100Metal \\ %#3
StoneIcon      & (number of active stone gatherers) &   StoneAmount & Buy100Stone & Sell100Stone \\ %#4
\end{tabular}

Now, where to start?

46. Finally I want fruit trees to stay after they are depleted, instead of disappearing when they reach 0 food, because they can slowly recover food when their amount is somewhere in between maximum and minimum (exclusive). Right-click to harvest food.fruit, control plus right-click to cut and destroy the tree and collect wood.

Edited by Nescio
ce

##### Share on other sites
23 hours ago, Nescio said:

38. Could anyone remove those obelisks from the Ptolemaic civil centre and military colony? (@stanislas69?)

Just edit the XML file and remove two lines...

##### Share on other sites
1 hour ago, Nescio said:

38. Many thanks for creating that Greek/Macedonian gastraphetes soldier, @Alexandermb! Three more unit actors I'd like to have:

• Indian/Mauryan battering ram
Reveal hidden contents
• Arab/Bedouin camel spearman
Reveal hidden contents

Cf. Nabatean camel archer (ptol cavalry [sic] archer)

Note: a camel is not a horse. You can actually sit on a dromedary camel with your legs crossed:

• Libyan/Egyptian chariot
Hide contents
• biga (two-horse chariot); one driver and one composite bow archer (or javelinist)
• lighter and nimbler than chariots elsewhere
• small D-shaped platform, axis at the end
• six-spoked or four-spoked wheels
• Carthage and the Persians recruited large contigents of them in Classical times
• very approximate dimensions (as you can see, my drawing skills are limited):
• they also formed the core of Bronze Age Egypt's armies; reproductions and specimina preserved in tombs:
• epigraphical evidence:
• artist's impressions:
• modern reenactment:

44. Is it possible to change farmstead as a dropsite for food.fruit and food.grain (but not food.meat) and the corral as a dropsite for food.meat (but not food.grain and food.meat)?

i will take a look on them

44-R: Try modifying the template files,  by using something like food_grain food_fruit or fruit alone. food.fruit, food fruit until you get it, if its not possible by templates then you will need change the ResourceDropsite.Js

##### Share on other sites
38 minutes ago, stanislas69 said:

Just edit the XML file and remove two lines...

Thanks, it worked, that was surprisingly easy! I never looked at the actor files before, always assuming editing visual actors is too difficult for me, however, I now learned everything is neatly subdivided; my compliments to whoever designed this!

41 minutes ago, Alexandermb said:

i will take a look on them

Great, I appreciate it

41 minutes ago, Alexandermb said:

44-R: Try modifying the template files,  by using something like food_grain food_fruit or fruit alone. food.fruit, food fruit until you get it

I already tried that earlier, resulting into the structures becoming uncreatable due to errors; so ResourceDropsite.Js it is.

47. I've also moved all simulation/templates/structures/{civ}_* files to simulation/templates/structures/{civ}/* which works perfectly fine. However, Atlas fails to detect them. Which file do I have to tweak for this?

##### Share on other sites
59 minutes ago, Nescio said:

my compliments to whoever designed this!

That just the way that XML should work part of the language design itself

Enjoy the Choice

##### Share on other sites

8. Probably some combination of specifying the number of slots a unit takes (maybe a new component, maybe in Identity), using that when garrisoning and fixing all the small issues that will most likely pop up (at least I expect a few when combined with upgrades/promotions/). Alternatively you could switch back to the old code, but that will most likely cause more issues. Another thing to consider would be having different slots for different classes, but that might not be what you want. 45. Check the wiki for how to add new resources. All the other things will require some code (some of them having tickets, some not). 46. Most likely something to do with Health, and/or the resource| filter template. 47. Use svn, or edit some placeableFilter file in simulation/data.

##### Share on other sites

45. So I've added silver, however, somehow there is now a problem with buying resources:

The only clue I have is a single warning from the interesting log:

WARNING: JavaScript warning: simulation/components/Barter.js line 45 reference to undefined property multiplier.buy[resource]

which I fail to understand. I did not touch the Barter.js file, nor do I understand why line 45 (buy) is problematic but line 46 (sell) not.

By the way, which file do I need to change the cost of bribing (espionage) from 500 metal into 250 silver?

18 hours ago, leper said:

47. Use svn, or edit some placeableFilter file in simulation/data.

placeableFilter file? Which, where, and how?

48. What is the syntax for internal AND and OR operators in technology json file modifications?

{"value": "Loot/silver", "add": 1, "affects": "Healer"}

E.g. I want it to affect champion infantry instead of healer.

Edited by Nescio
ce

##### Share on other sites
22 hours ago, Nescio said:

45. Furthermore, I'd like to implement a special resource, silver (call it cash, coins, currency, gold, or whatever you like), which can not be gathered directly, but can be acquired by:

• selling resources
• traders (gain is 100% silver, no other resources)
• catafalque, palace, and wonder trickle rates
• looting centres, libraries, palaces, temples, and wonders and killing heroes

And it's the only resource which can be used for:

• diplomacy (paying other players to become your ally)
• espionage (bribing units or structures to temporarily share their vision)
• and perhaps also for directly promoting individual units to a higher rank (as a quick and expensive alternative to the default and free option of acquiring experience from fighting)

I love this! Although I must say that the requirement to have a market to trade or buy/sell resources seems like a really good one. Other than that, I've been waiting for the day someone would add a "coinage system" or something like it. I wish you all the luck with this project! Curious to see how it plays...

##### Share on other sites
1 hour ago, Nescio said:

48. What is the syntax for internal AND and OR operators in technology json file modifications?

{"value": "Loot/silver", "add": 1, "affects": "Healer"}

E.g. I want it to affect champion infantry instead of healer.

It's a string but the "spaces = OR , + = AND" thing doesn't work here. (Should it? see @bb_ recent diff).

The only thing you can do with those specific affects is something like "Champion Infantry" which will indeed apply to entity matching Champion AND Infantry classes.

If you want to do an OR with specific affects, you have to use a new line.

So all is doable.

(Also have you set that modification in your mod? And what do you want to do with it, as modifying the loot is not always the good idea with techs?).

##### Share on other sites

Is the string support really broken in there?,

In my recent diff I propose to change some misleading array scopes, like ["foo bar"]=="foo+bar"==[["foo", "bar"]] in where the first syntax is is misleading. And doesn't "foo bar" or "["foo, "bar"] represents the OR here?

##### Share on other sites
9 minutes ago, fatherbushido said:

It's a string but the "spaces = OR , + = AND" thing doesn't work here. (Should it? see @bb_ recent diff).

48. Well, I understand how OR and AND work in “affects” and “requirements”, I've used that many times. However, I'm currently wondering if they can also be used inside “modifications” (the wiki is not clear enough for me on this point).

16 minutes ago, fatherbushido said:

The only thing you can do with those specific affects is something like "Champion Infantry" which will indeed apply to entity matching Champion AND Infantry classes.

If you want to do an OR with specific affects, you have to use a new line.

So all is doable.

So "Champion Infantry" will do want I want? Thanks!

14 minutes ago, fatherbushido said:

(Also have you set that modification in your mod? And what do you want to do with it, as modifying the loot is not always the good idea with techs?).

The file I created is rank_01.json, which is being used for promoted units:

Spoiler

{
"affects": ["1", "2", "3", "4", "5", "6","7", "8", "9","10", "11", "12"],
"autoResearch": true,
"icon": "rank_01.png",
"modifications": [
{"value": "Attack/Capture/Value",       "multiply": 1.05                       },
{"value": "Attack/Melee/Crush",         "multiply": 1.05, "affects": "Melee"   },
{"value": "Attack/Melee/Hack",          "multiply": 1.05, "affects": "Melee"   },
{"value": "Attack/Melee/Pierce",        "multiply": 1.05, "affects": "Melee"   },
{"value": "Attack/Ranged/Crush",        "multiply": 1.05, "affects": "Ranged"  },
{"value": "Attack/Ranged/Hack",         "multiply": 1.05, "affects": "Ranged"  },
{"value": "Attack/Ranged/Pierce",       "multiply": 1.05, "affects": "Ranged"  },
{"value": "Attack/Ranged/Spread",       "multiply": 0.99, "affects": "Ranged"  },
{"value": "Cost/BuildTime",             "multiply": 1.05                       },
{"value": "Heal/Range",                 "add":      1,    "affects": "Healer"  },
{"value": "Heal/Rate",                  "multiply": 0.95, "affects": "Healer"  },
{"value": "Health/Max",                 "multiply": 1.05                       },
{"value": "Loot/silver",                "add":      4,    "affects": "Biga"    },
{"value": "Loot/silver",                "add":      2,    "affects": "Camel"   },
{"value": "Loot/silver",                "add":      2,    "affects": "Cavalry" },
{"value": "Loot/silver",                "add":      6,    "affects": "Elephant"},
{"value": "Loot/silver",                "add":      1,    "affects": "Healer"  },
{"value": "Loot/silver",                "add":      1,    "affects": "Infantry"},
{"value": "ResourceGatherer/BaseSpeed", "multiply": 0.9                        },
{"value": "UnitMotion/WalkSpeed",       "multiply": 1.01, "affects": "Melee"   }
],
"tooltip": "Units promoted to the first rank gain +5% health, +5% attack damage, and +5% capture attack, but also +5% training time and -10% resource gather speed; melee units also have +1% movement walk speed and ranged units -1% spread. Healers have +1 m heal range and -5% rate."
}

10 minutes ago, bb_ said:

Is the string support really broken in there?,

In my recent diff I propose to change some misleading array scopes, like ["foo bar"]=="foo+bar"==[["foo", "bar"]] in where the first syntax is is misleading. And doesn't "foo bar" or "["foo, "bar"] represents the OR here?

No, I don't think so, I was just asking because I'd like to understand how it works.

##### Share on other sites
1 hour ago, bb_ said:

Is the string support really broken in there?,

In my recent diff I propose to change some misleading array scopes, like ["foo bar"]=="foo+bar"==[["foo", "bar"]] in where the first syntax is is misleading. And doesn't "foo bar" or "["foo, "bar"] represents the OR here?

Yes for specific affects, there is no support of the "+". You can try (or update) the related test of DeriveModificationsFromTech in test_Technologies.js

##### Share on other sites

48. Interestingly, it seems that neither:

{"value": "Loot/food",                "add":      1,    "affects": "Infantry Champion"},

nor:

{"value": "Loot/food",                "add":      1,    "affects": "Infantry"         },
{"value": "Loot/food",                "add":      1,    "affects": "Champion"         },

works; at least neither is showing up in the unit statistics:

All other modifications in the same file (attack, health, etc.) do work. So I suppose loot behaves a bit differently?

45. Anyone able to explain why selling resources works but buying not, after I added silver? And in which file can I replace the bribary cost of 500 metal with 250 silver?

##### Share on other sites
15 minutes ago, Nescio said:

All other modifications in the same file (attack, health, etc.) do work. So I suppose loot behaves a bit differently?

it s not done, that s why I ask to you if you have had it

##### Share on other sites
1 minute ago, fatherbushido said:

it s not done, that s why I ask to you if you have had it

Apparently I did not correctly understand your earlier post, allow me to apologize for my ignorance To clarify, modifying loot is not allowed? If that's the case, I'll shelve my ideas on ranks improving silver loot gains for now.

##### Share on other sites

It should be easy. There is even a patch for it on phabricator.

##### Share on other sites

48. This one? D408 So I have to add a few lines in simulation/data/components/Loot.js?

##### Share on other sites

48. Yes that's this one. (The tooltip should be change accordingly as those modifications are already handled in Template.js).

Don't consider that patch as officialy recommended. It is not reviewed.

(For example, take care of rounding issues, if you use only integers addition it will be fine).

45. Your modified files are on github?

##### Share on other sites
On 10/22/2017 at 3:12 PM, Nescio said:

45. Furthermore, I'd like to implement a special resource, silver (call it cash, coins, currency, gold, or whatever you like), which can not be gathered directly, but can be acquired by:

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.