SP Tutorial Module System Making new quests

Users who are viewing this thread

Kolba

This is my second tutorial after "Creating new SP/parties" - http://forums.taleworlds.com/index.php/topic,53192.0.html.

We will start from really simple quest called "Relic". Let's start!

1. First open module_troops.py and add anywhere this line:


["antler","Antler","Antler",tf_hero, scn_town_4_tavern|entry(3),reserved, fac_commoners,[itm_nomad_armor,itm_nomad_boots],def_attrib|level(2),wp(20),knows_common,0x00000000000430c701ea98836781647f],


Let's analyse:

"antler" - is an ID name of troop. It won't be showed in game, since it's used only as a reference in other files.

Antler - is a name of troop. It will be showed in game.

Antler - plural name of troop. Not used for heroes, useful for single troops.

tf_hero - without that part of code, troop isn't hero. So yes, this is only for heroes.

scn_town_4_tavern - the scene where the hero will appear. If you want to change it, check module_parties.py for town list and then module_scenes.py for scene list.

entry(3) - entry point of troop in scene. You need to manually add it in edit-mode.

reserved - nothing interesting.

fac_commoners - the faction of troop. If you want to change it, check module_factions.py.

[itm_nomad_armor,itm_nomad_boots] - inventory of troop. You can add your own, just remember that you need to check module_items.py and add phrase "itm" before each item.

def_attrib - troop attributes.

level(2) - simply, level of troop.

wp(20) - number of weapon proficiences.

knows_common - skills of troop. You can add for example "knows_riding_2|knows_power_strike_4" etc.

0x00000000000430c701ea98836781647f - face code of troop. You can generate face code in in-game edit mode.


2. Let's add another troop:

  ["thyr","Thyr","Thyr",tf_hero,|tf_unkillable, no_scene,0, fac_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],

