Jump to content
Sign in to follow this  
Nescio

How to modify 0 A.D.?

Recommended Posts

22 hours ago, Imarok said:

rP21256        changes the difficulty, so you can look where the difficulty is set. Then you could look where this variable is used.

Many thanks for pointing that out; it turns out I can ignore the AI files, all I need is only edit  simulation/helpers/InitGame.js lines 44 to 48:

	// Sandbox, Very Easy, Easy, Medium, Hard, Very Hard
	// rate apply on resource stockpiling as gathering and trading
	// time apply on building, upgrading, packing, training and technologies
	let rate = [ 0.42, 0.56, 0.75, 1.00, 1.25, 1.56 ];
	let time = [ 1.40, 1.25, 1.10, 1.00, 1.00, 1.00 ];

 

Share this post


Link to post
Share on other sites

I'm trying to make a mod where I delete the background image on /art/textures/ui/pregame/backgrounds/carthage1_1.png.cached.dds.

I tried to put in my mod the files:

/art/textures/ui/pregame/backgrounds/carthage1_1.png.cached.dds.DELETE

/art/textures/ui/pregame/backgrounds/carthage1_1.png.DELETE

None of those worked, the picture is still loaded. Am I doing something wrong?

Share this post


Link to post
Share on other sites

57. How does elevation bonus work exactly?

I've given template_structure_defensive_tower.xml a <MaxRange> of 18 and an <ElevationBonus> of 6. The outpost has both multiplied by 2.0, the small tower by 3.0, the large tower by 4.0, so I'd expect their respective ranges to be 36+12, 54+18, and 72+24; instead, they show up as 36+10, 54+16, and 72+21.

Furthermore, the siege tower has 60+10 in my mod, but it shows up as 60+9.

Share this post


Link to post
Share on other sites
On 2/24/2019 at 3:36 PM, fatherbushido said:

It's the height added to the terrain height.

Yes, I assumed so; but what's the result exactly? E.g. do the following give effectively different results?

  • 80 max range + 0 elevation bonus
  • 40 max range + 40 elevation bonus
  • 0 max range + 80 elevation bonus

By the way, the range visualization seems to ignore the elevation bonus; is that intentional?

Share this post


Link to post
Share on other sites
1 hour ago, Nescio said:

Yes, I assumed so; but what's the result exactly? E.g. do the following give effectively different results?

  • 80 max range + 0 elevation bonus
  • 40 max range + 40 elevation bonus
  • 0 max range + 80 elevation bonus

The game is basically a 2D game.

max range is the horizontal range.

elevation bonus is added to the height of the launcher.

Assuming parabolic trajectory, there is an elegant result giving the new range (the hypothenuse of the new triangle - not the horizontal range). From that one you get the new horizontal range.

There are some more details to add but I guess that is enough.

1 hour ago, Nescio said:

By the way, the range visualization seems to ignore the elevation bonus; is that intentional?

I don't know, I didn't follow those commits.

Share this post


Link to post
Share on other sites
47 minutes ago, fatherbushido said:

the hypothenuse of the new triangle - not the horizontal range

Do you mean TotalRange² = MaxRange² + ElevationBonus² ?

Share this post


Link to post
Share on other sites
25 minutes ago, fatherbushido said:

No I don't. I will write the thing if you want.

Yes, I don't quite understand how it works, therefore a lengthier explanation would be appreciated.

  • Like 1

Share this post


Link to post
Share on other sites
On 10/22/2017 at 9:12 PM, Nescio said:

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.

Hi! I don't know whether this has already been fixed for you, but for the first part of your question it worked for me to find in the ResourceSupply.js the entry ResourceSupply.prototype.TakeResources. There I changed:

	// Remove entities that have been exhausted
	if (this.amount === 0)
		Engine.DestroyEntity(this.entity);

to

	// Remove entities that have been exhausted.
	if ("RemoveWhenEmpty" in this.template)
	{
		if (this.amount == 0 && this.template.RemoveWhenEmpty == "true")
			Engine.DestroyEntity(this.entity);
	}
	else
		if (this.amount == 0)
			Engine.DestroyEntity(this.entity);

And of course for that to work one needs:


	"<optional>" +
		"<element name='RemoveWhenEmpty' a:help='Whether this entity must be removed from the world when its supply is emptied'>" +
			"<data type='boolean'/>" +
		"</element>" +
	"</optional>" +

in the ResourceSupply.prototype.Schema and the appropriate flag in the fruit tree's XML-file.

I've used this so I can let farms be exhausted due to farming, but they still can regenerate (but only when worked with at least one villager (some extra code is needed for that)). Note that I don't use the SVN-version of 0AD, just A23b with a modified version of DE.

 

While I'm at it, I have a question myself: Is it possible to give capture points to a building foundation? So that one could finish a building an enemy had begun to construct but was unable to finish?

Share this post


Link to post
Share on other sites
2 hours ago, Freagarach said:

While I'm at it, I have a question myself: Is it possible to give capture points to a building foundation? So that one could finish a building an enemy had begun to construct but was unable to finish?

I think it should be.

Share this post


Link to post
Share on other sites
On 3/16/2019 at 3:31 PM, stanislas69 said:

I think it should be.

It can indeed be done. For anyone interested: add the "capturable" element in "templates/special/filter/foundation.xml".

  • Like 1

Share this post


Link to post
Share on other sites
On 8/19/2017 at 9:43 PM, Nescio said:

