Jump to content

Some auras and techs json syntax


Recommended Posts

For fixing some bugs I am changing the auras and technology affects syntax in the json files.

I would request inputs from @Nescio or @wowgetoffyourcellphone  (not exclusive) as currently active modders about what they prefer between type A and type B.

Type A:

affects: [["Pork", "Beans"]]

affects: [["Pork"]]

affects: [["Pork"], ["Bean"]]

Type B:

affects: "Pork+Beans"

affects: "Pork"

affects: "Pork Bean"

  • Like 1
Link to comment
Share on other sites

For example in: https://github.com/JustusAvramenko/delenda_est/blob/master/simulation/data/technologies/advanced_unit_bonus.json


{
	"genericName": "Stats for advanced units",
	"autoResearch": true,
	"description": "These stat modifications will be applied to advanced and elite units.",
	"modifications": [
		{"value": "ResourceGatherer/BaseSpeed", 	"multiply": 0.75                        		},
		{"value": "Health/Max",						"multiply": 1.1                       			},
		{"value": "Armour/Hack",					"add":      1                           		},
		{"value": "Armour/Pierce",					"add":      1                           		},
		{"value": "Armour/Crush",					"add":      1                           		},
		{"value": "UnitMotion/WalkSpeed",			"multiply": 0.95, "affects": "Infantry" 		},
		{"value": "UnitMotion/WalkSpeed",			"multiply": 0.95, "affects": "Cavalry"  		},
		{"value": "Attack/Ranged/Damage/MaxRange",	"multiply": 1.2,  "affects": "Ranged"   		},
		{"value": "Vision/Range",					"multiply": 1.2,  "affects": "Ranged"   		},
		{"value": "Attack/Ranged/Damage/Spread",	"multiply": 0.90, "affects": "Ranged"   		},
		{"value": "Attack/Melee/Damage/Hack",		"multiply": 1.1,  "affects": "Melee"    		},
		{"value": "Attack/Capture/Capture",			"multiply": 1.1                         		},
		{"value": "Heal/Range",						"multiply": 1.1,  "affects": "Healer"   		},
		{"value": "Vision/Range",					"multiply": 1.1,  "affects": "Healer"   		},
		{"value": "Heal/HP",						"multiply": 1.1,  "affects": "Healer"   		},
		{"value": "Cost/Resources/food",			"add": 5,  		  "affects": "Citizen Soldier -Mercenary"	},
		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Archer -Mercenary"   		},
		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Spear -Mercenary"    		},
		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Javelin -Mercenary"  		},
		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Crossbow -Mercenary" 		},
		{"value": "Cost/Resources/metal",			"add": 5,  		  "affects": "Sword -Mercenary"    		},
		{"value": "Cost/Resources/metal",			"add": 5,  		  "affects": "Sling -Mercenary"    		},
		{"value": "Cost/Resources/glory",			"add": 5,  		  "affects": "Healer"   		},
		{"value": "Cost/BuildTime",					"add": 2,  		  "affects": "Citizen"			}
	],
	"affects": ["Advanced Unit", "Elite Unit"]
}

 

Which one of those two things would you prefer (in any case there are scripts to do it auto):

"affects": [["Advanced", "Unit"], ["Elite", "Unit"]]

or

"affects": "Advanced+Unit Elite+Unit"

 

Link to comment
Share on other sites

2 hours ago, fatherbushido said:

For fixing some bugs I am changing the auras and technology affects syntax in the json files.

What exactly is wrong with the current syntax? I'm not saying is perfect, but I'm used to it now.

If it is to be changed, I'd recommend following the syntax used in the xml templates, i.e. a space means “or” and a plus means “and”.

20 minutes ago, fatherbushido said:

"affects": "Advanced+Unit Elite+Unit"

 

I'd also favour that one (less typing than the alternative with square brackets). This would even be shorter:

	"affects": "Unit+(Advanced Elite)"

(I'm not entirely sure that's an improvement, though.)

Link to comment
Share on other sites

8 minutes ago, Nescio said:

What exactly is wrong with the current syntax? I'm not saying is perfect, but I'm used to it now.

It's bugged and source of confusions.

I expected that the second form I suggested would be preferred. I will opt for that one.

The shorter form you suggest can't be supported. You need to put things in disjunctive normal form.

Edited by fatherbushido
Link to comment
Share on other sites

4 minutes ago, fatherbushido said:

It's bugged and source of confusions.

I expected that the second form I suggested would be preferred. I will opt for that one.

Once you've done that in your fork, perhaps you could consider making a patch for 0 A.D. as well?

I don't know if and when you intend to release your project, but having a different syntax would mean more work for modders, if they decide to switch or port from one to the other.

41 minutes ago, fatherbushido said:

		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Archer -Mercenary"   		},

 

Shouldn't that be "Archer+!Mercenary"?

Link to comment
Share on other sites

17 minutes ago, Nescio said:

 but having a different syntax would mean more work for modders, if they decide to switch or port from one to the other.

Indeed that's problematic :/

We try to document the more we can and I had already offered to helping in converting mods. If there are massive changes, we try to make them scriptable.

17 minutes ago, Nescio said:

Shouldn't that be "Archer+!Mercenary"?

Yes it should. (But anyway none of them will work as expected here.)

Link to comment
Share on other sites

Oh, 
I see what can cause confusion. It is mixed version, I do not like that one really.
Btw @wowgetoffyourcellphone if you want "value": "Cost/Resources/wood", "add": 5, "affects": "Archer !Mercenary"  to be Archer AND NOT Mercenary you need to enclose that into [ ] so it would be like

["Archer !Mercenary"] what can be ["Archer+!Mercenary"] (I know, bleh)

or

"Archer+!Mercenary"

or

[["Archer", "!Mercenary"]]

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