Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > King's Bounty > King's Bounty: The Legend > Mods

Mods Everything about mods

Reply
 
Thread Tools Display Modes
  #1  
Old 11-19-2012, 10:26 AM
jukeey jukeey is offline
Approved Member
 
Join Date: Aug 2011
Posts: 16
Default

Sorry for my poor english; and i dont speak Russian.
Thx for advices, but im afraid, my goals impossible.

I will try to express myself more accurately, example:
I want to unit resistances should always visible on dlg_chesspiece, in new lines, not only hint. It is possible? And if yes, how?

I tried many ways, and failed. Logic....() is not enough. Cant fix hint as simple_text. Resistances available with Au....(unit); but the unit parameter how works? Can i set a unit from hero army? The best solution would be a new, own script. I studied game and mod files, i see the relationships, and i can write some scripts, but this task not feasible for me.

In warcraft3 editor, i was able to accomplish pickpocketing five minutes with triggers. 5 years ago, when programming was chinese for me. Code sipmply, logical; events, objects clearly. Easy to display my own textboxes with custom texts. Easy to insert my own models and textures. And great documentation with examples. Now i have experienced with delphi (+minimal javascript, actionscript, php knowledge). Lua syntax not too much of a problem; but kings bounty scripting very strange, and im afraid, very limited. And documentations not available or incomplete.
Reply With Quote
  #2  
Old 11-20-2012, 01:57 AM
MattCaspermeyer MattCaspermeyer is offline
Approved Member
 
Join Date: Aug 2010
Posts: 553
Lightbulb Give this a try...

Quote:
Originally Posted by jukeey View Post
Sorry for my poor english; and i dont speak Russian.
Thx for advices, but im afraid, my goals impossible.
Okay - that's not a problem, you'll just have to be patient with me when I ask you a bunch of questions...

Quote:
Originally Posted by jukeey View Post
I will try to express myself more accurately, example:
I want to unit resistances should always visible on dlg_chesspiece, in new lines, not only hint. It is possible? And if yes, how?
I think this may be possible...

I think the files you need to start with are: 1) ENG_UNITS.LNG (or your equivalent LNG files) and 2) TEMPLATES.LNG.

