PDA

View Full Version : possible to increase intem in shop?


rikkaidd
09-05-2013, 02:44 PM
how to increase number of objects and troops in stores,with modding file?

MattCaspermeyer
09-06-2013, 07:09 PM
how to increase number of objects and troops in stores,with modding file?

You need to learn how to edit the *.LOC files. The easiest way is to use the KB Editor included with CW.

You can also edit the *.LOC files using KB_DB_EDIT, but it is much more involved:

Essentially, you decompile the LOC file of interest with KB_DB_EDIT. When you do this, you create a text file. The text file will be organized by shop, etc. If you search the text file for units, for example, you'll find the syntax for how they are specified in castles, shops, and other areas. You then can change the ranges, or add the possibility for any unit, item, spell, etc.

This is what I did with my HOMM3 Babies mod - however, you need to be able to peruse cryptic text files, edit them, and then the last step is to use KB_DB_EDIT to compile the text file back into a LOC file. Then you have to playtest, because one misspelling can cause the game to crash when going to that area, completing a quest, etc.

Feel free to ask more questions once you get into the thick of it...

Matt

/C\/C\

rikkaidd
09-07-2013, 06:47 PM
Thank you very much, I understand!
This is the only forum on modding "kings bounty",unfortunately there are not modding tutorials.
Today i almost went crazy for understand how to resurrect "black dragon" with "ressurrect spells" or "ability inquisitor",then I have got the conclusion :

not only i changes the level "blackdragons units" from 5 to 4,
I also had to remove its parameter "magic_immunit" in the "blackdragon. atom" file
file.
I would like to find a forum with good tutorials..

Ps: i have download KB_DB_EDIT, extrat all *loc file (of ses.kfs) ,in other root, and convert to txt all temple_love.... file..
If I do not mistake only this interests me is "temple_love.embryos.loc.txt",the others file , seem the 3d object position in the maps.
the system seems very complicated,sincerely i have not understood anything there ...if please, give me a tip-off on the modification of these laces codes:

{ushop} they seem to be recruitable units in the temple,right?
{Y}{ushop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 2 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{units}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {}
{A}{units} = {priest,500:5:2000,priest2,500:5:2000}
{A}{level} = {}
{A}{kolvo} = {}
{U}{prob} = {10}
}
}
}
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{units}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {}
{A}{units} = {paladin,200:500}
{A}{level} = {}
{A}{kolvo} = {}
{U}{prob} = {10}
}
}
}
}
}
}
{U}{chance} = {100}
{U}{uid} = {2}
{U}{wuid} = {4233223827}
{A}{class} = {castle}
}
this????{A}{class} = {box} is a normally box in the map?
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {1}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {mana_potion/15}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
}
{U}{chance} = {100}
{U}{uid} = {0}
{U}{wuid} = {0}
{A}{class} = {box}


{A}{class} = {army}, is enemy in the map?
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 8 elements
{
{A}{races} = {}
{A}{units} = {dryad,beholder2,greendragon}
{A}{level} = {}
{A}{perc} = {15:25}
{A}{kolvo} = {0}
{U}{prob} = {10}
{I}{ext} = {-1}
{U}{fillt} = {2}
}
}
}
}
{U}{chance} = {100}
{U}{uid} = {3}
{U}{wuid} = {4294967295}
{A}{class} = {army}
}
}
}

rikkaidd
09-08-2013, 12:47 AM
I have made a few modifications changing paladin,reclutable in temple of love, with knight;
but during playtest the available troops are always the same in the game and no crash.
these changes are visible only in new games?

MattCaspermeyer
09-09-2013, 09:08 AM
Thank you very much, I understand!
This is the only forum on modding "kings bounty",unfortunately there are not modding tutorials.
Today i almost went crazy for understand how to resurrect "black dragon" with "ressurrect spells" or "ability inquisitor",then I have got the conclusion :

not only i changes the level "blackdragons units" from 5 to 4,
I also had to remove its parameter "magic_immunit" in the "blackdragon. atom" file
file.

Hey, no problem - glad I can help.

Here are some things to consider with respect to what you changed (there is more than one way to implement changes, some better than others).

