Jump to content

City phase/p3 two difrerent requirements?


Emacz
 Share

Recommended Posts

Does anyone know if its possible to have p3 cost X village buildings + y town buildings? Below failed :)

},
    "requirements": {
        "entity": {
            "class": "Village",
            "number": 25,
            "class": "Town",
            "number": 2
        }
    },
    "require

Link to comment
Share on other sites

},
    "requirements": {
    "entity": [{
        "class": "Village",
        "number": 25
        }, {
        "class": "Town",
        "number": 2
    }]
},

i did this with no errors, but it went right to p3 after p2 :(

Link to comment
Share on other sites

  On 06/02/2025 at 6:53 PM, Emacz said:

how so?

Expand  

An example from DE:

 

  Quote

{
    "supersedes": "shipyard/training_naval_shipwrights",
    "genericName": "Arsenal of Philon",
    "description": "Unlock health regeneration for your Warships.",
    "cost": {
        "stone": 500,
        "glory": 500
    },
    "requirements": {
        "all": [
            { "tech": "phase_empire" },
            { "civ": "athen" }
        ]
    },
    "requirementsTooltip": "Unlocked in Empire Phase. Requires “Shipwrights.”",
    "icon": "arsenal_of_philon.png",
    "researchTime": 50,
    "tooltip": "Warships +1 health/second self-repair rate.",
    "modifications": [
        { "value": "Health/RegenRate", "add": 1 }
    ],
    "affects": ["Warship"],
    "soundComplete": "interface/alarm/alarm_upgradearmory.xml"
}
 

Expand  

 

Link to comment
Share on other sites

},
    "requirements": {
    "entity": [{
        "class": "Village",
        "number": 25
        }, {
        "class": "Town",
        "number": 2
    }]
},
does the  "all" replace entity? im still pretty nub at this, so i would almost need to see an exact replica and copy paste.  

Link to comment
Share on other sites

},
    "requirements": {
     "all"[
    "entity": {
        "class": "Village",
        "number": 25
        }, {
        "class": "Town",
        "number": 2
    }]
},
 

Link to comment
Share on other sites

	"requirements": {
		"all": [
			"entity": {
				"class": "Village",
				"number": 25
			}
			"entity": {
				"class": "Town",
				"number": 2
			}
		]
	},

Something like this. Also, in json files, we use tabs instead of spaces. In XML files, such as actors or templates, we use two spaces in lieu of tabs.

 

Also, "any" instead of "all" in a situation like this gives the player to either build 25 village phase structures or 2 town phase strictures, which could be interesting depending on what you're going for. Make sure to be very explicit about the requirements in your "tooltip:" section. 

 

I hope this helps! :D 

  • Like 1
Link to comment
Share on other sites

  On 07/02/2025 at 1:15 AM, wowgetoffyourcellphone said:
	"requirements": {
		"all": [
			"entity": {
				"class": "Village",
				"number": 25
			}
			"entity": {
				"class": "Town",
				"number": 2
			}
		]
	},

Something like this. Also, in json files, we use tabs instead of spaces. In XML files, such as actors or templates, we use two spaces in lieu of tabs.

 

Also, "any" instead of "all" in a situation like this gives the player to either build 25 village phase structures or 2 town phase strictures, which could be interesting depending on what you're going for. Make sure to be very explicit about the requirements in your "tooltip:" section. 

 

I hope this helps! :D 

Expand  

Thanks!! One day i will understand all of this. I hope :)

Link to comment
Share on other sites

  On 07/02/2025 at 1:15 AM, wowgetoffyourcellphone said:
	"requirements": {
		"all": [
			"entity": {
				"class": "Village",
				"number": 25
			}
			"entity": {
				"class": "Town",
				"number": 2
			}
		]
	},

Something like this. Also, in json files, we use tabs instead of spaces. In XML files, such as actors or templates, we use two spaces in lieu of tabs.

 

Also, "any" instead of "all" in a situation like this gives the player to either build 25 village phase structures or 2 town phase strictures, which could be interesting depending on what you're going for. Make sure to be very explicit about the requirements in your "tooltip:" section. 

 

I hope this helps! :D 

Expand  

looks like i still mananged to mess it up :banger:

<p class="error">ERROR: JavaScript error: globalscripts/ModificationTemplates.js line 15
JSON.parse: expected ',' or ']' after array element at line 16 column 12 of the JSON data
  ModificationTemplates@globalscripts/ModificationTemplates.js:15:33
  LoadModificationTemplates@globalscripts/ModificationTemplates.js:44:31
  @simulation/helpers/ModificationTemplates.js:2:1
  launchGame@gamesettings/GameSettings.js:160:11
  launchGame@gui/gamesetup/Controllers/GameSettingsController.js:288:18
  onPress@gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/StartGameButton.js:51:52</p>
