Page 1 of 2

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

Posted: Sat Sep 23, 2017 5:16 am
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

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 3:16 pm
by Midonik

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 4:21 pm
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!

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 4:26 pm
by Stratego (dev)
next task KV2:
Fix this,
http://www.ageofstrategy.net/viewtopic.php?f=55&t=4128

here is the json

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 4:33 pm
by Stratego (dev)
+ also fix the bonus too for the KV2. thanks.

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 4:43 pm
by Midonik
Should I change buliders from GER_BUD_GUN_FACTORY into RUS_BUD_TANKS_FACTORY or somethink?

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 4:44 pm
by Stratego (dev)
nice that you have detected it! sure!

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 4:48 pm
by Midonik

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 5:01 pm
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!

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 5:12 pm
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.

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 5:12 pm
by Midonik
Oh,wait,you mean in one line?

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 5:15 pm
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"]}}
           ],

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 5:25 pm
by Midonik
Like that? (Change choosing sound into "RU")
https://jsonformatter.curiousconcept.com/

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 5:44 pm
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:

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 5:47 pm
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? :) )

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 5:52 pm
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?

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 6:15 pm
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!

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 6:16 pm
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.

Re: Midonik - unit json

Posted: Sat Sep 23, 2017 6:18 pm
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"]}}
	],


Re: Midonik - unit json

Posted: Sat Sep 23, 2017 6:24 pm
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!

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

Posted: Sat Sep 23, 2017 8:01 pm
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

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

Posted: Sun Sep 24, 2017 12:25 pm
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/

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

Posted: Sun Sep 24, 2017 1:49 pm
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!

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

Posted: Sun Sep 24, 2017 1:58 pm
by Midonik
How to change file name?

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

Posted: Sun Sep 24, 2017 1:58 pm
by Stratego (dev)
it is still halberdier , but you do broad swordsman.

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

Posted: Sun Sep 24, 2017 2:04 pm
by Midonik
I know,but I dint know how to change it.

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

Posted: Sun Sep 24, 2017 2:07 pm
by Midonik
Is anythink fixed? Also it have "requires". https://jsonformatter.curiousconcept.com/

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

Posted: Sun Sep 24, 2017 2:12 pm
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"

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

Posted: Sun Sep 24, 2017 2:28 pm
by Midonik
Renemed

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

Posted: Sun Sep 24, 2017 2:31 pm
by Stratego (dev)
ok, please check all my suggestions and fix all - thanks! (at least the unit typename was still there - not checked further)