Midonik - unit json 1(json edit, bonuslist, jsonizing)

Here i will list the apprentices and their learning tasks, so others also can follow how it goes.
Please DONT POST HERE any solutions on the given task earlier than the apprentice, you can ask questions from him tough.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Midonik - unit json 1(json edit, bonuslist, jsonizing)

Post by Stratego (dev) »

The first task was to modify a few bonuses on an AOW unit, here was the json of Hummel and the bonus list was this to be modified to.

+100% buildings
+100% infantry
+600% Ships_Carrier
+600% battleships
+100% light tanks
+50% medium tanks
Attachments
unit_ger_artillery_spg_hummel.json
(3.96 KiB) Downloaded 137 times
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik »

Attachments
unit_ger_artillery_spg_hummel-1.json
(3.97 KiB) Downloaded 118 times
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

good job!

- you have mistyped the category names, the game dropped an error, you have to COPY+PASTE all referencing names if you dont want to get any errors.
- dont forget to keep the filename (i need to overwrite the original if there is any file update)
- also i have indented a bit the new lines to look nice (this is just for us (you, me, anyone) who change configuration files, to see the configuration easily)

see the fixes attached.

other than that, it is fine! it is in the game in next update.
thanks!
Attachments
unit_ger_artillery_spg_hummel.json
(3.97 KiB) Downloaded 138 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

next task KV2:
Fix this,
http://www.ageofstrategy.net/viewtopic.php?f=55&t=4128

here is the json
Attachments
unit_ru_artillery_SPG_KV2.json
(3.96 KiB) Downloaded 126 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

+ also fix the bonus too for the KV2. thanks.
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik »

Should I change buliders from GER_BUD_GUN_FACTORY into RUS_BUD_TANKS_FACTORY or somethink?
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

nice that you have detected it! sure!
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik »

Attachments
unit_ru_artillery_SPG_KV2.json
(3.97 KiB) Downloaded 118 times
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

there are mistypings in category names: i advise to use copy+paste to avoid it.
also each bonus can be one row as the original, please make such.

thanks!
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik »

Stratego (dev) wrote:there are mistypings in category names: i advise to use copy+paste to avoid it.
Ok,but is "RUS" correct,becouse I dont see any russian unit Json to copy it.
Stratego (dev) wrote: also each bonus can be one row as the original, please make such.
I dont undenstand.
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik »

Oh,wait,you mean in one line?
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

"nations" of AOW are updated in races json FAQ.

nice alignment:

here is a nice alignment, one bonus is one row, so we can see it tru easily:

Code: Select all

        "trnBonusList":[
               	{"modifier":1, "unitList":{"categories":["U_BUILDINGS"]}},
               	{"modifier":1, "unitList":{"categories":["U_INFANTRY"]}},
               	{"modifier":6, "unitList":{"categories":["U_SHIPS_CARRIER"]}},
               	{"modifier":6, "unitList":{"categories":["U_SHIPS_BATTLESHIP"]}},
               	{"modifier":1, "unitList":{"categories":["U_TAN KS_LIGHT"]}},
               	{"modifier":0.5,"unitList":{"categories":["U_TANKS_MEDIUM"]}}
           ],
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik »

Like that? (Change choosing sound into "RU")
https://jsonformatter.curiousconcept.com/
Attachments
unit_ru_artillery_SPG_KV2.json
(3.94 KiB) Downloaded 123 times
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

game says you made wrong reference to factory, please check the factory reference name and copy-paste that.
also i made the indentataion as i tried to tell you , see how it looks:
Attachments
unit_ru_artillery_SPG_KV2.json
(3.95 KiB) Downloaded 120 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

Also nice you have changed sounds to russian too!
(how did u know that it is called same but RU in it? :) )
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik »

I thought its ofcourse that it sounds same but with russian "tag" instand of german,becouse... it makes sense.
Is it good now?
Attachments
unit_ru_artillery_SPG_KV2.json
(3.93 KiB) Downloaded 121 times
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