It would be best to keep Black Dragons as level 5 since you'll open them up to a great many spells that affect units only up to level 4. Also, changing them from "magic_immunitet" is also fraught with issues (as now all spells can affect them).

What you could do, instead, is find the Resurrection Spell in SPELLS.TXT (from AP):

spell_resurrection {
category=s
profit=4
price=12000
image=book_spell_resurrection.png
button_image=book_scroll_resurrection.png
label=SN_resurrection
attack=scripted
school=1
hint_config=object_spell
hint=spell_resurrection_hint
hint_header=spell_resurrection_header

scripted {
always_hint=1
log_label=null
warning=warning_resurrect
script_attack=spell_resurrection_attack
script_calccells=calccells_all_need_resurrect_ally
attack_cursor=magicstick
ad_factor=0 // use attack/defense
nfeatures=magic_immunitet,undead,plant,golem,pawn, boss,mech
}
params {
duration=0
rephits=200 // ñêîëüêî ëå÷èò
lev_ref=100 // íà ñêîëüêî % ïîâûøàåòñÿ ñ óðîâíåì
level=2,3,4
}
levels {
// level = mana_cost, crystals_cost to upgrade from previous level
1=10,10
2=20,15
3=30,25
}
}

Note the nfeatures label? You simply remove magic_immunitet from that and then it will work on units that are immune to magic, but there is one other parameter that you need to look at and that is level - see where it is 2,3,4? Those are the level limits on the Resurrection spell for each spell level. So if you changed it to 2,4,5, for example, then at level 2 you could rez units up to level 4 and then at level 3 you could rez units up to level 5.

This is the trick of modding: know what is where. I learned how to mod simply by using a good grep tool and searching for stuff in the game files. I also used the forums but I did a lot of advanced stuff in my HOMM3 Babies mod that no one could help me with (so feel free to ask me questions). So for example, since you found BLACKDRAGON.ATOM, you could search for all the files that contain magic_immunitet and you'd find that it is referenced in quite a few files. So I encourage you to do that. Also search on my posts - I have a tutorial here and there.

I would like to find a forum with good tutorials../QUOTE]

Check out this post: http://forum.1cpublishing.eu/showpost.php?p=499792&postcount=1 and this topic: http://forum.1cpublishing.eu/showthread.php?t=28258

[QUOTE=rikkaidd;509077]Ps: i have download KB_DB_EDIT, extrat all *loc file (of ses.kfs) ,in other root, and convert to txt all temple_love.... file..
If I do not mistake only this interests me is "temple_love.embryos.loc.txt",the others file , seem the 3d object position in the maps.
the system seems very complicated,sincerely i have not understood anything there ...if please, give me a tip-off on the modification of these laces codes:

Yes - you're in trouble now! :)

{ushop} they seem to be recruitable units in the temple,right?

Yes - great insight! Note that {ushop} defines the units available at that shop (or really the unit choices).

Now here's how it works:

{Y}{ushop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 2 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{units}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {}
{A}{units} = {priest,500:5:2000,priest2,500:5:2000}
{A}{level} = {}
{A}{kolvo} = {}
{U}{prob} = {10}
}
}
}
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{units}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {}
{A}{units} = {paladin,200:500}
{A}{level} = {}
{A}{kolvo} = {}
{U}{prob} = {10}
}
}
}
}
}
}
{U}{chance} = {100}
{U}{uid} = {2}
{U}{wuid} = {4233223827}
{A}{class} = {castle}
}


The {Y}{ushop} is a section of a location on the map. A location has many sections under it, including ushop, but let's focus on ushop. The ushop is the units shop section (which you already figured out) under this location on the map and only lists units for that location (note though that there are possibly also items {itms} and spell scroll {spls} sections (usually above the {ushop} section) under this location). So looking at your example:

Unit choice #1:

{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{units}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {}
{A}{units} = {priest,500:5:2000,priest2,500:5:2000}
{A}{level} = {}
{A}{kolvo} = {}
{U}{prob} = {10}
}
}
}

And unit choice #2:

{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{units}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {}
{A}{units} = {paladin,200:500}
{A}{level} = {}
{A}{kolvo} = {}
{U}{prob} = {10}
}
}
}

These are essentially templates that you can use to modify unit choices.

