Sunrise Samurai(AOF)-Unit json 1(json edit, bonuses) PASSED

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.
Post Reply
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Sunrise Samurai(AOF)-Unit json 1(json edit, bonuses) PASSED

Post by Stratego (dev) »

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

+100% buildings
+100% infantry
+400% Ships_Carrier
+400% battleships
+100% light tanks
+20% medium tanks

(sorry i just saw you are on AOF, the next ones will be on that - however we need to ask Alexander to let you do some since he is very fast on making any jsons if come up to change any :))
Attachments
unit_us_artillery_m7_priest.json
(3.95 KiB) Downloaded 132 times
User avatar
Sunrise Samurai
Posts: 2678
Joined: Thu Jun 18, 2015 11:21 pm
Location: Florida, U.S.

Re: Daniel Ward - Unit json (AOF orientation)

Post by Sunrise Samurai »

Alright, modifying the bonus value is easy enough. Had to check out another one to be sure on the use of decimals to define bonuses less than 100%. The problem I'm having is with the light and medium tanks, since I can't be sure if I've got the name right. Attaching what I have so far, but it needs edited with the right names once you tell me how to reference the tanks. Right now I have them as LIGHTTANK and MEDIUMTANK, which I doubt is actually what it needs to be. Don't have any other aow json files to compare.

Including JSON checker link for personal use, rather than have to go hunting for it later. I suggest all other apprentices do the same.
https://jsonformatter.curiousconcept.com
Attachments
unit_us_artillery_m7_priest.json
(4.1 KiB) Downloaded 123 times
The glorious sun rises again
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Daniel Ward - Unit json (AOF orientation)

Post by Midonik »

I wrote: LIGHT_TANK and MEDIUM_TANK but I also dont know if its correct ir not.
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
User avatar
Sunrise Samurai
Posts: 2678
Joined: Thu Jun 18, 2015 11:21 pm
Location: Florida, U.S.

Re: Daniel Ward - Unit json (AOF orientation)

Post by Sunrise Samurai »

:)
Your guess is as good as mine until Daniel chooses to enlighten us. I've poured through everything we've been given, and can't find any lists or examples that includes them. Unfortunately our AoWW database is limited, and no matter where I look I can't seem to access the internal files already in the games. If I could find those, I'd be able to get a lot of information without needing to ask :mrgreen:
The glorious sun rises again
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Daniel Ward - Unit json (AOF orientation)

Post by Stratego (dev) »

i have posted in FAQ (categories section) the current AOW json file, there you can see the valid AOW categories.
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Daniel Ward - Unit json (AOF orientation)

Post by Stratego (dev) »

Sunrise Samurai wrote:Alright, modifying the bonus value is easy enough. Had to check out another one to be sure on the use of decimals to define bonuses less than 100%. The problem I'm having is with the light and medium tanks, since I can't be sure if I've got the name right. Attaching what I have so far, but it needs edited with the right names once you tell me how to reference the tanks. Right now I have them as LIGHTTANK and MEDIUMTANK, which I doubt is actually what it needs to be. Don't have any other aow json files to compare.

Including JSON checker link for personal use, rather than have to go hunting for it later. I suggest all other apprentices do the same.
https://jsonformatter.curiousconcept.com
very good!
- you need to use category name that is valid for AOw, so i have posted the current in the FAQ section - check them and use those,
- after that your json seems ok,
- so i will compile it in and the app might tell me if there is any other problem.
User avatar
Sunrise Samurai
Posts: 2678
Joined: Thu Jun 18, 2015 11:21 pm
Location: Florida, U.S.