checking...

sound: good thoughts - however in future you always need to check the codename of everything and copy paste it - because if you type it yourself, you can have several errors so the game will not start. but this time it was a good guess!
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

i see that you have not checked my indentation suggestions , so i am fixing in yours again - please check it.
also iam compiling it we will see if everything is ok.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

this was your indentation (top) and mine (bottom) with one-row-alignment:

Code: Select all

         
"trnBonusList":[
{"modifier":1,   "unitList":
{"categories":["U_BUILDINGS"]}},
{"modifier":1,   "unitList":
{"categories":["U_INFANTRY"]}},
{"modifier":6,   "unitList":
{"categories":["U_SHIPS_CARRIER"]}},
{"modifier":6,    "unitList":
{"categories":["U_SHIPS_BATTLESHIP"]}},
{"modifier":1,    "unitList":
{"categories":["U_TANKS_LIGHT"]}},
{"modifier":0.5,  "unitList":
{"categories":["U_TANKS_MEDIUM"]}}
],


   "trnBonusList":[
		{"modifier":1,   "unitList": {"categories":["U_BUILDINGS"]}},
		{"modifier":1,   "unitList": {"categories":["U_INFANTRY"]}},
		{"modifier":6,   "unitList": {"categories":["U_SHIPS_CARRIER"]}},
		{"modifier":6,    "unitList": {"categories":["U_SHIPS_BATTLESHIP"]}},
		{"modifier":1,    "unitList": {"categories":["U_TANKS_LIGHT"]}},
		{"modifier":0.5,  "unitList": {"categories":["U_TANKS_MEDIUM"]}}
	],

Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) »

game dropped error: on BLD_RU_TANK_FACTORY
the good identificator is this: UNIT_RU_BLD_TANK_FACTORY

You need to always check the name (i have uploaded all json files in a post in FAQ) and copy+paste it.
i have fixed it now, you can see here attached the final json.

thanks!
Attachments
unit_ru_artillery_SPG_KV2.json
(3.96 KiB) Downloaded 106 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json (json edit, bonuslist)

Post by Stratego (dev) »

next is a jsonizeing

turn this AOF unit to json based

- find a similar and make the json based on that.
- id: UNIT_BROAD_SWORDMAN = 66;
- image: see in bottom section


else if (u.type == UNIT_BROAD_SWORDMAN){

u.fillTexts(c, "UNIT_BROAD_SWORDMAN");
u.costTurn = 2;

u.sight = 4; //visiblity range
u.hpMax = 21; //health points
u.armorPierce = 0; //how big the armor against arrows
u.armorNormal = 0; //how big the armor against normal attack
u.power = 11; // u.power of its attack
u.rangeWalk = 3; // how far it can walk
u.canWalkHill = false;
u.canWalkForest = true;
u.canOccupyBuilding = true;
u.canBeCarried = true;
u.bonusHealing = 1; // if this unit have bonus when it is healed by an other unit. 1,1 means 10% bonus.
u.convertResistance = 0; // victim property: 0.2 = 20% -> if priest has 30% than 30 - 30*0,2 => priest has 26% to convert.

//bonus(u, a (U_BUILDINGS, UNIT_BATTERING_RAM), 1f);
bonusG(u,
a (U_BUILDINGS, UNIT_BATTERING_RAM), 1f,
new Gb(U_FORTIFIED_BUILDINGS, 2f),
new Gb(U_MEGA_BUILDINGS, 7f)
);

u.bestAgainstMeGround = U_ANTI_INFANTRY;
u.bestAgainstMeWater = U_SHIP_ATTACK;

u.modifiers = new int[]{//"type"-s (TECH) that modifies its properties
TECH_ARMOR_INFANTRY_LV1,
TECH_ARMOR_INFANTRY_LV2,
TECH_SWORD_LV1,
TECH_SWORD_LV2,
EFFECT_POISONED_ARROWS,
};


u.builders = new int[]{ //is it built in a TC? or in an archery range? or a worker builds it?
UNIT_TC,
UNIT_BUILDING_BARRACKS
};

u.requires = new int[]{//"type"-s that is required (eg. other techonolgies) to have/build this one
TECH_UPGRADE_UNIT_BROAD_SWORDSMAN
};
u.races = new int[] { // only these races can build this
RacesLoader.RACE_HUMAN
};

}//typeif