You'll note that there are races, units, level, kolvo, and prob sections under each unit. With this you have great flexibility in adding all kinds of unit possibilities to a shop that can be quite random from game to game. The syntax, is very similar to what you'll see in ITEMS.TXT under the army choice for items that you fight to upgrade or pacify. Let's go through each one:


races - for specifying a choice of race or races for units in the shop (note that units should be left blank if you're specifying something here).
units - I think you can see that you can list specific units that are possible here. Note the syntax: UNIT_ATOM,MIN:INCREMENT:MAX

UNIT_ATOM - this is a valid ATOM file name, note one misspelling here and the game will crash if the ATOM file is not found
Interval - the number of available units possible:

MIN - minimum number of units that will appear at the shop
INCREMENT - the increment between the MIN and MAX (note 1 assumed if omitted)
MAX - maximum number of units that will appear at the shop


level - you can specify the level of units available (once again best to leave unit blank if you're going to specify a unit level)
kolvo - ranges of units if leaving unit blank (i.e. if you specify something for race and level, specify the numbers here, otherwise leave blank as numbers are specified in {unit})
prob - chance that this unit will appear if there is more than one choice (you usually see 10 here if this is always possible or there is an equal chance with another choice).


So let's breakdown what unit choice #1 means: There is a 10 out of 10 chance that unit slot #1 in the shop will sell either 500 to 2000 Priests in 5 unit increments or 500 to 2000 Inquisitors in 5 unit increments. So one game you could have 785 Priests and in another 1555 Inquisitors. Does this make sense? What about unit choice #2: There is a 10 out of 10 chance that the shop will sell 200 to 500 Paladins in 1 unit increments. So one game you could have 204 Paladins and another 497 in unit slot #2. It is important to note that *both* unit slots in the shop are filled every game with these choices.

Does this make sense? Say you want a shop to sell 100 to 150 level 1-2 Elven troops in 2 unit increments - how would you specify it?

Here is the answer:

{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{units}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {elf}
{A}{units} = {}
{A}{level} = {1:2}
{A}{kolvo} = {100:2:150}
{U}{prob} = {10}
}
}
}

Does this make sense?

What do you think this means?

{Y}{ushop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 2 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{units}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {}
{A}{units} = {archer,500:50:1000,skeleton,500:50:1000}
{A}{level} = {}
{A}{kolvo} = {}
{U}{prob} = {10}
}
}
}
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{units}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 3 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {}
{A}{units} = {vampire,50:300,vampire2,50:300}
{A}{level} = {}
{A}{kolvo} = {}
{U}{prob} = {10}
}
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {}
{A}{units} = {}
{A}{level} = {}
{A}{kolvo} = {}
{U}{prob} = {3}
}
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 5 elements
{
{A}{races} = {undead}
{A}{units} = {}
{A}{level} = {1:3}
{A}{kolvo} = {90:300}
{U}{prob} = {10}
}
}
}
}
If you look at this you'll note that there are two {Y}{units} sections just like in your example. The first section is for unit slot number #1 in that shop with a 10 out of 10 chance to sell either 500 to 1000 Skeleton Archers in 50 unit increments or 500 to 1000 Skeleton Warriors in 50 unit increments. Slot #2 has 3 choices: 1) 50 to 300 Vampires or Ancient Vampires in 1 unit increments with a 10 out of 23 chance, 2) nothing with a 3 out of 23 chance, and 3) 90 to 300 level 1 to 3 Undead units in 1 unit increments with a 10 out of 23 chance. Does this make sense?

Once again, the stuff you see in the LOC files are your templates, you can simply copy what you find to another shop location and change it to the way you want it.

this????{A}{class} = {box} is a normally box in the map?

Not necessarily, box could just be referencing an item - you need to look at the context in which it is used.

In the example you present, it is an item or spell being sold in a shop.

{A}{class} = {army}, is enemy in the map?

Yes, or let's say a potential army on the map. Note that the syntax here is identical to that in ITEMS.TXT.

Okay, now for items and spells - first items:

