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: 9929
Joined: Fri Apr 25, 2014 9:28 pm

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

Post by Stratego (dev) » Sat Sep 23, 2017 5:16 am

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 67 times

Midonik
Posts: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik » Sat Sep 23, 2017 3:16 pm

Attachments
unit_ger_artillery_spg_hummel-1.json
(3.97 KiB) Downloaded 60 times
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 4:21 pm

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 65 times

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

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 4:26 pm

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 51 times

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

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 4:33 pm

+ also fix the bonus too for the KV2. thanks.

Midonik
Posts: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik » Sat Sep 23, 2017 4:43 pm

Should I change buliders from GER_BUD_GUN_FACTORY into RUS_BUD_TANKS_FACTORY or somethink?
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 4:44 pm

nice that you have detected it! sure!

Midonik
Posts: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik » Sat Sep 23, 2017 4:48 pm

Attachments
unit_ru_artillery_SPG_KV2.json
(3.97 KiB) Downloaded 61 times
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 5:01 pm

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: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik » Sat Sep 23, 2017 5:12 pm

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,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

Midonik
Posts: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik » Sat Sep 23, 2017 5:12 pm

Oh,wait,you mean in one line?
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 5:15 pm

"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: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik » Sat Sep 23, 2017 5:25 pm

Like that? (Change choosing sound into "RU")
https://jsonformatter.curiousconcept.com/
Attachments
unit_ru_artillery_SPG_KV2.json
(3.94 KiB) Downloaded 57 times
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 5:44 pm

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 60 times

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

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 5:47 pm

Also nice you have changed sounds to russian too!
(how did u know that it is called same but RU in it? :) )

Midonik
Posts: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Midonik - unit json

Post by Midonik » Sat Sep 23, 2017 5:52 pm

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 51 times
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 6:15 pm

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: 9929
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 6:16 pm

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: 9929
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 6:18 pm

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: 9929
Joined: Fri Apr 25, 2014 9:28 pm

Re: Midonik - unit json

Post by Stratego (dev) » Sat Sep 23, 2017 6:24 pm

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 39 times

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

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

Post by Stratego (dev) » Sat Sep 23, 2017 8:01 pm

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: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

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

Post by Midonik » Sun Sep 24, 2017 12:25 pm

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 76 times
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

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

Post by Stratego (dev) » Sun Sep 24, 2017 1:49 pm

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: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

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

Post by Midonik » Sun Sep 24, 2017 1:58 pm

How to change file name?
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

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

Post by Stratego (dev) » Sun Sep 24, 2017 1:58 pm

it is still halberdier , but you do broad swordsman.

Midonik
Posts: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

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

Post by Midonik » Sun Sep 24, 2017 2:04 pm

I know,but I dint know how to change it.
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

Midonik
Posts: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

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

Post by Midonik » Sun Sep 24, 2017 2:07 pm

Is anythink fixed? Also it have "requires". https://jsonformatter.curiousconcept.com/
Attachments
unit_human_halberdier.json
(4.13 KiB) Downloaded 43 times
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

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

Post by Stratego (dev) » Sun Sep 24, 2017 2:12 pm

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: 3570
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

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

Post by Midonik » Sun Sep 24, 2017 2:28 pm

Renemed
Attachments
unit_human_broad_swordman.json
(4.13 KiB) Downloaded 45 times
Support new AoS variant, Age of Galaxy,its sci-fi themed: http://www.androidutils.com/forum/viewforum.php?f=135
All help will be welcome.

Fielderan Crown's Great Hetman
http://www.androidutils.com/forum/viewt ... =66&t=4729

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

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

Post by Stratego (dev) » Sun Sep 24, 2017 2:31 pm

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”