<p class="error">ERROR: Failed to parse 'simulation/data/technologies/phase_city_spart.json'</p>
<p class="error">ERROR: JavaScript error: simulation/components/TechnologyManager.js line 215
allTechs[key] is undefined
  TechnologyManager.prototype.Init@simulation/components/TechnologyManager.js:215:7
  PlayerManager.prototype.AddPlayer@simulation/components/PlayerManager.js:18:21
  LoadPlayerSettings@simulation/helpers/Player.js:44:21</p>
<p class="error">ERROR: JavaScript error: globalscripts/ModificationTemplates.js line 15
JSON.parse: expected ',' or ']' after array element at line 16 column 12 of the JSON data

Link to comment
Share on other sites

  On 07/02/2025 at 1:15 AM, wowgetoffyourcellphone said:
	"requirements": {
		"all": [
			"entity": {
				"class": "Village",
				"number": 25
			},
			"entity": {
				"class": "Town",
				"number": 2
			}
		]
	},

 

Expand  

I kissed the comma between Entity entries. 

 

Make sure to read the error messages. Sometimes they are helpful, specifically this line:

  Quote


JSON.parse: expected ',' or ']' after array element at line 16 column 12 of the JSON data

 

Expand  


 

Link to comment
Share on other sites

  On 07/02/2025 at 2:20 AM, wowgetoffyourcellphone said:

I kissed the comma between Entity entries. 

 

Make sure to read the error messages. Sometimes they are helpful, specifically this line:


 

Expand  

I ready it, but again it still so new to me.  I took a look and wasnt sure.

I spent like 6 hours working on 2-3 templates doing them over and over trying to figure out what was wrong.  Im so inefficient at this.

  • Like 1
Link to comment
Share on other sites

  On 07/02/2025 at 2:20 AM, wowgetoffyourcellphone said:

I kissed the comma between Entity entries. 

 

Make sure to read the error messages. Sometimes they are helpful, specifically this line:


 

Expand  

cause now it is saying:  expected ',' or ']' after array element at line 17 column 12

which would be "entity": { between the " and

and adding a space there doesnt work. 

JSON.parse: unexpected character at line 17 column 13 of the JSON data when i try this:

requirements": {
        "all": [
            "entity",: {
                "class": "Village",
                "number": 25
            },
            "entity",: {
                "class": "Town",
                "number": 2
            }
        ]
    },

<p class="warning">WARNING: Unknown requirement operator: 0</p> when i try this:

"requirements": {
        "all": [
            "entity", {
                "class": "Village",
                "number": 25
            },
            "entity", {
                "class": "Town",
                "number": 2
            }
        ]
    },

Edited by Emacz
Link to comment
Share on other sites

  On 07/02/2025 at 6:38 AM, hyperion said:

I recommend to use a text editor with syntax highlighting.

Expand  

@Emacz, you should do this, it will help you NOT wast time on very lame syntax mistakes. As well, modifying the templates, you will always work with objects and arrays. So it would be useful for you to memorize their structure.
Javascript-domJavascript-dom?u=https%3A%2F%2Ftse4.mm.bing.net%2Fth%3Fid%3DOIP.GEH9KMZeVYWRtusHawiMvgHaEF%26pid%3DApi&f=1&ipt=582575018d7975b1c986e9a4d51dce21e2f0c32c92c50d694d0989da0f0cb87b&ipo=images

  • Like 2
Link to comment
Share on other sites

  On 07/02/2025 at 6:38 AM, hyperion said:

I recommend to use a text editor with syntax highlighting.

Expand  

 

  On 07/02/2025 at 10:25 AM, Atrik said:

@Emacz, you should do this, it will help you NOT wast time on very lame syntax mistakes. As well, modifying the templates, you will always work with objects and arrays. So it would be useful for you to memorize their structure.
Javascript-domJavascript-dom?u=https%3A%2F%2Ftse4.mm.bing.net%2Fth%3Fid%3DOIP.GEH9KMZeVYWRtusHawiMvgHaEF%26pid%3DApi&f=1&ipt=582575018d7975b1c986e9a4d51dce21e2f0c32c92c50d694d0989da0f0cb87b&ipo=images

Expand  

Ill defintely have to take a look!  Otherwise i may go crazy

 

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