Technical Help (modders plz)

Users who are viewing this thread

Ashes42

Sergeant
This is a topic for coding questions.  If you see I made it so you could change your banner, and you can't figure out how I did it in the code, this is the place.  This is basically, tech talk with me ; ) and anyone else who shows up.

I already posted some of this in the MOD dev board, but I think I actually get more traffic here, and its more like a personal conversation here... I dunno whatev.

My current issues holding up the NPC system are relatively simple.  Names and Stats.  Before I can make the new AI I need new NPCs, and a creation mechanic for them.  There are a number of ways to approach this.  The best thing would be if I could re-write the troops file whenever I saw fit, though that could have cross save-game problems.  The other thing that works is if I get system calls to access the array in which each item/troop/faction/whatever is.  This actually would make me most happy.  Right now in header_operations I have the function calls store_character_level and str_store_troop_name.  So I can retrieve the information, but I really need to be able to set it.  I also need to be able to remove xp, I may actually be able to do this, but I am unsure, and it doesn't work if I can't prevent it from hitting negative.  (I can change skills and attributes using the raise_attribute call, which accepts a negative raise, and clamps the value to not go below 0, an extremely useful tactic.)

Thats actually going to be the next thing I try ; ), time for test-code.

I also need to be able to change names though, names of NPCs and names of factions.

*edit* Ok add_xp can take a negative value, so I can reset the xp down, but I can't figure out how to lower their level, which is problematic
 
Could you release a zip with all the module_system files in it, so I don't have to download each one manually?

I want to find the places where you allow the player to attack even when he hasn't joined a faction yet, and add this stuff to my personal mod.  If there's an easy way to do this I would love to hear it, but otherwise I'll have to figure it out on my own, which isn't always a bad thing.

 
http://forums.taleworlds.com/index.php/topic,27721.0.html
That details how to use subversion (SVN) repositories, which is what we have set up, you probably want to look in the tags .1g.2 folder.

In actuality you probably don't need all the files, I'm pretty sure the changes you want are contained in module_game_menus.py.  In any case, I'd start there, find the change w/ joining battles as neutral (probably just a few variables and options) and trace any calls to that location from other files and check those places maybe, if it doesn't work.
 
Thank you!

I've worked it out so I can do all I wanted (attack any castles and take them while neutral, and join battles on either side).  :smile:
 
If you're to modify troops in-game, make sure the changes are saved and loaded when you quit and continue the game, as opposed to the game reading it from the troops.txt file.

I did re-equipping of all troops in the game, but it doesn't seem to save and when you load the game all troops have the old equipment that is defined in in troops.txt
However some players said that it does save properly for them, so maybe there's a difference with the 'realistic'/'unrealistic' saving, or another option.
 
In my mod which uses parts of yours, such as being able to attack while neutral, I managed to take a castle as a neutral, but the village didn't become mine with the castle, instead it belonged to no one.

How do I make the village stay attached to the castle so when I take the castle, the village joins my faction?


Edit: Nevermind, I got it working.
 
Chel said:
If you're to modify troops in-game, make sure the changes are saved and loaded when you quit and continue the game, as opposed to the game reading it from the troops.txt file.

I did re-equipping of all troops in the game, but it doesn't seem to save and when you load the game all troops have the old equipment that is defined in in troops.txt
However some players said that it does save properly for them, so maybe there's a difference with the 'realistic'/'unrealistic' saving, or another option.

Tell me Chel, does this afflict your NPCs or only your basic sort of line troop.  If its your line troop I know why it is, and thats what my feeling is.  In the game, a troop can be created and destroyed from a template (in the troop.py file)  These troops are simply saved as a reference to this memory location, if you change the current content of the memory location and then reload, it goes back to where it was referenced, which hasn't changed.  I bet whether or not they are treated that way in game is dependent on whether or not the character is a tf_hero.  A hero can't be duplicated, as evidenced by the bugs I ran into with invisible characters, 2 marnids becomes 1 marnid, because there can't be two.  Similarly Marnids stats, his inventory, etc, are saved in the save-game, because he is a hero.

I haven't checked any of this, but I think it is the case.
 
