Jump to content

How to change all units, resources and (garrisonabble) buildings


BeTe
 Share

Recommended Posts

Hey.

I have idea to change all units to make game less unit spammy but to keep gameplay exactly same.

So is there way to make script (JS?) that will apply following to all entities:

  • Units would be double cost
  • double time to build
  • double damage
  • double resistance
  • double gather rate
  • double capture rate
  • Buildings will have less garison capacity
  • Fields&Resources will be reduced to 2x less worker capacity.
  • etc.

...? Possible?

Link to comment
Share on other sites

iirc those values you found determine the AI difficulty. But generally that sounds like a nice idea for a mod to test how that would play out :)

You may want to look at https://code.wildfiregames.com/D4250 and there specifically at the file " binaries/data/mods/public/simulation/data/technologies/special/turbo_match.json "

You basically only need one auto-researched tech file, that changes the appropriate values

I.e. for you goals you would need:

		{ "value": "Cost/BuildTime", "multiply": 2},
		{ "value": "ProductionQueue/TechCostMultiplier/time", "multiply": 2}

instead of 0.5 and

"affects": ["Unit"],

instead of "affects": ["Unit", "Structure"],

 

(and the same can be done for the capture rate ect... -> See how it's done in other techs https://github.com/0ad/0ad/tree/master/binaries/data/mods/public/simulation/data/technologies)

  • Like 1
Link to comment
Share on other sites

1. For some reason below code does nothing.

Mod is enabled b/c it returned me error when I uploaded wrong format JSON.

 

image.thumb.png.3393e1c34ce71e8f89b5142717a66e3e.png

 

 

2. I also tried below in initGame.js but still no change in times:

// Source Delenda Est!

function InitGame(settings)
{
    // No settings when loading a map in Atlas, so do nothing
    if (!settings)
    {
        // Map dependent initialisations of components (i.e. garrisoned units)
        Engine.BroadcastMessage(MT_InitGame, {});
        return;
    }
    let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager);

    for (let i = 0; i < settings.PlayerData.length; ++i) {
        let cmpPlayer = QueryPlayerIDInterface(i);
        cmpModifiersManager.AddModifiers("All player bonus", {
            // "ResourceGatherer/BaseSpeed": [{ "affects": ["Unit", "Structure"], "multiply": rate[AIDiff] }],
            // "Trader/GainMultiplier": [{ "affects": ["Unit", "Structure"], "multiply": rate[AIDiff] }],
            "Cost/BuildTime": [{ "affects": ["Unit"], "multiply": 4 }]
        }, cmpPlayer.entity);
    }
}

@maroder

Link to comment
Share on other sites

p.s.

I also tried with .../templates/template_unit.xml like this:

<?xml version="1.0" encoding="utf-8"?>
<Entity>
  <AIProxy/>
  <Cost>
    <Population>1</Population>
    <BuildTime op="mul">3</BuildTime>
    <Resources>
      <food op="mul">3</food>
      <wood op="mul">3</wood>
      <stone op="mul">3</stone>
      <metal op="mul">3</metal>
    </Resources>
  </Cost>
  <Decay>

....

I copied entire file from community-mod and just changed these two: <Resources> and <BuildTime>  

But no change, no error, nothing.

Edited by BeTe
Link to comment
Share on other sites

5 hours ago, maroder said:
"autoResearch": true,

 

Yeah now it works. Awesome.

Can I modify all child notes? Now I have:

 

       { "value": "Attack/Melee/Damage/Hack", "multiply": 2 },
        { "value": "Attack/Melee/Damage/Pierce", "multiply": 2 },
        { "value": "Attack/Melee/Damage/Crush", "multiply": 2 }

I tried "Attack/*" but it doesn't recognize.

Link to comment
Share on other sites

36 minutes ago, Stan&#x60; said:

@BeTe would you like to make available through 0ad.mod.io ?

Hm, then it would be 1 click download directly from 0AD > Seetings > Mods, right? Idk, it would make it easier to test, but not sure if you want to have unfinished mods there...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...