Updated Module System Tutorial Mar 29 2009 - see first thread!

Users who are viewing this thread

jik said:
froggyluv said:
Stupid question (you'll be getting a lot from me), but I learn more by disecting other mods to see how they go about doing things - how do I look at a file (in written form rather than binary), ie. Modules_Troops, from a mod once it has already been converted to code?

The first part of the tutorial explains this.

Sorry, but I've re-read the frirst part 10 times now and I just din't see how you convert M&B coding back to Python to be able to read it.
 
froggyluv said:
jik said:
froggyluv said:
Stupid question (you'll be getting a lot from me), but I learn more by disecting other mods to see how they go about doing things - how do I look at a file (in written form rather than binary), ie. Modules_Troops, from a mod once it has already been converted to code?

The first part of the tutorial explains this.

Sorry, but I've re-read the frirst part 10 times now and I just din't see how you convert M&B coding back to Python to be able to read it.

Sorry, I read your request wrong.  No reverse engineering that I have seen.  Your best bet it to get snippits of code from the mod maker (some post there stuff) and learn how to implement it and adjust it yourself, which may not be that easy at first.  There was a thread around that had a few different code blocks on things like lasting injuries, death, shield bashing, and others.  I have a file where I have stuck the code for those in that I will be going to later, I will add it to the tutorial at the end later down the road.  Will make the file quite long...  :lol:
 
Ahh-ok, no worries then I thought I was going crazy. Guide is really well done overall as I'm quite deep in your tutorial and so far so good. The reason I was asking that particular question  is that there is a mod I've playing where the 'New Lord" NPC's rarely help you in combat on the world map and having noticed there is a 'Courage' and 'Aggressivness' in your guide I thought I might tweak them a bit. So I think I might just create my own Lords and see what happens.

Edit- Just realized that 'released Source' was what I was looking for- doh!
 
froggyluv said:
Ahh-ok, no worries then I thought I was going crazy. Guide is really well done overall as I'm quite deep in your tutorial and so far so good. The reason I was asking that particular question  is that there is a mod I've playing where the 'New Lord" NPC's rarely help you in combat on the world map and having noticed there is a 'Courage' and 'Aggressivness' in your guide I thought I might tweak them a bit. So I think I might just create my own Lords and see what happens.

Edit- Just realized that 'released Source' was what I was looking for- doh!

No worries.  I have been some changes with the tutorial update over the last few days, and (hopefully with my understanding of things growing) should have a revised release this weekend.  I will update the first post in this thread (and date the subject) when I do.  If you've gotten to the quest stuff, hold off for a bit.  That part is getting a bit of an overhaul...
 
jik said:
I have been working on this for a while, and I have posted a usable draft at the repository:

https://www.mbrepository.com/file.php?cid=5&id=1101


This is excellent. I have been browsing through your guide these last few days with great interest. I'm still a bit scared of starting my own new quests, but I feel like I can do it, thanks to you.

- The fact that you released your guide as a PDF doesn't really facilitates coding, because we can't actually 'copy/paste' your code.
But in a way, it makes the learning an even more fulfilling and rewarding experience! :wink:

Also, I want to add this: You are a good pedagogue, sir.  :smile:
 
I thought of something else yesterday and then forget and couldn't remember, which pissed me off, but it just popped back into my head :smile:

In the setting up section, perhaps a mention for Vista users to install MNB to C:\MNB or something rather than the default suggest C:\Program Files\MNB. Program Files has the whole administrator thingie on it which makes it a pain to work with and it's especially not good with the build_module.bat
 
Septa Scarabae said:
Glad you took the time to update the tutorials, jik. They've been in need of some love.

Thanks all, and they've been gettin' some love! :wink:

Lord Samuel, good news, I have almost fixed the quests.  I've posted a question where I have hit an odd snag, but for the most part it works.  Now I would suggest that you don't do that part in the currently released document, as I have moved to using slots to manage the quest.  The main reason I did this is that this is how it should be done, and is why slots are there (at least the theory, not just for quests).

I have gone through it again, and have updated quite a bit (some mis-matches of code, a few little tweaks), but the dialogs, triggers and quests are overhauled, and I don't want to pass the new version and have someone halfway through that part and just try to continue with the new doc.

Also, one reason it is a pdf is that they are more universal, and still hold the formating.  It currently is a word 2003 doc.  The other reason is that I would prefer that you don't just copy and paste (though I do say that in the document :oops:), but you enter the code yourself.  This will make you actually look at it.

One other change I will have to make is to give credit where credit is due.  I didn't design this tutorial, Winter did.  I am just cleaning it up and modernizing it to fit the new module system as it has changed.  OK, well the slots stuff is writen by me, but credit there will have to go to Jinnia.  That's who I got most of that info from (the concepts anywayz).

I am still set for my weekend release with or without the quest finished.  I feel that the info there (slots) should be posted, and if the quest is not completed, then I will make sure that the document states where everything has been tested to.

BTW: Thanks again for the positive feed back, keeps meing going, but I also need the CC to make sure that I am not leading anyone astray...


 
Thought of another tip to mention.

All of the operations you can call are listed in header_operations.py. I know that seems very obvious but I didn't realize this at first and spent a good amount of time trying to find some sort of list of all the different things you can call and use in the module system before finally figuring that out (only this morning). So maybe some reference to that would be a good idea, it makes figuring out what does what a hell of a lot easier.
 
Thanks.  I think I might make a small reference of that, but you are right, I should make a good point of head_operations.py as the source of most operations.  I too missed it for quite a while.
 
wow, this is turning into a really good turorial jik!

Just read through it, didn't actually try to implement it atm so I can't comment on any troubles that might arrise but I'll just post any comments I have regarding the text.

[list type=decimal]
[*]page 4 - "I have found that using NOTEPAD++ of great help." either add 'is' or remove 'that', latter being the better option
[*]page 4 - "A python lists starts with a '[" I would say "A python lists starts with a (square) backet, a '['" same again in the next sentence, just to help ppl get used to the lingo. A few sentences down the word 'parentheses' is used so this makes sence.
[*]page 5 - "Now let us give "new_icon" a bit of a different look. Let’s change it to “city”. This mesh is currently not used and it will stand out better in our mod." this sentence is in there twice in a slightly different shape, check the previous paragraph.
[*]page 7 - bit about commenting. For those very new to programming, maybe explain that placing a hash before a sentence means that the compiler/game/whatever-you-want-to-call-it regards it as if it's not there, so you can use that to write notes.
[*]page 7 - paragraph starting with "If everything.." - "Using a code
editor line" 'line' should be 'like'
[*]page 7 -next paragraph - "In-game, travelling to the town now will trigger a combat the town menu." nice try :smile: remove the 'a combat'
[*]page 9 - top - you list the knows_common list twice, maybe a bit redundants? Reformatting the paragraph seems like the better option.
[*]page 9 - section 3.2 - "The list of which troops can be upgraded into what is contained at the bottom of module_troops. Please scroll down to the bottom now." Not a really nice sentence imo. "The list for upgrading troops is contained at the bottom of module_troops. This defines which troops can be upgraded, including what they can upgrade into, when the experience conditions are met." or something similar
[*]page 9 - upgrade2(troops - "2 is currently" should be "Two is currently"
[*]page 9 - upgrade thingie. I noticed a slight inconistancy here. At the start of the page you say that in-game any novice_fighter can upgrade into a regular_fighter upon reaching level 11 and then later you add an extra entry to the file so this can actually happen. Since there currently isn't a troop upgrade in the game yet, the first bit is wrong. Rewrite to something like "We want to make it so that any novice_fighters in our party, etc etc." Makes more sense to me.
[*]page 10 - section 3.4 - I know you have commented on this being outdated but the bit about adding the troops to your party will still work as stated. However it says "notice how you are able to upgrade the new troops to "regular fighters"" But since you added the troop tree for 'novice_fighter' instead of 'new_troop', that won't work.
[*]page 10 - Marnid - "We used to be able to find him at entry point 4 in the Happy Boar inn" This is just my opinion but I think this is a bit redundant. A lot of new players who've never played old versions of MNB have no idea what the Happy Boar or Zendar even is.
[*]page 10 - Geoffrey - "If he were to be a joining character like Marnid, it would be best to add him to the list of NPCs right after npc16" I would change this to "If we were creating him to be a heroe that can join your party, like Marnid, it would be best [...]. However, we'll be using him as an 'actor' in the quest we are going to be creating so he's fine where he is." This is also consistant with the use of the word actor for Hareck later on in the page.
[*]page 11 - top- "In previous versions of M&B you could find Marnid in the tavern in Zendar" again, wtf is Zendar? :wink: I would just say that in older MNB versions, heroes all spawned in set location whereas now this is random due to the flag being set to 0. If you want to keep this, at least remove the other reference, or vice versa.
[*]page 11 - Hareck - "His tuple is such:" this wants to be "His tuple looks like this:" or "His tuple is as follows:"
[*]page 12 - chests - "which we will cover in the files' respective documentation." Just a reminder, don't know if you're actually planning to do this, otherwise delete or reformat.
[*]page 13 - Part 5 - "In Parts 3 and 4, we have learned" at the beginning of part 4 "learned" is used, so choose either or. I'd go with 'learned'
[*]page 14 - item tuple - "Example of an item:" This seems to be a placeholder, replace with "Tuple of item practice_sword:"
[*]page 15 - underneath error msg - "This is a lesson that the order that the files are compiled may not be in the order that you worked on them." should read "This shows us that the order in which the files are compiled may not be the order in which you work on them."
[*]page 15 - section 5.4 - "we have organised the list by item types" you use 'I' before, so use it here as well.
[*]page 19 - deserters tuple - "Innocents tuple examination:". You're examining deserters, not innocents. One might argue the difference in a social context but for here I think we can safely assume it's an oversight :smile:
[*]page 19/20 - section 6.3a. This is obviously a new section and you haven't had time to change all the section nrs to match. I think this could use a bit more explanation. As you're well aware it's not an easy concept to understand, but nonetheless important and can make life a lot easier.
[*]page 20 - section 6.4 - "to which the before mentioned slots can be used." I would say "for which" or "of which"
[*]page 21 - second paragraph - "get the quest, we need the “actors”" replace comma with 'and' or -even better- replace the period at the end of the sentence to a comma and make it 'and', leaving off the of lastly since there is no firstly or secondly.
[*]page 21 - next sentence - "The old tutorial had you first start with the dialog" not really relevant. I'd reformat this paragraph and after the last sentence say. "We've already created the actors in the previous sections, so we'll now move on to creating the scene where you receive the quest and face the 'target' of the quest, and after that we'll edit the module_dialogs.py where it the troops, the templates and the quest will all come together.
[*]page 21 - next sentence - the 'notice the use of a slash' is pretty random here. Move it up to before the paragraph above so it fits in with the discussion of the tuple. Also, I had to look up what a carrage return is and I've done some programming before, so maybe you should elaborate on that one in layman's terms.
[*]page 21 - part 7 - I would rewrite the intro here somewhat to give it a more logical flow. "In this part of the tutorial we will be setting up the scene for our quest, which will involve going into the game and using the in-game edit mode. Like I said earlier, we'll also use this mode to give a new face to Constable Hareck. However, before we can do all that we have to finish building Mod Town. So far we've created it and placed it on the map, but there are a few more steps to take before we have a fully functioning town with scenes which we can edit inside the game.
[*]page 21 - tutorial thingie - "Open module_parties.py and scroll down" scrolling is sooo 2008 :smile:, use search function maybe?
[*]page 21 - paragraph below the code - lose all the 'haves'. 'I have copied' is 'I copied', etc. Replace the lastly with 'Then'. For the 1, 2, and 3, remove the 'may' in 2 and 3. Better yet, say "may not build or load, or may crash [...]"
[*]page 22 - "You will also notice that some of the specific definitions for the towns." Either this needs more text or the 'that' needs to be removed.
[*]page 22 - "We used the tavern from Uxkhal since a lot of it is complete and we can just add minor
items to make the scene look somewhat complete." Don't really like the sentence. "We're using the tavern from Uxkhal (town_7) which is already mostly complete so we'll only have to add a few things to it." Or something.
[*]page 22 - configuration thingie - "It also might be agood idea to have the screen resolution..." Missing a space and also, replace with "It's a good idea to change the screen resolution to a setting lower than that which you use for your computer." Tell it like you mean it.. none of this 'it might perhaps possibly' stuff! :wink:
[*]page 22 - face generator - first, replace 'face maker' with 'face generator' and then "Incase you lose it" needs a space.
[*]page 22 - in the tavern - "And you will notice that everyone that should be in the tavern are all on the same spot." that sentence doesn't really work. Either "You will also notice that everyone who should be in the tavern is occupying the same spot." or "...that all the visitors in the tavern have been placed in the same spot." or something in between. Couple sentences on: "While edit more is on," needs to be 'mode', of course.
[*]page 22 - entry points "They should be numbered starting at 16 and ending at 24". You've just told us to place entry points 0 and 9 so this doesn't make much sense unless you elaborate on that.
[*]page 23 - passage way - "Well, not really, but other scenes you create may need to jump to other scenes.". I'd say "Although you don't really need it for the purposes of this tutorial, it will make your scene more real to have a working door and you might also want to use it in other quests."
[*]page 23 - adding lights - you've used 'we' thoughout this part and now you switch to I and say 'I'll place'. Either change to we or just leave it out altogether 'place a red light..' etc.
[*]page 23 - tavernkeeper - "Well, since we need to also place our“actors”, we’ll make a tavern keeper as well." make it "Since tavernkeepers are unique NPCs, like merchants or heroes, we'll have to create him in the same way we created our other 'actors'."
[*]page 24 - top - "This will lead us to the next phase: Giving them dialog" make "This is because we haven't created any dialog for them yet, which is what we'll be doing in the next part."
[*]page 24 - part 8 - "When the criteria for a tuple is met, then the it will be executed." remove 'the'
[*]page 24 - negation flag - "That way, if you want" replace with "That's why, if you want". Also next sentence 'define' needs a 'd'
[*]page 26 - paragraph that starts with 'First note...'  you say that it will say sir/wench based on gender but the code just has 'peasant' in it atm
[*]page 31 - section 1b  'store_faction_parameter' - 'store_' is not in bold
[*]page 31 - paragraph stat starts with 'Next we...' it says 'there uses' instead of 'their uses'
[*]page 32 - top of the page - "(including other else_try’s)" the apostrophe is wrong here, maybe reformat to (including other else_try blocks)
[*]page 32 - orange block of text - "both markers define" should be "defined" or preferably "are defined"
[*]page 32 - paragraph starting with 'Coming to...' - "With a complex and long list of “try”s" again I would replace with 'try blocks'
[*]page 32 - last paragraph -"I would interpret it as if this condition is true, or the next condition is true" for easier reading, maybe reformat to "I would interpret it as: "if this condition is true, or the next condition is true"" or place the last bit in bold
[*]page 33 - paragraph starting with 'The highlighted...' - "just add another try that test" missing an 's' on test
[*]page 34 - top - "midtown_begin to midtown_end." should be "modtown_" (yes I realize this is in the 'skip' bit, but you'll have to change it eventually anyway :smile:)
[*]page 34 - paragraph starting with 'If you..' - "Therefore, (eq,"$geoffrey_duel",1)". You're not using a global var anymore but a slot
[*]page 35 - "This operation also outputs the identifier of the spawned party to reg(0) as defined in header_operations.py." Maybe this can be stated a bit more clearly. I know what you mean, but I think maybe "Because of the way the operation is defined in header_operations.py, the identifier of the spawned party is automatically assigned to reg(0) when the party is spawned"
[*]page 35 - "Let’s add 2 more lines. When done it your Geoffrey duel tuple should look like this:" remove 'it'
[*]page 35 - "Now come 8pm when the party “new_template” spawns" - fairly sure you did a check for 7pm and there's no delay...

[/list]

Well it turned into quite a list.. I guess I should've done this differently in retrospect, haha. Anyway, don't be alarmed by that, it doesn't mean you didn't do a good job. I've nitpicked most little grammar errors and typos and added some of my own opinions on stuff.

The tutorial is really shaping up well. I learned a good number of things just now reading through it and will certainly refer to it regularly when I forget how stuff was supposed to be done again.

Really, good work mate! Hope this helps you out towards the new version. I'm sure I've missed some bits this time but hopefully I'll pick them up on the next one.

 
11 - Actually, though it's not highlighted, I do ask to create a copy of the noviceupgrade and change it to new_troop.  I Have gone in and made it stand out more.

12 - It does seem a bit out of place, but I do not understand what causes heroes and others to appear in the taverns of various towns.  This is more a marker for me to change it when I got the real story

16 - ya, not sure about the chests...  When winter created this, that section wasn't created.  I took it one step further than him in adding in the Editor info.  I know that I will want to do more with chests, but I'd have to see.  I will still leave this as is, as the document on the whole is not complete.  It will remind me to work on this too.

22 - agreed.  I have placed a note for myself there.  I what to have a clearer understanding and definition of slots before I give it.  Right now it shows them in use.  Later on (most likely further in the document) I will go into creating new slots and a stronger understanding.

54 - Actually, if you look at the code, I have actually changed it to noon, but I have fixed it all around, as I had it wrong elsewhere.
-----------------------
Thanks MartinF, I'm surprised someone has read through it so thoroughly!  All other corrections have been made as you suggested.  Grammar was my weakest subject...

As most of it should not impact the usage of the document, I will not re-release it until next week.  I'm hoping to incorporate a quick duel with just Geoffrey in a small arena, and have a battle between your men and his in the field.  The latter will be more difficult for me as I am still trying to wrap my head around the process of a hostile field encounter and where I need to check for Geoffrey being defeated.  I think the duel will be easier as someone has been posting code for dueling your companions and I am going to (with permission) grab it and add it on. 
 
You're welcome.. I had a few hours to kill anyway :wink:

Grammar was my weakest subject...

It's actually really not that bad at all. Being that the rest of the document was written by Winter, however, you're just at a bit of a disadvantage there.

About the slots: if you want, I can try and cook something up. I've implemented it succesfully for the duel mod thingie yesterday. It now stores duels won and lost for each character that you duel, using slots, and shows that and the total nr of fights in the menu before the duel starts, so that also hits on val_ modifiers. As for the programmer lingo side (with the arrays and stuff), I get how that works roughly but you'd probably have to add some text for that yourself.

As for duelling Geoffrey, I don't think you even need to add the duel option (unless you want to, it does hit on module_mission_templates with the different visitor sources, victory conditions and all that, that could be an extra section). There's already a template in there for the 'duel for lady' quest: "arena_challenge_fight". You could use that one if you don't want to go into explaining all the stuff in the mission_templates. You can even use that and still have the duel in the tavern if you want, just change the section where you edit the common room and make sure you add entry points 56 and 58 where you want the two ppl to spawn. You can override any flags that are in the "arena_challenge_fight" with "mission_tpl_entry_set_override_flags" and add any items with "mission_tpl_entry_add_override_item" (the default doesn't have any). But the more I think about this, the more I think it's a good idea to add a new template. It would tie in nicely with the rest of the tutorial and make the flow logical.. explain how the game takes bits and pieces from so many different files. And the template is very basic anyway, or can be.

Checking for Geoffrey being befeated, couldn't you use a slot_quest_current_state slot? Depending on how many options you want you can use as many quest states as you like and then just base your dialog options on that. For having defeated him, you can go straight to the script_succeed_quest and script_failure_quest for losing (see arena_challenge_fight for how this is implemented), or if you want it so you can talk to Geoffrey and try it again (after being thoroughly rediculed by him, obviously) you can just use a quest_current_state setting for that instead of failing it.

Although you switched to slots, it could still be helpful to use one global variable (say $g_geoffrey_duel_result) and explain about how it retains its value unless set elsewhere(if that's not already in there.. can't remember) and also evidence how it's inferior to using the slot_quest_current_state.

On a side note, I thought it might be helpful to have a little bit more explanation about the different types of containers, i.e. local variables, global variables, regs, strings and slots. I guess if you're a programmer all that makes sense but I spent like half an hour yesterday figuring out why my menu was returning "NO STRING!" even though I was sure the slot must be working. Then I realized that you can't assign a variable to a string and print it, you need to use a reg. Perhaps it would be worthwhile to think about making an appendix with some more indepth explanation (like say all the different itp_ things that currently take up quite some space) so you can keep the tutorial a bit more sleek. When you want to really go into something, just reference the appendix section where you explain it.

Also, thanks a lot for recommending Notepad++, it really is MILES better than IDLE.
 
I was heading towards an appendix or glossary.  It is true that for those who are unfamiliar with arrays, strings, global/local variables as section detailing them (out side of the tutorial) would be very helpful. 

My problem right now (that I will be working out this week) is in a standard battle in the field, when/where to check that geoffrey is defeated.  I know what I need to do (set the slot_quest_current_state to 3 = success), and I prime it to fail once you meet him in the field, incase they find a loop hole to end the mission.  Kind of a fail safe.  Looking at your duel code, it seems that making the mission template (I want to do that in the tutorial anyway) means you know the outcome and at the time that is determined I can set the state.

I want to leave all 3 options (quick complete, an actual duel and the field battle) to show the various ways to do these things, the duel being a new complete mission template.  This will also touch on menus.  I want to keep the volume of text down, but at 40 pages already, I don't see that happening.

If you have things that you think should be in a glossary/appendix, please post it, I will be sure to add it.  The more information the better.
 
Hi, I'm doing your quest but any idea why I keep getting error in this line:

["thyr","Thyr","Thyr",tf_hero,|tf_unkillable, no_scene,0,ac_order_of_night,[itm_great_axe,itm_black_armor,itm_winged_great_helmet,itm_nomad_boots,itm_charger],knight_attrib_1|level(30),wp(140),knows_common|knows_riding_6|knows_athletics_3|knows_ironflesh_2|knows_shield_2,man_face_younger_1, man_face_older_2],

The only difference is I placed it as one continuous line rather than paragraph-like.
 
You have to be more specific and give the error...

Not sure why you added the flag tf_unkillable, as all heroes are unkillable by nature.  Could be your designation for faction is wrong:

["thyr","Thyr","Thyr",tf_hero,|tf_unkillable, no_scene,0,ac_order_of_night,[itm_great_axe,itm_black_armor,itm_winged_great_helmet,itm_nomad_boots,itm_charger],knight_attrib_1|level(30),wp(140),knows_common|knows_riding_6|knows_athletics_3|knows_ironflesh_2|knows_shield_2,man_face_younger_1, man_face_older_2],


I think you want it to be fac_order_of_night.
 
Yeah sorry the missing "F" was my fault. I still get a syntax error and the 'flag tf_unkillable' is copied directly from your guide. At first I just copied and pasted the tuples straight from you guide but it was immediately underlined by my text editor as having an error. So I thought maybe the whole tuple should be sitting on the same line rather then 3 lines but still get the syntax error?
 
Back
Top Bottom