I got a question.  I am not using anything from bandit king, but I know you have made it so kingdom heroes can be captured.  If I change hero_escape_after_defeat_chance = 100 to a number below that, will there be any problems with native code?

side note: dang it looks like someone implemented being a mercenary before me, but mine will be a little different.
 
Chel said:
If you're to modify troops in-game, make sure the changes are saved and loaded when you quit and continue the game, as opposed to the game reading it from the troops.txt file.

I did re-equipping of all troops in the game, but it doesn't seem to save and when you load the game all troops have the old equipment that is defined in in troops.txt
However some players said that it does save properly for them, so maybe there's a difference with the 'realistic'/'unrealistic' saving, or another option.
Instead of adding you can remove it, it worked for me on 808
 
Hy, guys. Well, for months I've tried and tried again and again to properly install Python and get it to "marry" Mount&Blade" nice and happy... They didn't get along very good.

What happened is this: I followed every step of the Modding tutorial. I made a new module, copying all files from the Native, gave it a name and tried to compile it with Module Bat. Funny thing, a bunch of files were born, all named after the name of my module (for example, my module name was "Zero" -- the files were: "Zeroconversations.txt", "Zerofactions.txt" etc. etc. and THEY WERE PLACED OUTSIDE THE MODULE FOLDER!!! I know i set the path well (export_dir) in "module_info"... and, of course, because of this no modification could I make with the new module. The complier errored.

Of corse I installled and reinstalled again, lots of times, I even reinstalled Windows, nothing. I searched the net for an answer and I found some basic tutorial for Python programming, a really nice made one. There I learned correctly how to set the environmental path and also how to check in command line if Python was properly installed. It was properly installed but my Module System couldn't still get that hot night with him...

Today I simply renamed my new Module and it works now! At least I can concentrate on other things than system variables, pure programming, and weirdy virtual machines weddings.

Any ideas why this all happened? Any of you had any similar experiences? I think the problem  it's not with Python or Windows. Could it be with the ModuleSystem?

Oh, and about the new Bandit King. It's fine but it really needs serious improvements, both technical and... philosophical...

Keep in touch. See you.
 
paladinjedi said:
What happened is this: I followed every step of the Modding tutorial. I made a new module, copying all files from the Native, gave it a name and tried to compile it with Module Bat. Funny thing, a bunch of files were born, all named after the name of my module (for example, my module name was "Zero" -- the files were: "Zeroconversations.txt", "Zerofactions.txt" etc. etc. and THEY WERE PLACED OUTSIDE THE MODULE FOLDER!!! I know i set the path well (export_dir) in "module_info"... and, of course, because of this no modification could I make with the new module. The complier errored.

Did you remember the / after your module_info ...Mount&Blade/Modules/Banditking/ as opposed to ...Mount&Blade/Modules/Banditking  The latter would cause your issue.

And whats wrong with Bandit King?

The last patch or two has been alot of work on making a toolbox of things that I can call on and put together.  It may seem messy.
 
Yes, now I finally know that it was that damn slash at the end of the folder path... Geeze, such small things lead you to going crazy for months, ughhh...

Am I right thinking that without that final / the compiler used the last folder with a slash and created ad-hoc those files for some reference or...?

Anyway, back to what keeps me inside near the monitor for hours. This modding. Listen, I have a very few notions of programming, some C++, I've read the tutorial about modding and I could place a town on the map, add some items... very basic stuff. all the code is not that foggy for me but until sunrise it's a  long way to go. And what I really am better with is concepts, literature, that I like more than modding. But, everybody is so busy with something that I must put my ideas to wait and learn programming... ughhh, again...

The main thing would be this: I want to be able to seige at free will, you know, the main concept of Bandit King... I think that should have been a standard reasonable option in Native, total freedom of play, man, if the crazy adventurer wants to attack everybody then why not? If she gets punished quickly, especially if she rushes in this from the beginning when she isn't experienced enough, well, that's another story. But she should have this chance, whether joining a faction or not. Correct?

So: what is the simplest way for this when creating a new mod? (A step-by-step short tutorial for beginners would be very, very, very welcome). Something in "module_game_menus" about sieging... Trust me, I replaced the code from my new module's "module_game_menus" with the code from Bandit King. All right, no compiling errors but no change in the game! Sure, the case is more complicated (as always...), there must be some links to other files perhaps or smth?

By the way, the ":can_siege" is a variable decalerd only in this file?? I thought it should also be present in another...

I would really like to understand more, not just "copy-paste" but how? Should I learn programming from A to Z? That could take a lifetime...

Ok, now about Bandit King. I really like the freedom of doing whatever you want. But, let's think of a situation: I attack a town, factions get angry, then I go to them in all humility and pay the peace with cash. All troubles at once forgotten! Should have been named "Heaven Mod". Then I conquer another town and again make peace and so on until everybody gets lost in the dark and I'm the only faction standing... waiting for the next Sith wave, perhaps? Very cool... I cannot get  a noble right, no right to start a new kingdom so that some real diplomatic treaties may take place... And if a kingdom is fully defeated you can still see caravans of that faction roaming around... if you talk too much with that meesenger in the castle halls you get so much lost in discussions that you can't even exit from the menu... If your castle is sieged and you enter it, your own guards say "Surrender or die!", you carry a whole bunch of captured lords like babies, can do nothing with them, only for sightseeing... and other funny things...

I want to help you make this mod a superb one, the best of all. My strong point, I repeat, is concepts, ideas, literary stuff.  I would also like to learn  some programming and modding so things could go smoother, faster. This mod deserves more improvements.

Hope to hear from you soon, noble knights...
 
paladinjedi said:
Yes, now I finally know that it was that damn slash at the end of the folder path... Geeze, such small things lead you to going crazy for months, ughhh...

Am I right thinking that without that final / the compiler used the last folder with a slash and created ad-hoc those files for some reference or...?

Without the final slash the folder and file wasn't parsed BanditKing/module_items.py became a file Banditkingmodule_items.py

Don't worry though we all make mistakes, I was stuck for a number of weeks because there was a g instead of a q in a single line of code.

Anyway, back to what keeps me inside near the monitor for hours. This modding. Listen, I have a very few notions of programming, some C++, I've read the tutorial about modding and I could place a town on the map, add some items... very basic stuff. all the code is not that foggy for me but until sunrise it's a  long way to go. And what I really am better with is concepts, literature, that I like more than modding. But, everybody is so busy with something that I must put my ideas to wait and learn programming... ughhh, again...

The BK code is its own language, that said, all the concepts of coding transcend language.  Being able to talk to computers is a useful and valuable skill to have, but it takes a while to develop.  If you want to learn code for modding, focus on that.  The best thing to do is to find code you want to change, and then understand it as fully as you can, go line by line and figure out what each thing does, look up what you need, follow all the references, etc, find what calls that function and why, etc etc.  Once you can do that, change it a little to do something else, and so on.  It's time consuming, but its the fastest way to grasp it, rather than learning C++ all over again, or whatever.


So: what is the simplest way for this when creating a new mod? (A step-by-step short tutorial for beginners would be very, very, very welcome). Something in "module_game_menus" about sieging... Trust me, I replaced the code from my new module's "module_game_menus" with the code from Bandit King. All right, no compiling errors but no change in the game! Sure, the case is more complicated (as always...), there must be some links to other files perhaps or smth?

learn to use grep, there may be a windows equivalent, I stole a windows version of grep though.  All grep does is search files for specific strings, but its power is invaluable.  You would want to find everywhere that menu is called in all the other files of the game, so something like grep mnu_siegestuff BanditKing/* would bring you a list.  Extremely useful.  I might have the syntax backwards, I do that sometimes, but the idea is there.

Ok, now about Bandit King. I really like the freedom of doing whatever you want. But, let's think of a situation: I attack a town, factions get angry, then I go to them in all humility and pay the peace with cash. All troubles at once forgotten! Should have been named "Heaven Mod". Then I conquer another town and again make peace and so on until everybody gets lost in the dark and I'm the only faction standing... waiting for the next Sith wave, perhaps? Very cool... I cannot get  a noble right, no right to start a new kingdom so that some real diplomatic treaties may take place... And if a kingdom is fully defeated you can still see caravans of that faction roaming around... if you talk too much with that meesenger in the castle halls you get so much lost in discussions that you can't even exit from the menu... If your castle is sieged and you enter it, your own guards say "Surrender or die!", you carry a whole bunch of captured lords like babies, can do nothing with them, only for sightseeing... and other funny things...

Buying you faction relations back was an addition of .903, not of BK.  I'm not sure what I want to do with it yet.  I agree buying them off all the time is silly, but I like the option of a way to change your faction back from a bad negative.  Anyway, I should probably take it out.

Also a number of the things you mention I'm working on with the new AI.

I want to help you make this mod a superb one, the best of all. My strong point, I repeat, is concepts, ideas, literary stuff.  I would also like to learn  some programming and modding so things could go smoother, faster. This mod deserves more improvements.

Learn how to do dialogs.  Dialogs are a little annoying and pissy.  After I get the new AI in I would like to change the dialogs to reflect the characters' personalities, of course it's a bunch of work that I'm not exactly thrilled about.  So there's a way for you to contribute.  Once the next release is out (might be a while, it's more work than I thought it was going to be.)  Let me know if you want to do it.
 
Thanks for the encouragement. I'll try with dialogs but I don't make any promises, it's still too much cloggy stuff there and I really like  playing more than  modifying. I mean I try once or twice but if it doesn't get good, I break. I don't want to go completely crazy.

I'll let you know of my progress from time to time. It would be best if someone else would deal woith dialogues also, cause, as I say, no guarantee that I'll obtain any results more than crashing my nerves in the end. I'm more a day dreamer than a calculate technician. I'm sorry.

You still haven't told me if there was more to do than just replacing "module_game_menus" for being able to seige.
 
I think its in game menus and in scripts (at the encounter initilization stuff.)  Use grep and diff, they are your friends.  (diff shows differences between two files, that way you can separate my code from the native source.
 
Hy again.

First, let me ask you if I can post here questions regarding playing in one message, together with facts about modding. I don't want to mess any rules and I don't like writing two different messages in two different sides either.

1. About modding: I have downloaded a Windows version of grep and I started a search: I put it to search for the word "war" (I have read the forum somewhere that by modifying the war rate you can have kingdoms get to war to each other more often... is that corect?) in the Module System folder. Why does it take that enormously too long to search? I had to stop it. I think I'd better use Windows regular search :smile: . Or is something I did or did not do right again??

2. About playing: Just see this. My character is a level 32 and a 2 handed fighter. Same 2 h are also my officers (Marnid, Borcha etc.). We all have best armors, horses and weapons in the game. While we were able to defeat a large army of 1200 nordsmen while we were only 125, not easy of course, but we could do it... When we were 237 in numbers and encountered an army of 1600 khergit they finished us off like weakin chicken! My own character was took off by two couched lance nice spice... Why?
And another thing: From what I know speed on the map is related to number of party, the bigger the lower speed, right? Then how could I not run at all from that huge number of khergits? They got to us twice while I tried runnig and trust me, they covered a considerable large map distance incredibly fast!!! Not fair, I say. There must be a mistake.

As it also must be the fact that if you own a debt to the troops for about two or three weeks, it begins to grow so fast that even when you have a few castles you can't make it up. I think it doubles every week so you have zero money in inventory and angry troops all around, not to mention that you can't afford any equipment or hire anybody that way!

Also: If I invest a skill point in my officers Train or Engineer (and I think even other skills) when they level up, when I exit the leveling up screen and enter again, the point was spent for good but their status in that branch has not increased at all!!! Only those for strength and riding work.

There must also be a bug with cows, when you want to deliver them to villages. Sometimes they are not outside the village as soon as you've bought them, other times they get lost on the map or don't want at all to go in that village direction, especially if it is a border village (end of map...). Shouldn't have been easier to just make he cattle follow somehow, with, let's say special food for them carried in inventory or tiding them up? These missions are very frustrating and don't get you much xp. I still find them important because they put you in good terms with villagers and, in my opinion this is very important. If, in my view, of course, you don't care about simple people lives you don't really deserve to become a king...

Now, also about some concepts. I know the mod is called Bandit King and it's okay for those wild-spirited players who want to destroy everything in their path. Even here you should have more options, for example allying and treating with other bandit faction leaders -- are there any?... maybe.

The whole actual mod anyway I think it's inappropriate for people with my stile of play that want to overcome the existing forces and creating an empire (That is why Native mod is limited and does not offer enough freedom) BUT do not do banditing!!! I don't raid caravans, I don't loot villages, I only fight the armies, honourable and fair. I also care about simple people and help villages as much as I can. The other lords impose havy taxes and loot them at free will. Who is the bigger outlaw here? That is why I have proposed a mod, a way for you to win the sympathy of masses and creating your own kingdom, then an empire where all people are united, undivided... Noble blood, yeh, but if that "noble blood" oppresses too much the "unnoble" blood, then is no nobility there. Anybody can give you life, a peasant or a king but it's your vision, the way you live your life and your deeds that win the right noblity not a bought paper from a greedy, bootlicker, fat lord... So, should the player have total freedom or only more freedom than usual? Think about that.
 
paladinjedi said:
1. About modding: I have downloaded a Windows version of grep and I started a search: I put it to search for the word "war" (I have read the forum somewhere that by modifying the war rate you can have kingdoms get to war to each other more often... is that corect?) in the Module System folder. Why does it take that enormously too long to search? I had to stop it. I think I'd better use Windows regular search :smile: . Or is something I did or did not do right again??
You did something wrong, grep should return near instantaneously, just about all the time.  Try and comprehend the syntax (I think grep -h will do it, or just grep, will return a list of how to talk to it.)  Make sure you put in what you want to search for and where to search, and use wildcards to help you out (* is a wildcard, it matches any string, so BanditKing/* is all the files in the bandit king folder, and h*ll returns a match for things like hill hell or even highbill.

My own character was took off by two couched lance nice spice... Why?
And another thing: From what I know speed on the map is related to number of party, the bigger the lower speed, right? Then how could I not run at all from that huge number of khergits? They got to us twice while I tried runnig and trust me, they covered a considerable large map distance incredibly fast!!! Not fair, I say. There must be a mistake.
Couched lances own, end of story ; ).  Map speed is based on size, and amount of mounted troops, Khergits are almost entirely on horseback therefore, very fast.

As it also must be the fact that if you own a debt to the troops for about two or three weeks, it begins to grow so fast that even when you have a few castles you can't make it up. I think it doubles every week so you have zero money in inventory and angry troops all around, not to mention that you can't afford any equipment or hire anybody that way!

Perhaps when you get a debt, release some troops from service so that you don't build more debt.

Also: If I invest a skill point in my officers Train or Engineer (and I think even other skills) when they level up, when I exit the leveling up screen and enter again, the point was spent for good but their status in that branch has not increased at all!!! Only those for strength and riding work.

Aides stats is buggy, I know.  I think I've fixed it already, but I'm not releasing to fix one non-gamebreaking bug.

native

The whole actual mod anyway I think it's inappropriate for people with my stile of play that want to overcome the existing forces and creating an empire (That is why Native mod is limited and does not offer enough freedom) BUT do not do banditing!!!

Bandit King isn't about death and distruction, bandit king is about options.  You should still be able to play your own way, if it seems like you can't then it's probably because I havn't had the chance to put it in yet.
 
I still can not find the possibility for free siegeing. I've been looking in "module_game_menus", "module_scripts" and "module_simple_triggers" over and over again for many hours and I see no way to do it. The tutorial is very limited, also.

Why isn't it an option menu like "Enter the arena" or "Visit the tavern"? 

I just want to be able to siege as neutral for now. This is my actual concern. Could you please tell me exactly what files are involved, all of them and a short step-by-step what to do, which option should I modify first and what effects does it have in the other files?

Please, it's very important to me. I've tried everything. maybe things will become more clear with a bit of specific help. Thank you very much for your time and concern...
 
Back
Top Bottom