Jump to content

How to modify 0 A.D.?


Nescio
 Share

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 ];

 

Link to comment
Share on other sites

  • 4 weeks later...

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?

Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
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?

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...
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?

Link to comment
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.

Link to comment
Share on other sites

  • 3 weeks later...
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. 

Link to comment
Share on other sites

  • 3 weeks later...

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
Link to comment
Share on other sites

  • 1 month later...

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
Link to comment
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 ?

Link to comment
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 :)

Link to comment
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 ;)

Link to comment
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 ? :)

Link to comment
Share on other sites

  • 1 month later...

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?

Link to comment
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.

 Share

×
×
  • Create New...