{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 3 elements
{
{Y}{itms}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 9 elements
{
{A}{cont} = {}
{A}{upds} = {}
{A}{digi} = {}
{U}{flgs} = {0}
{Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements
{
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {skeleton_grave/30:60}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
}
{U}{chance} = {100}
{U}{uid} = {0}
{U}{wuid} = {0}
{A}{class} = {box}
}
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 9 elements
{
{A}{cont} = {}
{A}{upds} = {}
{A}{digi} = {}
{U}{flgs} = {0}
{Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements
{
{Y}{25}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {vampire_grave/10:25}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
{Y}{75}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
}
{U}{chance} = {100}
{U}{uid} = {0}
{U}{wuid} = {0}
{A}{class} = {box}
}
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 9 elements
{
{A}{cont} = {}
{A}{upds} = {}
{A}{digi} = {}
{U}{flgs} = {0}
{Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements
{
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {*}
{A}{ir_level} = {*}
{A}{ir_race} = {undead}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
}
{U}{chance} = {100}
{U}{uid} = {0}
{U}{wuid} = {0}
{A}{class} = {box}
}
}


Can you break this into its 3 sections? Note that I added this section to the Dwarf Necromancer's shop in King's Bounty - The Legend in Kordar (KORDAR_2.EMBRYOS.LOC).

Here is section (for potential item) #1:

{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 9 elements
{
{A}{cont} = {}
{A}{upds} = {}
{A}{digi} = {}
{U}{flgs} = {0}
{Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements
{
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {skeleton_grave/30:60}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
}
{U}{chance} = {100}
{U}{uid} = {0}
{U}{wuid} = {0}
{A}{class} = {box}
}


Do you note similarities to the {ushop} section? Note that {choice} is the section that describes the possibilities for items. The probability is subtle, but do you see {Y}{10} under {choice} for its two sub-elements? There is also a {chance} section as well. The {chance} is the probability of this choice being available (and you'll note that it is set to 100%). There are two possibilities: 1) 30 to 60 Skeleton Graves (the coffin items you find in the Cemetary of Marshan Swamp for example) in 1 item increments with a 10 out of 20 chance and 2) nothing with a 10 out of 20 chance. So there is a 100% chance of possible item #1 occurring in the game and it has a 50% chance of providing 30 to 60 Skeleton Graves.

You should now be able to determine that item slot #2 has a 100% chance of providing either: 1) 10 to 25 Vampire Graves with a 25% (note the {Y}{25}) chance or 2) nothing with a 75% (note the {Y}{75}) chance.

Note that there is one critical difference between how ranges are specified in {ushop} versus {itms}: ITEM_NAME/RANGE. Note that ITEM_NAME must be in ITEMS.TXT (or one of the included files) and that you need to use a "/" instead of a "," to separate the name of the item from its range. This can bite you (I've been bitten!) if you're not careful (and of course the game crashes if you mess up).

Lastly, item slot #3 has a 50% chance of providing an Undead item of any type or level:

{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 9 elements
{
{A}{cont} = {}
{A}{upds} = {}
{A}{digi} = {}
{U}{flgs} = {0}
{Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements
{
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {*}
{A}{ir_level} = {*}
{A}{ir_race} = {undead}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
}
{U}{chance} = {100}
{U}{uid} = {0}
{U}{wuid} = {0}
{A}{class} = {box}
}


Make sense? I hope so, now on to spells:

{Y}{spls}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 2 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 9 elements
{
{A}{cont} = {}
{A}{upds} = {}
{A}{digi} = {}
{U}{flgs} = {0}
{Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {1}
{A}{sr_level} = {*}
{A}{sr_count} = {2:5}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
}
{U}{chance} = {100}
{U}{uid} = {0}
{U}{wuid} = {0}
{A}{class} = {box}
}
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 9 elements
{
{A}{cont} = {}
{A}{upds} = {}
{A}{digi} = {}
{U}{flgs} = {0}
{Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 2 elements
{
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {1/2}
{A}{sr_level} = {*}
{A}{sr_count} = {2:5}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
{Y}{3}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {}
{A}{sr_level} = {}
{A}{sr_count} = {}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
}
{U}{chance} = {100}
{U}{uid} = {0}
{U}{wuid} = {0}
{A}{class} = {box}
}
}


There are two spell slot sections, section #1:

{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 9 elements
{
{A}{cont} = {}
{A}{upds} = {}
{A}{digi} = {}
{U}{flgs} = {0}
{Y}{choice}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{Y}{10}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 25 elements
{
{A}{atom} = {}
{A}{script} = {}
{U}{cmc} = {0}
{A}{bp0} = {}
{A}{bp1} = {}
{A}{bp2} = {}
{A}{bp3} = {}
{A}{bp4} = {}
{A}{bp5} = {}
{A}{bp6} = {}
{A}{bp7} = {}
{A}{bp8} = {}
{A}{bp9} = {}
{A}{bp10} = {}
{A}{bp11} = {}
{A}{bp12} = {}
{A}{bp13} = {}
{A}{items} = {}
{A}{ir_type} = {}
{A}{ir_level} = {}
{A}{ir_race} = {}
{A}{sr_school} = {1}
{A}{sr_level} = {*}
{A}{sr_count} = {2:5}
{Y}{bshop}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 0 elements
{
}
}
}
{U}{chance} = {100}
{U}{uid} = {0}
{U}{wuid} = {0}
{A}{class} = {box}
}


You'll note that the item and spell scroll sections are essentially identical save for their heading (itms or spls) and what is specified.

There is a 100% chance of selling 2 to 5 (the number is specified in {sr_count}) Distortion school (under {sr_school}) scrolls (0 = Order, 1 = Distortion, 2 = Chaos) of any spell (note "*" under {sr_level}) for spell slot #1. For spell slot #2 there is a 10 out of 13 chance to sell either 2 to 5 Distortion or Chaos school (note that a "/" separates school choices under {sr_school}) spells of any kind.

Once again find an {itms} or {spls} section in the LOC file and use it as your template. To determine what bp0 through bp13 mean, you'll need to go to the quest rewards files (*.QST - decompile one of those (its number matches its *.LNG - NUMBER.QST and then a corresponding ENG_QUEST_NUMBER.LNG (note that NUMBER is 0 padded if it is less than 10 digits))) and then go look at the reward in the game to decipher what {bp0} through {bp13} mean (there may also be an LUA function that deciphers them, but I don't know it offhand - someone might have posted them, too). They are things like runes, or gold, etc.

This is plenty of info to get you into trouble as now I've made you dangerous! :)

Remember to always work with backups, make one change and then try it out (the bummer is that you have to restart so pick a location that is easy to check out (can be reached very quickly in a new game) so that you can do some trial and error and see if your change works).

Note if you implement a lot of changes simultaneously and the game crashes you'll either have to remove everything and add it in one at a time or use a binary technique where you add half your changes until it crashes to find where your error is.

Feel free to ask more questions after you've had a chance to digest this information - note I don't know everything in these files, but I know how to copy and paste things and then change them. Note that you'll need the editor if you want to add new locations to a map as the information in the LOC file needs to be linked to the map (through the ID's, etc. listed in the other sections of that location).

Good luck!

/C\/C\

rikkaidd
09-09-2013, 03:49 PM
thanks a thousand! this is excellent and very complete tutorial..
On the dragon i have worked badly :grin: but i have had this game from one week, must still learn; as you said, am going by intuition and modding experience in other games.

I had already done a magic addition,but at the beginning without animation
then I have made a modification putting the basic animation "priest2", but the signalling on the struck targets is not seen, he signals only a target but he strikes at least 3.

main {
class=chesspiece
model=priest2.bma
cullcat=0
}
arena_params {
features_label=cpi_priest_feat
.........................
attacks=moveattack,shot,respawn,holy_rage,firethro w
...............
firethrow {
dontusenearenemy=1
device=firecatapult
class=throw
picture=BA1_CatapultFire_
picture_small=BA1_CatapultFire_small.png
distance=50
ad_factor=1
base_attack=0
mindist=2
reload=4
penalty=0.5
animation=cast/throw/thtarget //animation change with basic animation priest2
throw=catapultfireball
hinthead=special_fire_catapult_head
hint=special_fire_catapult_hint
framekey=x
7in1=0.5
friendly_fire=1
damage {
fire=5,7
}
custom_params {
burn=25
}
}

MattCaspermeyer
09-09-2013, 07:21 PM
thanks a thousand! this is excellent and very complete tutorial..
On the dragon i have worked badly :grin: but i have had this game from one week, must still learn; as you said, am going by intuition and modding experience in other games.

I had already done a magic addition,but at the beginning without animation
then I have made a modification putting the basic animation "priest2", but the signalling on the struck targets is not seen, he signals only a target but he strikes at least 3.

main {
class=chesspiece
model=priest2.bma
cullcat=0
}
arena_params {
features_label=cpi_priest_feat
.........................
attacks=moveattack,shot,respawn,holy_rage,firethro w
...............
firethrow {
dontusenearenemy=1
device=firecatapult
class=throw
picture=BA1_CatapultFire_
picture_small=BA1_CatapultFire_small.png
distance=50
ad_factor=1
base_attack=0
mindist=2
reload=4
penalty=0.5
animation=cast/throw/thtarget //animation change with basic animation priest2
throw=catapultfireball
hinthead=special_fire_catapult_head
hint=special_fire_catapult_hint
framekey=x
7in1=0.5
friendly_fire=1
damage {
fire=5,7
}
custom_params {
burn=25
}
}


Hmmm... I haven't worked too much with the ATOM animations, but it looks like you copied firethrow from CATAPULT.ATOM to PRIEST2.ATOM.

Try this:

firethrow {
dontusenearenemy=1
// device=firecatapult <-- Comment out this line, I'm not sure what it does, so experiment
class=throw
picture=BA1_CatapultFire_
picture_small=BA1_CatapultFire_small.png
distance=50
ad_factor=1
base_attack=0
mindist=2
reload=3
penalty=0.5
animation=cast/throw/thtarget <-- you already changed this, so this should be correct
throw=priest2_ball <-- change this to the priest attack, I think it's needed as catapultfireball doesn't exist in the PRIEST2.ATOM, but not certain
hinthead=special_fire_catapult_head
hint=special_fire_catapult_hint
framekey=x
7in1=0.5
friendly_fire=1
damage {
fire=8,13
}
custom_params {
burn=50
}
}


I'm not sure if the above will do anything, but give that a try. Another thing you can try is (copy shot from PRIEST2.ATOM):

shot2 {
group=1,2
class=throw
base_attack=1
ad_factor=1
distance=7
mindist=2
showdmg=1
penalty=0.5
7in1=0.5
friendly_fire=1
animation=cast/throw/thtarget
throw=priest2_ball
framekey=x
damage {
magic=5,7
}
custom_params {
holy=150 //%
}
}


Try that, don't forget to add shot2 to the attacks list. Another thing is that if you look at the posthitmaster for PRIEST2.ATOM, you'll see that features_holy is being called. It is possible that you need to add the holy= custom parameter to your fireshot (change burn to holy) as you may be crashing the LUA features_holy function.

Do you run the game in debug mode? Open a command prompt in the AP directory and type kb -dev to launch the game in debug mode. You should have a "freeze" if there is a problem and then ALT-Tab back to Windows to see if there is a pop-up message.

A lot of the scripts don't have good error checking and since your fire_shot doesn't have a holy custom parameter, it will be nil in the LUA function and if the function doesn't check for nil (note that the Inquisitor's base and throw attacks both have a holy custom parameter) then it will crash the function.

Try that as any error in the LUA scripts will abort the script and it will just move on to the next unit.

Good luck!

/C\/C\

rikkaidd
09-12-2013, 06:27 PM
Good luck!

I am working at the boss demenion" verona.embryos.loc.txt"to increase his troops;
for modify his hero abilities, how i can to know what *.hero file corresponds to demenion???
i have already read your guide on as modify these * hero file!

furthermore I have a small problem of game,nothing what to do with modding :I am not able to reach/find samman on shettera ,is bug?

MattCaspermeyer
09-13-2013, 07:30 AM
I am working at the boss demenion" verona.embryos.loc.txt"to increase his troops;
for modify his hero abilities, how i can to know what *.hero file corresponds to demenion???
i have already read your guide on as modify these * hero file!

furthermore I have a small problem of game,nothing what to do with modding :I am not able to reach/find samman on shettera ,is bug?

Samman is "upstairs" - you have to go up on one of the flying rocks (or whatever they are called).

To find the list of heroes, there are a couple of different ways to do it:

Decompile all the *.HERO files (this is easily done if you build the BAT / CMD file in Excel - I did this for TL). You will see something like this:

{Y}{}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 11 elements
{
{U}{uid} = {26443629}
{U}{au} = {646065185}
{W}{h} = {ehero_system_hint_26443629}
{A}{ato} = {}
{A}{sp} = {spell_defenseless/spell_bless/spell_magic_bondage/spell_fire_ball}
{U}{le} = {17}
{U}{in} = {2}
{U}{ma} = {80}
{U}{atk} = {13}
{U}{de} = {5}
{Y}{fi}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 6 elements
{
{Y}{filter}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{A}{belligerent} = {ally}
}
{A}{pbonus} = {krit,20,0,0,-100,0,0}
{A}{dbonus} = {}
{A}{rbonus} = {}
{A}{attack_on} = {}
{A}{attack_off} = {}
}
}
}


See {U}{au} and ehero_system_hint_*? {U}{au} is the actor unit ID and you can search for that in ENG_ACTORS.LNG. You'll see that if you search for 646065185 you'll find Rake Yavik. You can also try to use the number after ehero_system_hint and search for that in ENG_ENEMY_HEROES.LNG. Sometimes the descriptor is not descriptive enough, but it should be enough. Sometimes an enemy hero won't have an {au}, but almost all of them do.

Another way to do it is to open ENG_ACTORS.LNG and search for the hero's name (they are almost always in this list). For example, for Demenion you'll see:


.
.
.
actor_system_1760723417_name=Lin Thorvald
actor_system_1760723417_sdesc_=Dwarven engineer
actor_system_1780811564_name=Demenion
actor_system_1780811564_sdesc_=Usurper-King
actor_system_1785069666_name=Workshop
actor_system_1789540691_name=Master Dagon
actor_system_1789540691_sdesc_=Dwarven engineer
.
.
.


Here you see Demenion, and then you see the description: "Usurper-King". You can then try to search in ENG_ENEMY_HEROES.LNG for "Usurper" you'll get:


.
.
.
ehero_system_hint_1246967819=The dreadful leader of the Orc Exodus. He is one of the seven champion-warriors elected to serve on the Council of Ancestors. And for twenty-five years, none have surpassed him in military skill.
ehero_system_hint_131404540=Usurper-King of Teana, who seized power through treachery. A very crafty opponent.
ehero_system_hint_1315000373=Dark Elf, servant of Demenion. It is said that under his leadership, monstrous atrocities are being committed in the prison.
.
.
.


You see that "ehero_system_hint_131404540" describes what seems to be Demenion. The number is the number of Demenion's *.HERO file: 131404540.HERO. Decompile his *.HERO file and you'll get:

{Y}{}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 11 elements
{
{U}{uid} = {131404540}
{U}{au} = {1780811564}
{W}{h} = {ehero_system_hint_131404540}
{A}{ato} = {}
{A}{sp} = {spell_lightning/spell_demonologist/spell_ram/spell_hypnosis}
{U}{le} = {46}
{U}{in} = {15}
{U}{ma} = {220}
{U}{atk} = {20}
{U}{de} = {20}
{Y}{fi}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{1} // 1 elements
{
{Y}{-N/A-}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 6 elements
{
{Y}{filter}, F_SORTED{0}, F_COMPACT_TAGS{1}, F_NONAMES{0} // 1 elements
{
{A}{belligerent} = {ally}
}
{A}{pbonus} = {}
{A}{dbonus} = {}
{A}{rbonus} = {physical,15,0,0,-100,0,0}
{A}{attack_on} = {}
{A}{attack_off} = {}
}
}
}


See the number for {U}{au}? That is the actor unit id and note that 1780811564 matches the name and description in ENG_ACTORS.LNG. That's how you'll know that you have the right file.

The best way to do it is the first way, but that requires you to decompile all the *.HERO files and match them up. The second or third way are good if you want to try just one.

I've meant to create a cross-reference hero list like I did for TL, but haven't gotten to it, yet. I'll try to get to it in the next couple of days for the full list, as it is easy for me to do...

Good luck! :-)

/C\/C\

rikkaidd
09-13-2013, 02:36 PM
thanks