Note that this hero have new faction "order_of_night". And other troop:

  ["guardian","Guardian","Guardian",tf_guarantee_armor|tf_guarantee_boots|tf_guarantee_horse|tf_guarantee_helmet,0,0,fac_order_of_night,
  [itm_great_axe,itm_black_armor,itm_mail_coif,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],

There is something to explain. For example "tf_guarantee_armor" - troop will always wear armor, "tf_guarantee_horse" - soldier will always be mounted etc.

3. Now let's go to module_factions.py and paste this line:

("order_of_night","Order of Night", 0, 0.5,[("player_faction",-1.0)], []),

And as always - analyse!

order_of_night - ID of faction.

Order of Night - name of faction showing in-game.

0.5 - relations between members of this faction.

"player_faction",-1.0 - relations between another factions. In our example, the Order of Night will hate player.


4. Let's move to the biggest part of tutorial - module_dialogs.py. Under ramun_the_slave_trader dialogs paste those huge lines:

 
[trp_antler, "start", [[eq,"$holy_relic",2]], "Greetings {playername}.","bye2",[]],
  [trp_antler|plyr, "bye2", [], "Greetings to you too, Antler.","close_window",[]],
  [trp_antler, "start", [[eq,"$holy_relic",1]], "Did you find the relic?","relic_find_question",[]],
  [trp_antler|plyr, "relic_find_question", [(player_has_item,"itm_relic")], "Yes! It was quite difficult.", "relic_znaleziona",[(call_script,"script_end_quest","qst_relic")]],
  [trp_antler|plyr, "relic_find_question", [], "No, not yet.", "close_window",[]],
  [trp_antler, "relic_znaleziona", [], "Really? Well, congratulations {young man/lassie}! I decided to don't give you reward. This book is a reward. You can sell it in shops.","close_window",[[assign,"$holy_relic",2]]],
  [trp_antler, "start", [[eq,"$holy_relic",0]], "Hello, {young man/lassie}! Are you looking for a job or something?", "god1",[]],
  [trp_antler|plyr, "god1", [], "Yes!", "god2",[]],
  [trp_antler, "god2", [], "Good. Do you heard anything about Order of Night? They're band of wandering bastards or fallen knights, led by Thyr. They recently raided Veluca monastery and stolen holy relic. Now, they should be resting near village of Veidar. Find them, kill everyone except Thyr. Then, persuade him to give you information about location of relic. I hope it's quite clearly. I'll pay you 2000 denars.", "god3",[]],
  [trp_antler|plyr, "god3", [], "Allright, that's nice offer. I'll regain relic!", "godyes",[
      (setup_quest_text, "qst_relic"),
      (str_store_string, s2, "@A guy called Antler told me interesting story. Fallen Knights called Order of Night, recently raided Veluca monastery and stolen holy relic. I must find them and after battle, persuade their leader Thyr to give me holy relic. Those bastards, now should be near Veidar!"),
      (call_script,"script_start_quest","qst_relic","trp_antler"), (set_spawn_radius,1),(spawn_around_party,"p_village_48","pt_order_of_night")]],
  [trp_antler|plyr, "god3", [], "No, I don't have time for that!", "close_window",[]],
  [trp_antler, "godyes", [], "Excellent!", "close_window",[[assign,"$holy_relic",1]]],

  [party_tpl|pt_order_of_night,"start", [(eq,"$talk_context",tc_party_encounter)], "Hey, you there! What are you looking for?", "order2",[]],
  [party_tpl|pt_order_of_night|plyr,"order2", [], "For a holy relic! Give me it, or I'll cut your throats!", "order3",[]],
  [party_tpl|pt_order_of_night,"order3", [], "Hahaha! First give me four billion denars!", "order4",[]],
  [party_tpl|pt_order_of_night|plyr,"order4", [], "Nice joke. Prepare to fight, cowards!", "close_window",[[encounter_attack]]],
  [party_tpl|pt_order_of_night,"order2", [], "Nevermind...", "close_window",[(assign, "$g_leave_encounter",1)]],

  [party_tpl|pt_order_of_night,"start", [(eq,"$talk_context",tc_hero_defeated)], "I yield! Please, don't kill me! I'll give you relic!","relikwia",[]],
  [party_tpl|pt_order_of_night|plyr,"relikwia", [], "So, be it. Give me relic and I'll let you go.", "relikwia2",[]],
  [party_tpl|pt_order_of_night,"relikwia2", [], "Here you are. But, please! Don't kill me!", "relikwia3",[(troop_add_item, "trp_player","itm_relic",)]],
  [party_tpl|pt_order_of_night|plyr,"relikwia3", [], "That's not my bussines! Go on, you see the hills, over there? Run, run, or I'll change my mind!", "close_window",[(assign, "$g_leave_encounter",1)]],

I am sorry, that I didn't explained anything here, but in the afternoon (now I am very busy) I'll add explanations. And excuse me, my language is not perfect, since I am 13 years old.

5. Now let's add the new item "relic". Open module_items.py and add following line:

["relic","St. Grunwalder", [("book_e",0)], itp_type_book, 0, 10000,weight(2)|abundance(100),imodbits_none],

You can add any item replacing "relic", but the best one is a book:

relic - ID name of item. Used as a reference in other .py files.

St. Grunwalder - name of item showing in game.

book_e - item mesh. Check the Native resources.

itp_type_book - type of item. In our example it's a book.

10000 - price of item in shops (in denars).

weight(2) - defines the weight of the item in kilogrammes.

abundance(100) - this stat governs how often the item will appear in merchant inventories and combat loot. 100 is standard; can be more or less than 100 (down to 0).

imodbits_none - item imodbits (for example cracked, bent etc.), not used for books.





6. And end of our tutorial. Paste those lines into the bottom of module_quests.py:

("relic", "Find holy relic", qf_random_quest,
  "A guy called Antler told me interesting story. Fallen Knights called Order of Night, recently raided Veluca monastery and stolen holy relic. I must find them and after battle, persuade their leader Thyr to give me holy relic. Those bastards, now should be near Veidar!"
  ),


Build module, run game and walkthrought for you:

1. Go to Suno tavern.
2. Get a quest from Antler.
3. Raise a quite big army.
4. Patrol the terrains around Veidar.
5. Fight with Order of Night.
6. Persuade Thyr to get a relic.
7. Go back to Antler.

And that's everything! Yes, my language is poor, but I'll try to improve it and add polished version of tutorial.

Thanks for reading,
Kolba
 
Nice tutorial. Basically, this also shows that you only need to edit the dialogue file for the majority of the work. Thanks mate.
 
Thanks for the tutorial. Adding it was much simpler than I thought. Now I can finally have the smithee NPC who makes items for you. Can anyone spot the error in this dialog section? It keeps throwing an invalid syntax error when I try to compile
Code:
[trp_antler, "start", [[eq,"$iron_sword",2]], "Greetings {playername}.","bye2",[]],
  [trp_antler|plyr, "bye2", [], "Greetings to you too, smithee.","close_window",[]],
  [trp_antler, "start", [[eq,"$iron_sword",1]], "Do you have an iron bar?","iron_find_question",[]],
  [trp_antler|plyr, "iron_find_question", [(player_has_item,"itm_iron")], "Yes.", "has_iron",[(call_script,"script_end_quest","qst_iron_sword")]],
  [trp_antler|plyr, "iron_find_question", [], "No, not yet.", "close_window",[]],
  [trp_antler, "has_iron", [], "Really? Well, now give it to me and I will forge you a great sword {young man/lassie}! ","close_window",[[(troop_add_item, "trp_player","itm_great_sword",imod_tempered)]][assign,"$iron_relic",2]]],
  [trp_antler, "start", [[eq,"$iron_sword",0]], "Hello warrior! You seem like somone who uses their sword alot.", "god1",[]],
  [trp_antler|plyr, "god1", [], "I do.", "god2",[]],
  [trp_antler, "god2", [], "I can forge you a sword if you bring me an iron bar.", "god3",[]],
  [trp_antler|plyr, "god3", [], "Alright, that's a nice offer. I'll bring you an iron bar. ", "godyes",[
      (setup_quest_text, "qst_sword"),
      (str_store_string, s2, "@Antler said he could forge me a great sword made out of iron if I brought him 1 iron bar."),
      (call_script,"script_start_quest","qst_sword","trp_antler")]],
  [trp_antler|plyr, "god3", [], "No, I rarely use my sword. ", "close_window",[]],
  [trp_antler, "godyes", [], "Excellent!", "close_window",[[assign,"$iron_sword",1]]],
 