19. Something else I'd like to do is replacing the basic/advanced/elite ranks with a smoother promotion system: all soldiers start at rank 0, and can promote up to twelve times to rank 12; each rank grants +5% health, attack damage, and capture strength, but also -10% resource gather rate. Therefore I have to create new files for each rank (e.g. gaul_infantry_swordsman_7) and replace <Rank>Basic</Rank> with <Rank>0</Rank> under <Identity> in the general template file.

I know you use techs now to increase the ranks, but you might want to take a look at Experience method of the Batalion mod (https://github.com/SlavomirSlovenkai/0ad-gameplay-mode). As far as I can tell from the code used it uses "experience"-files (in the simulation/data-folder) to upgrade a unit after every promotion (currently only the first template is applied over and over again untill the maximum level). I don't know whether it is useful for you, but I have had some fun tinkering with it. 

Share this post


Link to post
Share on other sites

Actually I had thirteen ranks (zero to twelve) per unit in the A22 version but I didn't carry it over to the A23 version, because with those thousands of tiny templates starting a new game with AIs was frustratingly slow.

Share this post


Link to post
Share on other sites

I've also got a few questions. I took the liberty of continuing your numbering Nescio.

58. Is it possible to change an actor's look (i.e. VisualActor) using a tech (explicitly not via upgrading to another template)? Preferably just part of the entity, like when one upgrades the shields of pikemen in the Blacksmith the shields actually change. The reason why I'm asking is because I've introduced a more fluent experience system, like in the Batalion-mod, but now the only way to see the difference between a basic and an elite soldier is by looking at its rank icon (which is not too bad I guess). If it is possible, could one point me in the right direction? The only VisualActor (c-)component I could find was in simulation2/components where I did find a MT_ValueModification listener, so I tried:

	let newActorName = [];
	newActorName.push("units/athenians/infantry_spearman_a.xml");
warn(uneval(newActorName));
	Engine.BroadcastMessage(MT_ValueModification, { "entities": [this.entity], "component": "VisualActor", "valueNames": newActorName});

as a test using an Athenian Hoplite, but it does not work. No error, but also no change in appearance. Any help would be appreciated.

59. Another "is it possible" ;) I want to change the ability to select a single entity, e.g. when a unit goes berserk, it should not be selectable for a while. I found out that one can do that by using an upgrade, so the template changes, but any ideas how I can do it without the template-changing? (To make it reversible.)

Edited by Freagarach
  • Like 2

Share this post


Link to post
Share on other sites

Regarding 59.: I discarded the idea to make a unit unselectable, but I now let it ignore all orders. However, for this I need to set (in UnitAI.js)

			// Ignore orders.
			"Order.Attack": function(){
			},
			"Order.Move": function(){
			},

for every order that can be given and for every stance that needs it (e.g. broken, amok, berserk), which is bad in my opinion. Is there, to anyones knowledge, a more general way of ignoring all orders? And if there is, could one point me in that direction?

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, Freagarach said:

Regarding 59.: I discarded the idea to make a unit unselectable, but I now let it ignore all orders. However, for this I need to set (in UnitAI.js)


			// Ignore orders.
			"Order.Attack": function(){
			},
			"Order.Move": function(){
			},

for every order that can be given and for every stance that needs it (e.g. broken, amok, berserk), which is bad in my opinion. Is there, to anyones knowledge, a more general way of ignoring all orders? And if there is, could one point me in that direction?

some animals ignore all orders no ?

Share this post


Link to post
Share on other sites
1 hour ago, Stan` said:

some animals ignore all orders no ?

Yes (well, not *all*), but that is on the order-side of things. That would already trigger a "leave" in the state.

Share this post


Link to post
Share on other sites
11 minutes ago, Freagarach said:

Yes (well, not *all*), but that is on the order-side of things. That would already trigger a "leave" in the state.

Well it depends on whether they are domestic or not. But one could make units go wild :)

Share this post


Link to post
Share on other sites
41 minutes ago, Stan` said:

Well it depends on whether they are domestic or not. But one could make units go wild :)

Yes, they can go very wild. I always loved in Rome TW the Germanic Berserkers rage through the battlefield.

In 0AD however, there is a problem: if I would let units attack anything it triggers leaving the berserk state to get in the combat.approaching-state (thus reacting to orders again). So I either have to copy the code from the approaching-state to berserk.approaching (which would increase duplicity) or pospone that for now ;)

Share this post


Link to post
Share on other sites
58 minutes ago, Freagarach said:

Yes, they can go very wild. I always loved in Rome TW the Germanic Berserkers rage through the battlefield.

In 0AD however, there is a problem: if I would let units attack anything it triggers leaving the berserk state to get in the combat.approaching-state (thus reacting to orders again). So I either have to copy the code from the approaching-state to berserk.approaching (which would increase duplicity) or pospone that for now ;)

Or make a function ? :)

Share this post


Link to post
Share on other sites
On 5/26/2019 at 12:11 PM, Freagarach said:

Yes (well, not *all*), but that is on the order-side of things. That would already trigger a "leave" in the state.

Improper coding on my side. It does *not* trigger a leave when returning early.

Share this post


Link to post
Share on other sites

mythology mod has rage stance  for units, you cant controll it and unit attacks as long there is  enemy unit in its los

Edited by Angen

Share this post


Link to post
Share on other sites

60. Currently 0 A.D. has “Wonder” and “Capture the Relic” victory conditions. I've been pondering about adding another, similar one, winning by centre count, e.g. control at least 10 centres for 10 minutes. Moving catafalques inside a heavily fortified base or concentrating your forces around a wonder is easier than protecting a number of centres with distances in between.

Unfortunately I have no idea what has to be done to implement it. Any suggestions?

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...