Jump to content

Hyrule Conquest


Recommended Posts

9 hours ago, Nescio said:

Forgive me for jumping in a completely unrelated thread without reading anything but the last post, however, I believe I can at least partially answer this. /simulation/data/auras/structures/wonder_pop_2.json has a technology requirement:
"requiredTechnology": "pop_wonder",
and there is no reason why unit auras would behave differently. As for improving auras, I suppose this is also possible, albeit probably a bit less straightforward.

EDIT: Technologies can supersede each other; if this is also allowed with auras (I'm not sure), improving auras would be very easy; just create a new file for the improved aura aura_2.json which contains:
"supersedes": "aura_1",

I've gotten my aura research ideas to work thanks to you. :victory:

EDIT: Everything seems to work except putting supersedes into an aura. The unit just ends up having both auras without the first one being removed.

Edited by The Undying Nephalim
Link to comment
Share on other sites

A problem I am running into:

I'm adding a new resource into the game in the form of Rupees. This faction will not use metal, and I'd like metal to not be displayed at all for them and have Rupees replace the resource in the top left display. It seems like no matter what I do in setup_resources.xml and resources.xml it always displays Metal, even after deleting metal entries in the files. Is there any way to make it so that metal does not display for this one faction and my fifth resource does? Also is there a way to determine how much of this fifth resource the faction starts with?

Link to comment
Share on other sites

48 minutes ago, WhiteTreePaladin said:

If you want different resource amounts per player, then yes. If the resources were the same for all the civs, then the game setup could handle it.

Gamesetup could also handle different resources for each civ, but that would need adding some code to gamesetup.js

Link to comment
Share on other sites

24 minutes ago, The Undying Nephalim said:

I'm going to guess at the moment it's not possible to only display specific resources for specific civs? 
Would it be as simple as messing with some components or is it something that would have to be added to the engine?

I think that's just changing some GUI code..

I mean instead of disabling resources, you could just don't show them in the GUI for certain civs...

Link to comment
Share on other sites

36 minutes ago, Imarok said:

I think that's just changing some GUI code..

I mean instead of disabling resources, you could just don't show them in the GUI for certain civs...

That is what I would like to do, just not display metal for this one faction. What file might need to be edited to accomplish this?

Link to comment
Share on other sites

What role is metal going to play in your mod? If the player can gather, trade or barter it, it sounds like it should be visible.

I didn't follow the thread so I don't know if it's too much work to delete the metal from the templates or to create metal-free templates inheriting the existing ones.

(Originally there was a way to add disabled resources, but I didn't like the fact that the resource was still present in all XML files, i.e. leftovers and resource definition still in place).

Link to comment
Share on other sites

33 minutes ago, elexis said:

What role is metal going to play in your mod? If the player can gather, trade or barter it, it sounds like it should be visible.

I didn't follow the thread so I don't know if it's too much work to delete the metal from the templates or to create metal-free templates inheriting the existing ones.

(Originally there was a way to add disabled resources, but I didn't like the fact that the resource was still present in all XML files, i.e. leftovers and resource definition still in place).

Several of my civs will be using metal to construct their buildings, but otherwise it won't be used by many of the factions in my game. Many civs will have similar resources (Food for example is used by almost all of them), but one of the goals of my mod is to have civilizations with radically different resources and methods of collecting said resources. By the end of the mod there will probably be about 10 unique resources split across several civs, so I'll definitely need to have it so only 4 resources are displayed on the UI at a time.

  • Like 1
Link to comment
Share on other sites

Oh, interesting. So which resources will be shown depends on the players civ then.

So the resources json files could contain an array of civs that could be queried in all the places of the GUI.

Those aren't few at all. Top panel, tooltips.js, barter & trade dialog, summary screen come to my mind. You might want to look at gui/ code in 18964 to identify more and exact places (there were few follow-up commits too).

Perhaps the most maintainable approach would be to to make the four getters in globalscripts/Resources.js receive a Civ argument. One would have to check whether the summary screen likes that (perhaps it the totals might be off or something).

Link to comment
Share on other sites

2 hours ago, elexis said:

Perhaps the most maintainable approach would be to to make the four getters in globalscripts/Resources.js receive a Civ argument. One would have to check whether the summary screen likes that (perhaps it the totals might be off or something).

Alrighty, I'm trying to add a function that checks for civs in resources.js, I'm just a really terrible coder so I don't seem to be having any luck. Ideally I'm trying to to get a line to show up in each resources .json file that checks for civs like this:

{
    "code": "rupees",
    "name": "Rupees",
    "description": "Mine from Rupee Veins.",
    "order": 4,
    "subtypes": {
        "rupees": "Rupees",
        "goldrupees": "Golden Rupees",
    },
    "truePrice": 100,
    "aiAnalysisInfluenceGroup": "sparse"
    "civs": {"hylian", "gerudo"},
}

But again, my scripting knowledge is rusty at best and I'm not having much luck in resources.js

Link to comment
Share on other sites

On 9/9/2017 at 6:20 PM, The Undying Nephalim said:

Alrighty, I'm trying to add a function that checks for civs in resources.js, I'm just a really terrible coder so I don't seem to be having any luck. Ideally I'm trying to to get a line to show up in each resources .json file that checks for civs like this:


{
    "code": "rupees",
    "name": "Rupees",
    "description": "Mine from Rupee Veins.",
    "order": 4,
    "subtypes": {
        "rupees": "Rupees",
        "goldrupees": "Golden Rupees",
    },
    "truePrice": 100,
    "aiAnalysisInfluenceGroup": "sparse"
    "civs": {"hylian", "gerudo"},
}

But again, my scripting knowledge is rusty at best and I'm not having much luck in resources.js

 

On 9/9/2017 at 7:07 PM, wowgetoffyourcellphone said:

A civ argument to be awesome for mods. Put in main game plox. :)

also, whether the resource can be bartered, traded, tributed; true/false.

Link to comment
Share on other sites

6 hours ago, stanislas69 said:

@The Undying Nephalim How is it not working ? Do you get errors ?

I'm just not knowledgeable enough to script I guess. I sated by adding a few things in the Resources.js file:

    this.resourceData = [];
    this.resourceDataObj = {};
    this.resourceCodes = [];
    this.resourceNames = {};
    this.resourceCivs = [];

and

        this.resourceCivs.push(data);

After that though I'm lost. 

 

Link to comment
Share on other sites

GetResources, GetCodes and GetNames needs an optional civ argument.

If that argument is given (i.e. not undefined), then they should only return the results that match the civ.

(Almost?) all occurrences in gui/ of these functions (see the commit I had referenced somewhere above) should pass the the civ of the current player (g_Players[g_ViewedPlayer].Civ or something).

The simulation occurrences shouldn't be touched as they need to compute for units of all civs.

(Also not sure if it's something the public mod wants to support. Possibly it could, but there should be some good use case analysis and ruling out of weird things like coming past enemy trade carts that loot tons of metal, killing the units and then not getting the loot. What about sending resources to an ally? What about finding treasures that the civ ought not to support? and so forth)

Not hard to do, just costs time to go through all that code, as resources are used everywhere.

Link to comment
Share on other sites

8 hours ago, elexis said:

GetResources, GetCodes and GetNames needs an optional civ argument.

If that argument is given (i.e. not undefined), then they should only return the results that match the civ.

(Almost?) all occurrences in gui/ of these functions (see the commit I had referenced somewhere above) should pass the the civ of the current player (g_Players[g_ViewedPlayer].Civ or something).

 

So something like this in those functions?

Resources.prototype.GetResources = function()
{
    return this.resourceData;
    return this.g_Players[g_ViewedPlayer].Civ;
};

Still seems to be showing all five resources though. 

Link to comment
Share on other sites

Maybe the following example will help you understand.

 

foo = function()
{
	return 2;
}

bar = function()
{
	return 3;
}

foobar = function ()
{
	return 2;
	return 3;
}

let a =  foo(); // a = 2
let b = bar(); // b = 3;
let c = foobar(); // c = 2 because the function stops after the first return.

 

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...