Samuel - unit json 1 (json edit, bonuslist) 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: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Samuel - unit json 1 (json edit, bonuslist) PASSED

Post by Stratego (dev) »

you first task is similar, making bonus changes in AOW

10.5 cm leFH 18
Attachments
unit_ger_artillery_lefh18_howitzer.json
(3.94 KiB) Downloaded 100 times
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

Here it is.
Attachments
unit_ger_artillery_lefh18_howitzer.json
(3.95 KiB) Downloaded 87 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json

Post by Stratego (dev) »

seems good in format, but you missed 2 other bonus lines (check the xls in AOW section for the needed bonus lines)
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

Added light and med tanks.
Attachments
unit_ger_artillery_lefh18_howitzer.json
(4.07 KiB) Downloaded 90 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json

Post by Stratego (dev) »

impeccable!
indentation is also good!
game dropped no errors.

good job!
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

Thanks.
I make these. Can you check if it's working?
Garder Imperiale (napoleonic line infantry)
Abilities: Musket shot (can be used 1 time every 2 turns, damage 12 HP to enemy only).
Sounds not available.
Attachments
effect_instant_musket_shot.json
(602 Bytes) Downloaded 85 times
effect_minus12.json
(1.81 KiB) Downloaded 108 times
unit_fra_garder_imperiale.json
(3.83 KiB) Downloaded 98 times
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

Placeholder image of chu kon nu.
Attachments
unit_fra_garde_imperiale.png
unit_fra_garde_imperiale.png (1.05 KiB) Viewed 3275 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json

Post by Stratego (dev) »

i answered in email - is it for a new alternative?

please dont run ahead, there are many things you need to learn, however nice try figuring out without informations! :) (but you made thinks wrong way - i wrote in email detailly)
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json

Post by Stratego (dev) »

here is your next:

turn this AOF unit to json based

- find a similar and make the json basd on that.
- id: UNIT_SWORDMAN = 7;
- image: 32_unit_swordman.png 32x32


u.costTurn = 2;
u.sight = 4; //visiblity range
u.hpMax = 18; //health points
u.armorPierce = 0; //how big the armor against arrows
u.armorNormal = 0; //how big the armor against normal attack
u.power = 8; // 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.

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.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_BROAD_SWORDSMAN,
};
u.races = new int[] { // only these races can build this
RacesLoader.RACE_HUMAN
};
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

Swordman.
Attachments
unit_human_swordman.json
(3.92 KiB) Downloaded 98 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json

Post by Stratego (dev) »

you are quick! :)

here are my commetns:
- you can not rename the unitIDString , it must be "UNIT_SWORDMAN" (because it is an existing unit in game, if you design a new unit you can name it anyhow you want)
- you have missed to modify this: trnRevokerTechs (from this i see you took the pikeman - good choice)


at first glance i dont see other problems - nicex job! (but compiling and after testing it might bring more)

please fix these little and i willcompile
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

Changed.
Attachments
unit_human_swordman.json
(3.92 KiB) Downloaded 94 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json

Post by Stratego (dev) »

compile said 2 errors:
- soundpack SOUND_PACK_UNIT_SELECT_HUMAN does not exists
- invalid category name: UNIT_BATTERING_RAM

can you find out the solution? tell me if any info missing to do that.

(you will get similar errors if you do it on your device)
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

Fix
Attachments
unit_human_swordman.json
(3.88 KiB) Downloaded 99 times
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json

Post by Stratego (dev) »

good job!

it is uos 10 and last task here to check it in game how it is working
(if you make a new unit you need to do the same - there can be mistyping on stats and things that you only see on testing)
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

I need to test it?
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json

Post by Stratego (dev) »

samuelch wrote:I need to test it?
sure! you can only know if it works if you test it you can build it, you can read good values on statsheet that you desired (only a few turns in a random game, maybe until a clash, eg. poisoning will come out on a clash with an other unit)
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

I don't have aos dev version.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json

Post by Stratego (dev) »

it was AOF
you dnt have it with dev version?
User avatar
samuelch
Posts: 1677
Joined: Thu May 01, 2014 7:43 am
Location: Batavia

Re: Samuel - unit json

Post by samuelch »

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

Re: Samuel - unit json

Post by Stratego (dev) »

ok ,than skip this, i tested it for you.
Stratego (dev)
Site Admin
Posts: 15734
Joined: Fri Apr 25, 2014 9:28 pm

Re: Samuel - unit json (json edit, bonuslist) PASSED

Post by Stratego (dev) »

the first passed lecture :)
Post Reply

Return to “Under the Hood studies”