SP Tutorial Module System Making new quests

Users who are viewing this thread

I give this error please help me.
14sf5o3.png

2r40aqh.png
And here my module_troops entry
2ihl5sh.png
 
The comma after tf_hero for "Thyr" is problematic. I cannot see if there are other problems with that listing.


In the future, ask general debug questions like this within the Modders Q&A thread in the main part of the Forge.
 
Sorry to necro this but I thought this would help people with the capturing an enemy problem. I searched module_scripts for learn_where_merchant_brother_is and found the script which determines whether an npc is allways caught or is allowed the chance to flee. :


  # script_cf_check_hero_can_escape_from_player
  # Input: arg1 = troop_no
  # Output: none (can fail)
  ("cf_check_hero_can_escape_from_player",
    [
      (store_script_param_1, ":troop_no"),
      (assign, ":quest_target", 0),
      (try_begin),
        (check_quest_active, "qst_persuade_lords_to_make_peace"),
        (this_or_next|quest_slot_eq, "qst_persuade_lords_to_make_peace", slot_quest_target_troop, ":troop_no"),
        (quest_slot_eq, "qst_persuade_lords_to_make_peace", slot_quest_object_troop, ":troop_no"),
        (assign, ":quest_target", 1),
      (else_try),
        (ge, ":troop_no", "trp_sea_raider_leader"),
        (lt, ":troop_no", "trp_bandit_leaders_end"),
        (try_begin),
          (check_quest_active, "qst_learn_where_merchant_brother_is"),
          (assign, ":quest_target", 1), #always catched
        (else_try), 
          (assign, ":quest_target", -1), #always run.
        (try_end),
      (try_end),
     
      (assign, ":continue", 0),
      (try_begin),
        (eq, ":quest_target", 0), #if not quest target
        (store_random_in_range, ":rand", 0, 100),
        (lt, ":rand", hero_escape_after_defeat_chance),
        (assign, ":continue", 1),
      (else_try), 
        (eq, ":quest_target", -1), #if (always run) quest target
        (assign, ":continue", 1),
      (try_end), 
     
      (eq, ":continue", 1),
  ]),

This line:
        (ge, ":troop_no", "trp_sea_raider_leader"),
I think means that you can assign your guest target to never run by troop type, or of course you could check whether your quest is active (presumably though this would mean you will allways capture npc lords whilst the quest is active.)
I haven't checked if this works yet and I'll probably get it wrong since I'm only just relearning to mod and scripts look like scary heaven lingo to me but meh.
 
These two lines should be thought of in conjunction:
        (ge, ":troop_no", "trp_sea_raider_leader"),
        (lt, ":troop_no", "trp_bandit_leaders_end"),

and could have (should have) been written
        (is_between, ":troop_no", "trp_sea_raider_leader", "trp_bandit_leaders_end"),


as they check that the troop is in that range of troops, or in other words, a bandit leader. If it is, continue with that bit of the code, if not, skip out of the try block.
 
I want to make a quest like the "troublesome bandits" one, but fighting only with companions and all dismounted.

Can someone explain to me how to do that?
 
I wanted to resurrect this thread because I came across it while looking for tutorials to learn how to make quests and there does not appear to be but a handful of tutorials or information out there that I could find for making quests so here is my little contribution to the community. I took a swing at making this quest work from start to finish as intended and also applying a successful fix for the character Thyr not escaping and always there to give you the relic after defeating him in battle.

Thanks Kolba for posting this tutorial, especially the part pertaining to module_dialogs.py! It is has enabled me to continue making more quests, im currently building a submod using Silverstag which uses version 1.153 but this should also work for versions above that including 1.167.

Thanks pentagathus for pointing out that line of script, I was able to modify it and get the new quest along with the existing quest Merchants Brother to work 100%.

I customized the original post by Kolba slightly to my liking and plan to customize it even further for a big quest chain in my submod but I will now only post the working code in hopes that anyone else looking to learn how to make quests or use this script stumbles upon this thread with a working fix and smiles. Is my hope.

Here is what I have in my module files in order for everything to work. I will try and explain it to the best of my abilities, I've only been modding warband for two weeks now and still trying to learn coding, so this was rather daunting for me at first!
To the new people that come here learning to mod, you will need prior knowledge on the module system and its inner workings with these files in order to know how this all begins to work, there are plenty of tutorials out there with that information so please do not ask me those kind of details. Thanks.