public static class UiUnitBroadSwordMan extends Ui.UiUnit{

//The ones you have to change when creating new Unit type
public static String IMG_NAME = "32_unit_broad_swordman.png";
@Override
public Unit getNewUnitInstance(WorldMap map){return new Unit(map, Units.UNIT_BROAD_SWORDMAN);}

//the ones need no change when creating unit types
public static TextureHolder imgBuildable;
@Override
public TiledTextureRegion getImgTexture(EColors color){return imgBuildable.get(color);}

@Override
public String getImgName(){return IMG_NAME;}

@Override
public Integer getSoundPack(ESoundEvents event){
Integer result = null;
switch (event) {
case UNIT_SELECTED: result = SoundsDefLoader.SOUND_PACK_UNIT_SELECT_LAND_UNIT; break;
case UNIT_AFFIRM_MOVE: result = SoundsDefLoader.SOUND_PACK_UNIT_AFFIRM_LAND_UNIT; break;
case UNIT_ATTACK: result = SoundsDefLoader.SOUND_PACK_UNIT_ATTACK_SWING; break;
case UNIT_DAMAGE: result = SoundsDefLoader.SOUND_PACK_UNIT_DAMAGED_HUMAN; break;
}
return result;
}


public UiUnitBroadSwordMan() {
super();
}//
}//UiUnitBroadSwordMan
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json (json edit, bonuslist)

Post by Midonik »

Somethink is probably uncorrect,but I dont know what. I used halabardier,becouse I didnt find swordman in json.
https://jsonformatter.curiousconcept.com/
Attachments
unit_human_halberdier.json
(4.15 KiB) Downloaded 144 times
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json (json edit, bonuslist)

Post by Stratego (dev) »

ok! good! checking!

comments:
- filename does not fit
- unit typename has an extra space chartacter (will not work this way)
- the image definition is not right, it is for a 64x32 (tall) unit.
- i have not seend the "requires" meaning it can only be buildt if a tech is invented.
- bonuslist U_BULDINGS_UNIT_BATTERING_RAM this is surely a non existant category name :), please use names that are in the categories list (see categories FAQ)
(generally true: all CAPITAL lettered ID or StringID or typename is an important ID that must be exactly spelled - so use only copy+paste to use them)

other than these: good job!
please fix these.

thanks!
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json (json edit, bonuslist)

Post by Midonik »

How to change file name?
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json (json edit, bonuslist)

Post by Stratego (dev) »

it is still halberdier , but you do broad swordsman.
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json (json edit, bonuslist)

Post by Midonik »

I know,but I dint know how to change it.
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json (json edit, bonuslist)

Post by Midonik »

Is anythink fixed? Also it have "requires". https://jsonformatter.curiousconcept.com/
Attachments
unit_human_halberdier.json
(4.13 KiB) Downloaded 98 times
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json (json edit, bonuslist)

Post by Stratego (dev) »

this is the same file as before.
rename: you need to find a way to rename the file, idk what file manager you use, but on pc it is right click and "rename"
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json (json edit, bonuslist)

Post by Midonik »

Renemed
Attachments
unit_human_broad_swordman.json
(4.13 KiB) Downloaded 108 times
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json (json edit, bonuslist)

Post by Stratego (dev) »

ok, please check all my suggestions and fix all - thanks! (at least the unit typename was still there - not checked further)
Post Reply

Return to “Under the Hood studies”