At the top of ENG_UNITS.LNG, you'll see where the text descriptions of the abilities are (i.e. you'll see such labels as CPI_LEADERSHIP, CPI_ATTACK, etc. (note that I've capitalized them here so they standout, but they are lower case in my LNG file)). Then you'll see equals (=) and usually a template surrounded by the caret, i.e. ^int_cpi_t0^. Such templates are in TEMPLATES.LNG (search in there for that template) and essentially serve as keywords for a "macro" that can do many different things to display text such as change the color, display a text string, run an LUA function, etc.

Now if you compare the unit cards between TL and WotN, you'll notice that Crit has been added and the unit's Current Health removed from the unit card.

Now what you want to do is add more lines to the the unit card. For this, I think the files you need to edit are DLG_CHESSPIECE.UI and INFO_CHESSPIECE.UI. From your other posts, I can see that you've been modding the UI files pretty extensively and so I think you already know how to edit these files. As far as I can tell, DLG_... is used for outside of the arena and INFO_... is used inside the arena (i.e. when you are not and are fighting battles, respectively).

For all the "begin simple text" statements, the text strings should be in the *.LNG files. For example, "cpi_initiative2" is in ENG_UNITS.LNG. You probably know a lot more about the UI files than I do, but there are other text strings (for example "text_15" or all the "text_##" strings for that matter) that I don't know where they are.

Now if you want to add the resistances, you need to look at the [res] macro under the cpi_defense_h label (in ENG_UNITS.LNG) using the def_hint_t1 template with the res macro (these are located in TEMPLATES.LNG): gen=gen_unit_res. This refers to the gen_unit_res function located in TEXTGEN.LUA. What you probably want to do, since you want the resistances to be spelled out separately, is you're going to want to create variants of that function (i.e. gen_unit_res_physical, ..._astral, ..._fire, etc.) that simply list a value for one resistance type that display the resistance values (as well as the base values). You'll then want to add the lines to display new text lines to the UI files and you can add the new labels to either ENG_UNIT.LNG or your can make a new LNG file with your new labels.

After that, you need to edit the picture of the dialogue to extend its space, but I think you already know how to do this.

I think that is pretty much it - hopefully I've been clear and if not ask more questions!

Quote:
Originally Posted by jukeey View Post
I tried many ways, and failed. Logic....() is not enough. Cant fix hint as simple_text. Resistances available with Au....(unit); but the unit parameter how works? Can i set a unit from hero army? The best solution would be a new, own script. I studied game and mod files, i see the relationships, and i can write some scripts, but this task not feasible for me.
The calls to gen_unit_res use the "data" variable, here is the code for the gen_unit_res function (note that there are two of them, so I'm not sure what happens in LUA in this situation, but they look identical to me):

TL TEXTGEN.LUA (lines 121-136):

Code:
function gen_unit_res(data)
local text=""

        local res_count=AU.rescount()
        for i=0,res_count-2 do
          local res = AU.resistance( data, i )
          local t=""
          if res>95 then res=95 end
          if res> 0 then t="<label=cpi_defense_res_D>" end
          if res< 0 then t="<label=cpi_defense_res_U>" end
        text=text.."<br> -<label=cpi_defense_res_"..(i+1)..">: "..res.."% "..t

    end

return text
end
TL TEXTGEN.LUA (lines 137-151):
Code:
function gen_unit_res(data)
local text=""
        local res_count=AU.rescount()
        for i=0,res_count-2 do
          local res = AU.resistance( data, i )
          if res>95 then res = 95 end
          local t=""
          if res> 0 then t="<label=cpi_defense_res_D>" end
          if res< 0 then t="<label=cpi_defense_res_U>" end
        text=text.."<br> -<label=cpi_defense_res_"..(i+1)..">: "..res.."% "..t

    end

return text
end
Note that this function runs at the end of the cpi_defense_h label via the def_hint_t1 template using the res macro. You may have to add new macros (i.e. res_physical macro that makes a call to your gen_unit_res_physical function, etc.) to the def_hint_t1 template in TEMPLATES.LNG to get AU to work correctly (I'm not sure when this library is available as I've tried to use it sometimes and it wasn't available for use). Another library that you can use if AU is giving you trouble is Logic with the cp_ functions (although it is more for getting base values of the chesspieces).

Let me know if any of this works for you - if you're still having trouble, I'll try to see if I can get it to work, although my time is really limited right now.

Good luck!

/C\/C\

P.S. One thing I'd like to do is to be able to allow units other than Priests to be upgraded via the DLG_CHESSPIECE.UI. I'm not sure how to do this, but I thought it would be neat to allow Beholders to be upgraded to Evil Beholders, etc. when you get the Paladin Inquisition skill. It seems like there has to be a way to get it to work with units other than just Priests, but maybe this is a limitation...
Reply With Quote
  #3  
Old 11-20-2012, 05:20 PM
jukeey jukeey is offline
Approved Member
 
Join Date: Aug 2011
Posts: 16
Default

Thank you very much for detailed advices.

Info_chesspiece.ui opening only on main window as infobox, when right click on unit in hero army.
All other cases the dlg_chesspiece.ui opening when click on unit, as dialog form.

Ui files easy editable, i wrote a program which can read this files, and show me visually with names and coordinates, no problem (i adjusted some ui files and png interface-textures for better appearance).

But resistances:
I think, the first "gen_unit_res" function maybe a trash, only the second works.
Your advices was my first idea, Tried and failed. Maybe i did something wrong; but i think, its simply dont work.

My second idea: creating 6 global variables, and including to loop in "gen_unit_res" this:
if i==0 then fiz=res end
if i==1 then mer=res end
if i==2 then mag=res end
if i==3 then tuz=res end
if i==4 then fag=res end
if i==5 then ast=res end

function gen_unit_res(data)
local text=""
local res_count=AU.rescount()
for i=0,res_count-1 do
local res = AU.resistance( data, i )
if res>95 then res = 95 end
local t=""
if res> 0 then t="<label=cpi_defense_res_D>" end
if res< 0 then t="<label=cpi_defense_res_U>" end
if i==0 then fiz=res end
if i==1 then mer=res end
if i==2 then mag=res end
if i==3 then tuz=res end
if i==4 then fag=res end
if i==5 then ast=res end

text=text.."<br> -<label=cpi_defense_res_"..(i+1)..">: "..res.."% "..t
end

if Game.LocIsArena() then
if Attack.act_feature(data, "humanoid") then
local count = Attack.val_restore(data,"contrstrike")
if count~=nil and count~="" then
text = text.."<br><br>Îňâĺňíűő ŕňŕę îńňŕëîńü: "..count
end
end
end

return text
end

This is work, new variables got the correct resistance values, when function execute, but problems:
This function execute when hint appear (onmouseover event on gui_object_name "defense" on chesspiece dialog).
So not enough to open the dialog, must move the cursor over "defense" text.
I can adjust this invisible object over cursor, or fullscreen
Variables got the values, but new texts not refreshed actually, only when opening next time the dialog...
Events and other essential things seems absolutely unavailable. Its serious?

Other:
I understand what do you want, great idea. But im afraid, impossible with this way. Too limited, this few modifiable thing is chaotic. With a decent editor or api, we can make castles, buildings for races, write pathfinding algorithm for ai, etcetera. Better than homm. But with this pile of diffuse code, i say, waste of time. Great, beautiful, funny and tactical game with terrible mechanism. Maybe converting models and write a new program, easiest and time-saving modding.
Reply With Quote
  #4  
Old 11-21-2012, 02:03 AM
MattCaspermeyer MattCaspermeyer is offline
Approved Member
 
Join Date: Aug 2010
Posts: 553
Default

Quote:
Originally Posted by jukeey View Post
Thank you very much for detailed advices.

Info_chesspiece.ui opening only on main window as infobox, when right click on unit in hero army.
All other cases the dlg_chesspiece.ui opening when click on unit, as dialog form.

Ui files easy editable, i wrote a program which can read this files, and show me visually with names and coordinates, no problem (i adjusted some ui files and png interface-textures for better appearance).
Wow - you wouldn't have this available for other people to use would you?

I've actually been updating my HOMM3 Babies (H3B) mod to extend the spirit upgrade UI and have been doing it by hand. I've been making some changes and I was running out of room and so decided to start fiddling with the interface - your mod that did this helped me out, although when I replied to you at first I didn't realize you were the one who created this mod.

Quote:
Originally Posted by jukeey View Post
But resistances:
I think, the first "gen_unit_res" function maybe a trash, only the second works.
Your advices was my first idea, Tried and failed. Maybe i did something wrong; but i think, its simply dont work.
Was it giving you an error with the AU library? It seems like you should be able to display whatever you want on these info cards, although maybe the limitation is that you have to use CPI parameters. Hmmm...

Quote:
Originally Posted by jukeey View Post
My second idea: creating 6 global variables, and including to loop in "gen_unit_res" this:
if i==0 then fiz=res end
if i==1 then mer=res end
if i==2 then mag=res end
if i==3 then tuz=res end
if i==4 then fag=res end
if i==5 then ast=res end

function gen_unit_res(data)
local text=""
local res_count=AU.rescount()
for i=0,res_count-1 do
local res = AU.resistance( data, i )
if res>95 then res = 95 end
local t=""
if res> 0 then t="<label=cpi_defense_res_D>" end
if res< 0 then t="<label=cpi_defense_res_U>" end
if i==0 then fiz=res end
if i==1 then mer=res end
if i==2 then mag=res end
if i==3 then tuz=res end
if i==4 then fag=res end
if i==5 then ast=res end

text=text.."<br> -<label=cpi_defense_res_"..(i+1)..">: "..res.."% "..t
end

if Game.LocIsArena() then
if Attack.act_feature(data, "humanoid") then
local count = Attack.val_restore(data,"contrstrike")
if count~=nil and count~="" then
text = text.."<br><br>Îňâĺňíűő ŕňŕę îńňŕëîńü: "..count
end
end
end

return text
end

This is work, new variables got the correct resistance values, when function execute, but problems:
This function execute when hint appear (onmouseover event on gui_object_name "defense" on chesspiece dialog).
So not enough to open the dialog, must move the cursor over "defense" text.
I can adjust this invisible object over cursor, or fullscreen
Variables got the values, but new texts not refreshed actually, only when opening next time the dialog...
Events and other essential things seems absolutely unavailable. Its serious?
Hmmm... I wonder if this is once again because of the CPI values. I think I'll experiment with this and see if I can provide any new insight into the problem. Maybe if we put our heads together we can figure it out...

I know that a lot of stuff in TL is hard coded, but when they went to AP and beyond they opened stuff up.

Case in point, I'm still working on my H3B mod for TL and have made a change to the Ice Thorns ability where not only do they block passage, but they also hit and damage units if they are within the fall radius (the hexes surrouding the triad of 3, i.e. if the unit wasn't there a thorn would be created in that hex).

I've been able to get everything working except having the damage hint show up correctly. It seems like to get it to calculate the cells properly, you have to use Attack.multiselect(3), but when you do that, if you turn on hints, the units have to be within the multiselect triad to have damage displayed even though the calccells function selects the cells surrounding that triad.

So it is silly - the highlighted hexes will be the ones where the thorns go and are around the triad, but I have to place the triad on top of units (where the thorns don't go) to get it to display the damage hint, which is not correct.

I haven't given up, yet, but I know what you mean when it comes to dealing with limitations of the game engine / system. If you look at Fishes and Rage Drain, though, these abilities don't show the damage either and so I think that it is most likely a limitation of TL or it was too convoluted to implement so I might give up soon and have it not display the hint just like Fishes and Rage Drain (although if I figure out how to do it for Ice Thorns, then maybe I can try to do it for these two as well).

/C\/C\
Reply With Quote
  #5  
Old 12-01-2012, 06:58 PM
saroumana saroumana is offline
Approved Member
 
Join Date: Jan 2010
Posts: 87
Default

Hello matt,

You're the most advanced modder for KB (except may be russian one ). I have a question for you : it's possible to transfert new addition for warrior of the north to armored princess ? I mean : new unit, new skill, new spell and new ability. Rage system of WotN is crap like his campaign.

There so many change in LUA files that it's not realistic to transfert them one by one, only if we can import whole files....and what files ? LUA, .TXT, all loc_ses ok but how to integrate them into the Armored princess campaign with Amelie for Hero ?

My question is ridiculous, no one know.
Reply With Quote
  #6  
Old 12-02-2012, 05:24 AM
MattCaspermeyer MattCaspermeyer is offline
Approved Member
 
Join Date: Aug 2010
Posts: 553
Post Should be doable...

Quote:
Originally Posted by saroumana View Post
Hello matt,

You're the most advanced modder for KB (except may be russian one )
The only reason why that is, is because I can't ask them any questions!

Seriously, I'm sure there are quite a few good ones on the board here, but thanks!

Quote:
Originally Posted by saroumana View Post
I have a question for you : it's possible to transfert new addition for warrior of the north to armored princess ? I mean : new unit, new skill, new spell and new ability.
The big question is whether or not it uses the exact same engine. If it does, then you may be able to port whole files, but most likely not since everything is intertwined.

I'm in the throws right now of making my H3T mod for AP and CW and I wish I could easily port stuff over from my H3B mod for TL and be done, but it is much more involved than that.

I've been striving to create a common set of files between my AP and CW H3T mods and so far it is doable, but time consuming. Then the CW variant will have a superset of the files that are different, and then if I happen to still be wanting to mod this game, the WotN files would be another superset...

I'm also still working on my H3B mod for TL and have a big update coming...

The point is that you're most likely right in that it'd be really time consuming, but it is doable so long as my comment about the engine being the same is true.

Quote:
Originally Posted by saroumana View Post
Rage system of WotN is crap like his campaign.
Tell me about it - I actually started playing WotN, but then when I saw how buggy it was, I figured I'd shelve it and wait 6 months for it to be fixed.

I bet Jukeey could update the Rage Ability UI and make room for another set of abilities around the core 9 (i.e. another 16 new abilities) for a total of 25 - 4 each for the 5 Valkyries and then 5 for your hero (or something like that). Would be cool!

Anyway...

Quote:
Originally Posted by saroumana View Post
There so many change in LUA files that it's not realistic to transfert them one by one, only if we can import whole files....and what files ? LUA, .TXT, all loc_ses ok but how to integrate them into the Armored princess campaign with Amelie for Hero ?

My question is ridiculous, no one know.
Unfortunately, this may be the only way. You know, I tried to port TL to AP (or maybe it was vice versa) by simply copying the *.kfs files and it totally bombed when I launched the game. You could try this, though, and see what happens - it won't hurt anything. If it doesn't work, then you can just restore all the AP files.

You could also go the other way, and try the AP files with the WotN engine - that might be the better idea, actually, since AP should have at least everything that WotN has. You would not to have to worry about the engine being different, either. It also might be easier, then, to splice in the AP maps, quests, etc. into the WotN *.kfs files.

Most likely, though, you're in for quite a long project.

For the skills, you might be able to simply replace the SKILLS.TXT in AP with the one for WotN, but you'll have to follow a similar process as above with respect to finding all the functions used by the skills (most likely in SKILLS.LUA), the skill picture icons (they may be in a TEX*.DDS file), and then editing HERO.TXT to include the skills for each class to start with (amongst other tasks).

There are quite a few users on the forums with knowledge modding WotN (i.e. the BugFixes thread) - maybe you can get one of them to help you? Probably would be a better use of their talents since Katauri / 1C are the ones who are supposed to fixing the game (we gave them money after all), although, I whole-hearted appreciate their efforts!

/C\/C\
Reply With Quote
  #7  
Old 12-02-2012, 12:07 PM
saroumana saroumana is offline
Approved Member
 
Join Date: Jan 2010
Posts: 87
Default

Quote:
The big question is whether or not it uses the exact same engine. If it does, then you may be able to port whole files, but most likely not since everything is intertwined.

I'm in the throws right now of making my H3T mod for AP and CW and I wish I could easily port stuff over from my H3B mod for TL and be done, but it is much more involved than that.

I've been striving to create a common set of files between my AP and CW H3T mods and so far it is doable, but time consuming. Then the CW variant will have a superset of the files that are different, and then if I happen to still be wanting to mod this game, the WotN files would be another superset...

I'm also still working on my H3B mod for TL and have a big update coming...

The point is that you're most likely right in that it'd be really time consuming, but it is doable so long as my comment about the engine being the same is true.
The engine is different, they upgraded it for steam. But i don't think they make change to script or to many LUA function (although it's possible :/).

In fact i tried to use Wotn into a new campaign for crossworld, but it don't work, also in the editor, so yeah unfortunately there are some portability problem.

Quote:
Tell me about it - I actually started playing WotN, but then when I saw how buggy it was, I figured I'd shelve it and wait 6 months for it to be fixed.

I bet Jukeey could update the Rage Ability UI and make room for another set of abilities around the core 9 (i.e. another 16 new abilities) for a total of 25 - 4 each for the 5 Valkyries and then 5 for your hero (or something like that). Would be cool!

Anyway...
It's a sage decision, Wotn is actualy full of bug. When i mod my new unit, i don't always know if it's my bugs or theirs.

And yes it would be cool to have new ability for valkyries but animation and rage skill are pretty hard to mod.

Quote:
Unfortunately, this may be the only way. You know, I tried to port TL to AP (or maybe it was vice versa) by simply copying the *.kfs files and it totally bombed when I launched the game. You could try this, though, and see what happens - it won't hurt anything. If it doesn't work, then you can just restore all the AP files.

You could also go the other way, and try the AP files with the WotN engine - that might be the better idea, actually, since AP should have at least everything that WotN has. You would not to have to worry about the engine being different, either. It also might be easier, then, to splice in the AP maps, quests, etc. into the WotN *.kfs files.

Most likely, though, you're in for quite a long project.

For the skills, you might be able to simply replace the SKILLS.TXT in AP with the one for WotN, but you'll have to follow a similar process as above with respect to finding all the functions used by the skills (most likely in SKILLS.LUA), the skill picture icons (they may be in a TEX*.DDS file), and then editing HERO.TXT to include the skills for each class to start with (amongst other tasks).

There are quite a few users on the forums with knowledge modding WotN (i.e. the BugFixes thread) - maybe you can get one of them to help you? Probably would be a better use of their talents since Katauri / 1C are the ones who are supposed to fixing the game (we gave them money after all), although, I whole-hearted appreciate their efforts!
They changed nearly all functions ! Most spell,skill and ability ! That why there are so many bugs in wotn.
I would prefer to grad all LUA,TXT and loc_ses and found inside how to make amelie the hero inside wotn files. After find what Armored princess engine don't like into them....hard job, yup, but may be doable.
Reply With Quote
  #8  
Old 11-20-2012, 09:31 PM
Sir Whiskers Sir Whiskers is offline
Approved Member
 
Join Date: Dec 2008
Posts: 149
Default

Quote:
Originally Posted by MattCaspermeyer View Post

P.S. One thing I'd like to do is to be able to allow units other than Priests to be upgraded via the DLG_CHESSPIECE.UI. I'm not sure how to do this, but I thought it would be neat to allow Beholders to be upgraded to Evil Beholders, etc. when you get the Paladin Inquisition skill. It seems like there has to be a way to get it to work with units other than just Priests, but maybe this is a limitation...
There is a mod for KB:TL called "army shop" or some such. It includes a mod (training camp) that allows you to upgrade troops, including the example you gave of Beholders to Evil Beholders. The choices in the mod seem somehwat arbitrary, e.g., I believe you could upgrade Inquisitors to Archmages.

Not sure if you can still find the mod on these boards. If not, let me know and I'll try to upload it to this thread.

Note: the mod I mentioned requires KBMaster mod.
Reply With Quote
  #9  
Old 11-21-2012, 01:34 AM
MattCaspermeyer MattCaspermeyer is offline
Approved Member
 
Join Date: Aug 2010
Posts: 553
Default

Yah - I know about that mod (and I'm pretty sure I have it), it would just be nice to use the UI on the unit info card to do it, though, since it works so well. Plus, I kind of wanted to make the Inquisition skill apply to units other than just Priests / Inquisitors, but work with similar pairs (i.e. Robbers -> Marauders, Barbarians -> Berserkers, Bear -> Ancient Bears, etc.).

It must be hard-coded, though, since the developers basically used the "army shop" style to perform the upgrades (especially with CW), but it seems like it is a simple logic switch to say let this unit be upgraded to another. Oh well, thought I'd mention it...

/C\/C\

Quote:
Originally Posted by Sir Whiskers View Post
There is a mod for KB:TL called "army shop" or some such. It includes a mod (training camp) that allows you to upgrade troops, including the example you gave of Beholders to Evil Beholders. The choices in the mod seem somehwat arbitrary, e.g., I believe you could upgrade Inquisitors to Archmages.

Not sure if you can still find the mod on these boards. If not, let me know and I'll try to upload it to this thread.

Note: the mod I mentioned requires KBMaster mod.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:28 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.