###module_troops.py###
["thyr","Thyr","Thyr",tf_hero, no_scene,0, fac_dark_cultists,[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],

["guardian","Guardian","Guardian",tf_guarantee_armor|tf_guarantee_boots|tf_guarantee_horse|tf_guarantee_helmet,0,0, fac_dark_cultists,[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],

["guardian_end","Guardian","Guardian",tf_guarantee_armor|tf_guarantee_boots|tf_guarantee_horse|tf_guarantee_helmet,0,0, fac_dark_cultists,[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], ## this troop is just a placeholder and necessary for things to work, otherwise useless

###module_party_templates.py###
("dark_cultists_thyr","Dark Cultists Relic",icon_khergit_horseman_b|carries_goods(4)|pf_quest_party,0,fac_dark_cultists,bandit_personality,[(trp_thyr,1,1),(trp_guardian,1,1)]), ##you can add more troops by changing 1,1 or the name

###module_factions.py###
("dark_cultists","Dark Cultists", 0, 0.9,[("commoners",-0.:cool:,("merchants",-0.:cool:,("manhunters",-0.:cool:,("player_faction",-0.:cool:], [], 660033), ##you can make the faction name anything you want, as long as you change it in other files as well

###module_scripts.py###
Now for the fix

  # script_cf_check_hero_can_escape_from_player
  # Input: arg1 = troop_no
  # Output: none (can fail)
  ("cf_check_hero_can_escape_from_player",
    [
      (store_script_param_1, ":troop_no"),
      (assign, ":quest_target", 0),
      (try_begin),
        (check_quest_active, "qst_persuade_lords_to_make_peace"),
        (this_or_next|quest_slot_eq, "qst_persuade_lords_to_make_peace", slot_quest_target_troop, ":troop_no"),
        (quest_slot_eq, "qst_persuade_lords_to_make_peace", slot_quest_object_troop, ":troop_no"),
        (assign, ":quest_target", 1),
      (else_try),
    (ge, ":troop_no", "trp_dark_cultists"),
        (lt, ":troop_no", "trp_guardian_end"),
        (try_begin),
  (check_quest_active, "qst_relic"),
  (assign, ":quest_target", 1), #always catched
(else_try), 
          (assign, ":quest_target", -1), #always run.
(try_end),
  (else_try),
(ge, ":troop_no", "trp_sea_raider_leader"),
        (lt, ":troop_no", "trp_bandit_leaders_end"),
(try_begin),
          (check_quest_active, "qst_learn_where_merchant_brother_is"),
          (assign, ":quest_target", 1), #always catched
        (else_try), 
          (assign, ":quest_target", -1), #always run.
        (try_end),
      (try_end),

###module_dialogs.py###
The block of text that Kolba supplied, if you look carefully I divided up into two different sections in this file in order for things to work. Also I activated the town Zendar that resides within module_parties.py and contains the NPC Constable Hareck. Some actual character spoken dialog still needs changing but is not important for everything to work.

###################################################

Fix # 2 ## added above the lines:
[anyone|auto_proceed,"start", [
  (is_between,"$g_talk_troop","trp_town_1_master_craftsman", "trp_zendar_chest"),

###################################################

[trp_constable_hareck, "start", [[eq,"$relic",2]], "Greetings {playername}.","bye2",[]],
  [trp_constable_hareck|plyr, "bye2", [], "Greetings to you too, Antler.","close_window",[]],
  [trp_constable_hareck, "start", [[eq,"$relic",1]], "Did you find the relic?","relic_find_question",[]],
  [trp_constable_hareck|plyr, "relic_find_question", [(player_has_item,"itm_relic")], "Yes! It was quite difficult.", "relic_znaleziona",[(call_script,"script_end_quest","qst_relic")]],
  [trp_constable_hareck|plyr, "relic_find_question", [], "No, not yet.", "close_window",[]],
  [trp_constable_hareck, "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,"$relic",2]]],
  [trp_constable_hareck, "start", [[eq,"$relic",0]], "Hello, {young man/lassie}! Are you looking for a job or something?", "god1",[]],
  [trp_constable_hareck|plyr, "god1", [], "Yes!", "god2",[]],
  [trp_constable_hareck, "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_constable_hareck|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_constable_hareck"), (set_spawn_radius,1),(spawn_around_party,"p_village_48","pt_dark_cultists_thyr")]],
  [trp_constable_hareck|plyr, "god3", [], "No, I don't have time for that!", "close_window",[]],
  [trp_constable_hareck, "godyes", [], "Excellent!", "close_window",[[assign,"$relic",1]]],

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

###################################################

Fix # 3  ## add this below the entry: [anyone|plyr, "bandit_leader_1a",

###################################################
[anyone, "start",
  [
    (is_between, "$g_talk_troop", "trp_dark_cultists", "trp_guardian_end"),
    (eq,"$talk_context",tc_hero_defeated),
  ], 
  "I yield! Please, don't kill me! I'll give you relic!","relikwia",
  []],

[anyone|plyr, "relikwia",
  [
    (is_between, "$g_talk_troop", "trp_dark_cultists", "trp_guardian_end"),
  ], 
  "So, be it. Give me relic and I'll let you go.", "relikwia2",
  []],

[anyone|plyr, "relikwia2",
  [
    (is_between, "$g_talk_troop", "trp_dark_cultists", "trp_guardian_end"),
  ], 
  "Here you are. But, please! Don't kill me!", "relikwia3",
  [(troop_add_item, "trp_player","itm_relic")]],
 
[anyone|plyr, "relikwia3",
  [
    (is_between, "$g_talk_troop", "trp_dark_cultists", "trp_guardian_end"),
  ], 
  "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)]],

##################################################

###module_quests.py###
##posted at the end as Kolba stated

("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!"
  ),
 
Back
Top Bottom