Re: Daniel Ward/Sunrise Samurai - Unit json (AOF orientation

Post by Sunrise Samurai »

.....duh. I should have guessed from the ships how to format it. Well, fixed that. How's this?
Attachments
unit_us_artillery_m7_priest.json
(4.11 KiB) Downloaded 126 times
The glorious sun rises again
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Daniel Ward/Sunrise Samurai - Unit json (AOF orientation

Post by Stratego (dev) »

good job!
it seems impeccable
...putting in...

it is in the game! without errors! thanks!
User avatar
Sunrise Samurai
Posts: 2678
Joined: Thu Jun 18, 2015 11:21 pm
Location: Florida, U.S.

Re: Daniel Ward/Sunrise Samurai - Unit json (AOF orientation

Post by Sunrise Samurai »

I await further instructions, Sensei :D
The glorious sun rises again
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Daniel Ward/Sunrise Samurai - Unit json (AOF orientation

Post by Stratego (dev) »

hai! oss! vakarimas-ka!? :)

it will be a bit harder:
Make an AOF unit to be json based (from this java code convert it to JSON.
steps:
- find a json based unit wich is similar (some kind of archer) - i searched one for you, rohan archer see attached
- copy the file and name it as *human_archer*
- modify every property so the new json will work as the info you see below
- codename and ID of unit: UNIT_ARCHER = 1;
- unit image name 32_unit_archer.png, 32x32px.

u.costTurn = 2;
u.sight = 7; //visiblity range
u.rangeAttack = 5; //attack range (what maximal range it can attack) (1 means only nearby unit)
u.attackTypeArrow = true; //if arrow than some units have defense against that
u.hpMax = 11; //health points
u.armorPierce = 0; //how big the armor against arrows
u.armorNormal = 0; //how big the armor against normal attack
u.power = 5; // 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_CHEAP_INFANTRY_MELEE, UNIT_ORNITHOPTER), 0.5f);


u.bestAgainstMeGround = U_ANTI_ARCHER;
u.bestAgainstMeWater = U_SHIP_ATTACK;
u.builders = new int[]{ //is it built in a TC? or in an archery range? or a worker builds it?
UNIT_TC,
UNIT_BUILDING_ARCHERY
};
u.modifiers = new int[]{//"type"-s (TECH) that modifies its properties
EFFECT_POISONED_ARROWS,
};
u.revokerTechs = new int[]{ //"type"-s that revokes this as a buildable unit/tech (eg. a crossbowman upgrade revokes archer from the palette)
TECH_UPGRADE_UNIT_CROSSBOWMAN,
};



u.races = new int[] { // only these races can build this
RacesLoader.RACE_HUMAN
};
Attachments
unit_hum_rohan_archer.json
(3.65 KiB) Downloaded 119 times
User avatar
Sunrise Samurai
Posts: 2678
Joined: Thu Jun 18, 2015 11:21 pm
Location: Florida, U.S.

Re: Daniel Ward/Sunrise Samurai - Unit json (AOF orientation

Post by Sunrise Samurai »

Hai!

I'll probably get a decent chance to do this tonight (about 7 hours from now). You weren't kidding when you said a bit harder :lol: I'm going from editing a little bit of bonuses to making a whole new unit. Do I take it to mean that most AoF units still need to be bumped up to json form?
The glorious sun rises again
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Daniel Ward/Sunrise Samurai - Unit json (AOF orientation

Post by Stratego (dev) »

Sunrise Samurai wrote:Hai!

I'll probably get a decent chance to do this tonight (about 7 hours from now). You weren't kidding when you said a bit harder :lol: I'm going from editing a little bit of bonuses to making a whole new unit. Do I take it to mean that most AoF units still need to be bumped up to json form?
:) will be not be THAT hard - you need almost to keep the rohan properties, only a few changes will be.

most AOF units: no, i think the ones inherited from AOS yes, some first few AOF units too, i think approx 50-60 units, not that much :)
they will be good to practice jsoning, however you 3 will not make all of them - i think only 8-10 jsons per apprentice, we will see how interesting they are .
there are more complex things like spells and effects and "born with" abilities and "area damaging stuff" and such and there are several caster units out of json now to discover.
User avatar
Sunrise Samurai
Posts: 2678
Joined: Thu Jun 18, 2015 11:21 pm
Location: Florida, U.S.

Re: Sunrise Samurai (AOF fan) - Unit json (json edit, bonusl

Post by Sunrise Samurai »

Not sure I got the bonus against ornithopters right. I took a wild guess, since in the game, it has a bonus vs ornithopters, but no other fliers. Checks out as a valid json, so hopefully it's good. Did I miss anything?
Attachments
unit_human_archer.json
(3.71 KiB) Downloaded 128 times
The glorious sun rises again
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Sunrise Samurai (AOF fan) - Unit json (json edit, bonusl

Post by Stratego (dev) »

thanks!
good!

quick reply, the things i saw in first glance to be fixed
- the image name is not right.
- the unit idString is not right
- the unit id is not right
- the ornithopter is not properly references (it is not a category, but a single unit so it needs a different kind of referencing)
User avatar
Sunrise Samurai
Posts: 2678
Joined: Thu Jun 18, 2015 11:21 pm
Location: Florida, U.S.

Re: Sunrise Samurai (AOF fan) - Unit json (json edit, bonusl

Post by Sunrise Samurai »

Fixed image name, unit Id, and unit id string (I hope)

Pretty sure I got the bonus right this time. I copied it right out of elf archer.....which after some comparison, may have been a bit easier for a starting point :lol: that's where I figured out some of the rest I did wrong.
Attachments
unit_human_archer.json
(3.79 KiB) Downloaded 122 times
The glorious sun rises again
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Sunrise Samurai (AOF fan) - Unit json (json edit, bonusl

Post by Stratego (dev) »

the unit idString (unitTypeName) is still not right, jsonizing an existing unit you can not change it.
but checking further.
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Sunrise Samurai (AOF fan) - Unit json (json edit, bonusl

Post by Stratego (dev) »

ok by observing i see these:
- the unit typename (idString)
- you have not defined where the player can build it.
- the bonus line is not singular (maybe the elf was not either, i will make that too:
this is more readable if we have more bonus lines, and more easily copy+pasteable into other units:
"trnBonusList":[
{"modifier":0.5, "unitList":{"categories":["U_CHEAP_INFANTRY_MELEE"],"unitTypes":["UNIT_ORNITHOPTER"]}}
],

please
User avatar
Sunrise Samurai
Posts: 2678
Joined: Thu Jun 18, 2015 11:21 pm
Location: Florida, U.S.

Re: Sunrise Samurai (AOF fan) - Unit json (json edit, bonusl

Post by Sunrise Samurai »

Unit type name should be "UNIT_ARCHER" I assume? And not sure what you mean by not singular? Is what you posted copy/pasteable into the json? It looks like it needs spaces like the rest.

And as for not defining where it's built......oops :lol: guess it wouldn't cramp anybody's style too much if they can't make archers right? :twisted:

I'll fix that when I get more time than my lunch break. 30 minutes isn't enough to do everything I want to do :x
The glorious sun rises again
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Sunrise Samurai (AOF fan) - Unit json (json edit, bonusl

Post by Stratego (dev) »

Sunrise Samurai wrote:Unit type name should be "UNIT_ARCHER" I assume?
yes
And not sure what you mean by not singular? Is what you posted copy/pasteable into the json? It looks like it needs spaces like the rest.
yes pput it in this form:
"trnBonusList":[
{"modifier":1.5, "unitList":{"categories":["U_CHEAP_INFANTRY_MELEE"],"unitTypes":["UNIT_ORNITHOPTER"]}},
{"modifier":2.5, "unitList":{"categories":["U_CHEAP_INFANTRY_MELEE"],"unitTypes":["UNIT_ORNITHOPTER"]}},
{"modifier":3.5, "unitList":{"categories":["U_CHEAP_INFANTRY_MELEE"],"unitTypes":["UNIT_ORNITHOPTER"]}},
{"modifier":4.5, "unitList":{"categories":["U_CHEAP_INFANTRY_MELEE"],"unitTypes":["UNIT_ORNITHOPTER"]}},
{"modifier":5.5, "unitList":{"categories":["U_CHEAP_INFANTRY_MELEE"],"unitTypes":["UNIT_ORNITHOPTER"]}}
],
one line is one bonus line, (one "modifier" keyword)
And as for not defining where it's built......oops :lol: guess it wouldn't cramp anybody's style too much if they can't make archers right? :twisted:
yes please put it in.
I'll fix that when I get more time than my lunch break. 30 minutes isn't enough to do everything I want to do :x
ok!
User avatar
Sunrise Samurai
Posts: 2678
Joined: Thu Jun 18, 2015 11:21 pm
Location: Florida, U.S.

Re: Sunrise Samurai (AOF fan) - Unit json (json edit, bonusl

Post by Sunrise Samurai »

Ok. Should all be fixed now. Surprisingly, the json checker says it's valid, so hopefully it's good.
Attachments
unit_human_archer.json
(3.72 KiB) Downloaded 103 times
The glorious sun rises again
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Sunrise Samurai (AOF fan) - Unit json (json edit, bonusl

Post by Stratego (dev) »

perfect! PASSED!
Post Reply

Return to “Under the Hood studies”