red.murder1, it looks like you have one too many "]" at the end of:

Code:
[trp_antler, "has_iron", [], "Really? Well, now give it to me and I will forge you a great sword {young man/lassie}! ","close_window",[[(troop_add_item, "trp_player","itm_great_sword",imod_tempered)]][assign,"$iron_relic",2]]],
 
It still throws me the same error on the  hello warrior! line
Edit: Got rid of that error,now it gives me an error that just says:
Error in dialog line:
  [666, "has_iron", [], "Really? Well, now give it to me and I will forge you a great sword {young man/lassie}! ","close_window",[[[<1530, "trp_player","itm_great_sword",14>]],[[2133,"$iron_sword",2]]]],
MY code for the dialog is this atm
Code:
[trp_antler, "start", [[eq,"$iron_sword",2]], "Greetings {playername}.","bye2",[]],
  [trp_antler|plyr, "bye2", [], "Greetings to you too, smithee.","close_window",[]],
  [trp_antler, "start", [[eq,"$iron_sword",1]], "Do you have an iron bar?","iron_find_question",[]],
  [trp_antler|plyr, "iron_find_question", [(player_has_item,"itm_iron")], "Yes.", "has_iron",[(call_script,"script_end_quest","qst_sword")]],
  [trp_antler|plyr, "iron_find_question", [], "No, not yet.", "close_window",[]],
  [trp_antler, "has_iron", [], "Really? Well, now give it to me and I will forge you a great sword {young man/lassie}! ","close_window",[[[(troop_add_item, "trp_player","itm_great_sword",imod_tempered)]],[[assign,"$iron_sword",2]]]],
  [trp_antler, "start", [[eq,"$iron_sword",0]], "Hello warrior! You seem like somone who uses their sword alot.", "god1",[]],
  [trp_antler|plyr, "god1", [], "I do.", "god2",[]],
  [trp_antler, "god2", [], "I can forge you a sword if you bring me an iron bar.", "god3",[]],
  [trp_antler|plyr, "god3", [], "Alright, that's a nice offer. I'll bring you an iron bar. ", "godyes",[
      (setup_quest_text, "qst_sword"),
      (str_store_string, s2, "@Antler said he could forge me a great sword made out of iron if I brought him 1 iron bar."),
      (call_script,"script_start_quest","qst_sword","trp_antler"),]],
  [trp_antler|plyr, "god1", [], "No, I rarely use my sword. ", "close_window",[]],
  [trp_antler|plyr, "god3", [], "I don't need another sword. ", "close_window",[]],
  [trp_antler, "godyes", [], "Excellent!", "close_window",[[assign,"$iron_sword",1]]],
 
Try this one:

Code:
[trp_antler, "has_iron", [], "Really? Well, now give it to me and I will forge you a great sword {young man/lassie}! ","close_window",[(troop_add_item, "trp_player","itm_great_sword",imod_tempered),(assign,"$iron_sword",2)]],
 
These are great  :grin:

Make more, and when you get a good bunch of them, make a post with links for all of them and you'll get a sticky (atleast I'll vote for it)  :mrgreen:
 
Luisrah said:
These are great  :grin:

Make more, and when you get a good bunch of them, make a post with links for all of them and you'll get a sticky (atleast I'll vote for it)  :mrgreen:
Ho hum.

Methinks you don't want to undermine my power.

'twould not be a wise decision to bring in competition for me.
 
Tatari_okan said:
This tutorial is very helpful, and it is what I were needing when modding. It will be very usefull for me after back to modding.

Thank you guys. I hope that more people will find this tutorial useful.
 
Yeh, I was pretty impressed by his age. I'm not much older than him, but he's made some great mods.
 
I am making another tutorial called:

"Healing and Teleporting"

In this part I will explain how to add a new NPC, who will heal your wounds and teleport to choosen place.
 
Hmmm.. I keep getting this error when I complie...any ideas?

Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 6, in <module>
    from module_dialogs import *
ModuleSystem1.0\module_dialogs.py", line 269, in
<module>
    [party_tpl|pt_order_of_night,"start", [(eq,"$talk_context",tc_party_encounte
r)], "Hey, you there! What are you looking for?", "order2",[]],
NameError: name 'pt_order_of_night' is not defined

Anyone else getting something similar?


 
Back
Top Bottom