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

Users who are viewing this thread

When will be part 11 updated? Because it shows how to make a mission template, but not how to call it. With some fiddling I managed to call it somehow, but I'm not sure if I did correctly, but the spawn parameters must start with 0 (even though nothing is spawned there), otherwise nothing will appear in the scene. So just entering two spawn parameters like in tutorial, 56 and 58, won't work.
 
John Xenir said:
When will be part 11 updated? Because it shows how to make a mission template, but not how to call it. With some fiddling I managed to call it somehow, but I'm not sure if I did correctly, but the spawn parameters must start with 0 (even though nothing is spawned there), otherwise nothing will appear in the scene. So just entering two spawn parameters like in tutorial, 56 and 58, won't work.
Considering jik hasn't been active since summer 2009, I think we can safely say that part 11 won't be updated.

That said, as you don't 'call' a mission template from within the mission template, part 11 isn't really where you are looking. It appears like jik was going to add something calling this duel mission to the party-encounter script, or perhaps to the dialogs with Geoffry.

In any case, 3 operations are needed to transition from the world map (or a world map called presentation or menu or dialog) to a scene, governed by a specific mission template:
(set_jump_mission, "mt_<your mission template>"),
(jump_to_scene, "scn_<your scene>"),
(change_screen_mission),

If you don't want to player to spawn at entry point 0, then you also need
(set_jump_entry, <your entry point>),
above (jump_to_scene)

If you need to spawn specific non-player troops that aren't setup in the scene itself, then you also need
(modify_visitors_at_site, "scn_<your scene>"),
(reset_visitors), #typically
(set_visitor, <entry point>, "trp_<the troop to add>"),
above (jump_to_scene)
 
Im having this problem with the tutorial while learning to mod for warband. In part 7.1 the section where the quick character is introduced the tutorial says to find a tuple with start_game_1 but there isnt one. There is start_game_0 but there is no reference of a male and female character choosing so i dont know where to place the new menu. Plz any help would be appreciated :cry:
 
John Xenir said:
When will be part 11 updated? Because it shows how to make a mission template, but not how to call it. With some fiddling I managed to call it somehow, but I'm not sure if I did correctly, but the spawn parameters must start with 0 (even though nothing is spawned there), otherwise nothing will appear in the scene. So just entering two spawn parameters like in tutorial, 56 and 58, won't work.

I finally figured out how to at least accomplish what the tutorial was attempting to teach. I figure I'd lend a hand just in case you were still stuck.
I adapted it for my purposes. I still have to study up on "else_try"s to fully integrate my changes into the original code. As of now, i have basically "hotwired" it into the game for testing purposes. See how you must edit each file below:

Edits to module_dialogs
I am making a duel with a companion. Instead of the usual payment, you have to duel him (Fastrada/trp_npc23) to get him to join. The key thing here is the "(call_script, "script_set_up_duel_with_troop", "trp_npc23")".
Code:
[trp_npc23|plyr,"fastrada_talk_9", [], "I am ready to face you now.", "close_window",
[
	(call_script, "script_change_player_relation_with_troop", "trp_npc23", -2),#change back to $g_talk_troop eventually
	(call_script, "script_set_up_duel_with_troop", "trp_npc23"), #change back to $g_talk_troop eventually
	(quest_set_slot,"qst_duel_fastrada",slot_quest_current_state, 4),# 4 is a state of loss
]
],
[trp_npc23|plyr,"fastrada_talk_9", [], "I will return when ready.", "close_window",[]],

That dialog sets the quest in a state of failure with this: (quest_set_slot,"qst_duel_fastrada",slot_quest_current_state, 4).

This set of dialogs should be thought of a buckets that are waiting to be filled (and ran) based on a win (3) or a loss (4) state:
Code:
[trp_npc23, "start", [                    
					(check_quest_active, "qst_duel_fastrada"),
					(quest_slot_eq, "qst_duel_fastrada", slot_quest_current_state,3), #this bucket or path will be chosen if the mission in mission_templates changes the "current_state" to "3"									
    ],
   "You fight well. I shall be honoured to join you. Lead the way, {sir/ma'am}!", "close_window", 
   [
   (succeed_quest,"qst_duel_fastrada") 
   ]],

  [trp_npc23,"start",
   [
      (check_quest_active, "qst_duel_fastrada"),
(quest_slot_eq, "qst_duel_fastrada", slot_quest_current_state,4), #4 is a loss; default - stays this way unless you win/mission_templates does not tell the "current_state" to change					
  ],
   "Well, {sir/my lady}! Please, do not trouble yourself to rise from the ground, as I would simply have to knock you down again. Maybe there is another way you can convince me of your worthiness. . . .", "close_window", #i didn't bother connecting this to another tuple bc i'm only testing this part; i will eventually as it continues to loop inescapably otherwise
   [
   (fail_quest,"qst_duel_fastrada")
   ]],

Edits to module_scripts
The next thing I did was edit module_scripts. CTRL+F for "script_set_up_duel_with_troop" (from the (call_script,"script_set_up_duel_with_troop", "trp_npc23") in your dialogs).
I copy/pasted the entire script, commented out the original, and edited the copy thus so:
Code:
("set_up_duel_with_troop", 
                          [                                        
                       
			(jump_to_menu, "mnu_arena_duel_fight_fastrada"),#custom menu
                         (finish_mission),																		
                        ]),
Notice that I am tracing the entire operation through the code. "(jump_to_menu, "mnu_arena_duel_fight_fastrada")" refers to module_game_menus. I changed the normal menu reference ("mnu_arena_duel_fight") and rerouted the script to a custom one ("mnu_arena_duel_fight_fastrada").

Edits to module_game_menus
In module_game_menus, CTRL+F "arena_duel_fight". This is the menu you get when you duel lords.
I copied this menu and pasted it above the original, and edited it thus so:
Code:
("arena_duel_fight_fastrada",0,
   "You and Fastrada prepare to duel."#i will eventually replace "Fastrada" with a reg string for others you may duel with
   "none",
   [],
   [
     ("continue",[],"Continue...",
      [	
		(modify_visitors_at_site, "scn_training_ground_ranged_melee_4"),# it doesn't matter which scene you use
        (reset_visitors),
        (set_visitor, 0, "trp_player"),
        (set_visitor, 1, "trp_npc23"),#it is important to keep these as 0 and 1 respectively; they refer to the only two teams (0 and 1) in the default mission #"mt_duel_with_lord"
        (set_jump_mission, "mt_duel_with_fastrada"),#this is my custom mission in mission_templates
        (jump_to_scene, "scn_training_ground_ranged_melee_4"),# make sure this matches the scene above
        (jump_to_menu, "mnu_arena_duel_conclusion_fastrada"),#my custom conclusion menu
        (change_screen_mission), 
    ]),
    ]
  ),

Scroll down to the menu "arena_duel_conclusion", copy/paste, and edit the copy like so:

Code:
("arena_duel_conclusion_fastrada",0, #custom menu name
   "The dust settles...",#important to change this so that you will immediately know, when 
#testing in-game, if you got routed to the right menu
   "none",
   [      
  ],#no need for checks bc only one path it can go to
   [
     ("continue",[],"Continue...",
      [	   
	   (call_script, "script_get_meeting_scene"), (assign, ":meeting_scene", reg0),#don't fiddle with this script - it works
		(modify_visitors_at_site,":meeting_scene"),
	   
	   (reset_visitors),
	   (set_visitor,0,"trp_player"),
        (set_visitor,17,"trp_npc23"),#leave these values (0 and 17) the same, they refer to "mt_conversation_encounter"; I put in #Fastrada's ID here, replacing "$g_duel_troop" - i don't know if that was necessary
        (set_jump_mission,"mt_conversation_encounter"),
        (jump_to_scene,":meeting_scene"),
        (assign, "$talk_context", tc_after_duel),#for mere testing, i don't think this is necessary . . .
        (change_screen_map_conversation, "trp_npc23"),#Fastrada's ID
        ]),
      ]
  ),

Done with module_game_menus edits. Finally, go to module_mission_templates.

Edits to module_mission_templates
CTRL+F for "duel_with_lord". As usual, copy the ENTIRE mission. However, per JIK's tutorial advice, paste your copy at the bottom of the file right before the last "]". Then, edit your copy like so:
Code:
(
    "duel_with_fastrada",mtf_arena_fight|mtf_commit_casualties,-1,
    "You enter a melee fight in the arena.",#for some reason, this text doesn't show up . . . however, the mission works
    [    
	  (0, mtef_visitor_source|mtef_team_0,af_override_all,aif_start_alarmed,1,[itm_we_pla_sword_templar,itm_arena_tunic_blue]),
	  (16, mtef_visitor_source|mtef_team_1,af_override_all,aif_start_alarmed,1,[itm_we_pla_sword_templar,itm_arena_tunic_blue]),
    ],#don't fiddle with the 0 and 16 unless you know exactly what you are doing. Contrary to JIK's tutorial, DO NOT change these to 56 and 58 - your dueling partner will not show up or the player will show up twice.
    [
      common_inventory_not_available,
      (ti_tab_pressed, 0, 0, [(display_message, "str_cannot_leave_now")], []),#you can change this per JIK's tutorial if you want
      (ti_before_mission_start, 0, 0, [], [(call_script, "script_change_banners_and_chest")]),#not too important but keep anyway

      (0, 0, ti_once, [],
       [
         (call_script, "script_music_set_situation_with_culture", mtf_sit_arena),#not too important but keep
         ]),


      (1, 4, ti_once, [
	  (main_hero_fallen)#the only condition you need to satisfy for the "quest_current_state" to be set to 4, a failure
	],
       [          
			(quest_set_slot,"qst_duel_fastrada",slot_quest_current_state, 4), #this changes the quest's state to 4; you really #don't need to do this if, like me and JIK's tutorial, your default state is failure per the consequence block in you dialogs #((quest_set_slot,"qst_duel_fastrada",slot_quest_current_state, 4)). On the other hand, if your default state is neutral (say, 2), you need this trigger in order to lose
			(call_script, "script_fail_quest", "qst_duel_fastrada"),
           (finish_mission),
           ]),
   
		(1, 4, ti_once, [
	  (neg|main_hero_fallen), #the two conditions that you need to change the "quest_current_state" to 3, a win
	  (all_enemies_defeated,1),#you need this condition, otherwise the battle will end prematurely; you'll win without ever touching #the other troop; without this, the game is told to make you win just by surviving for a few seconds
	],
       [          
			(quest_set_slot,"qst_duel_fastrada",slot_quest_current_state, 3),#the victory state
			(call_script, "script_succeed_quest", "qst_duel_fastrada"),#you can insert this script either here or at the end of your #conversation consequence block in module_dialogs by inserting (succeed_quest,"qst_duel_fastrada"). Same with #(fail_quest,"qst_duel_fastrada").          
			(finish_mission),
           ]),
   ]
  ),  	 
You are now done. Save all and compile then test.

Like I said, my ultimate goal is to figure out how to integrate all of this into the game via "try" blocks. I welcome any help! For now, i am developing a new class of troop to which i will expand this capability via "try_for_range" and setting up new "...._begin, "...._end" constants.

Later. Let me know what you think.
 
The tutorial has been great so far and I must congratulate of great succession, but one thing I'm actually confused about is that the "new_icon" isn't defined from some odd reason, and I did followed the instructions perfectly, yes, but it might also be the fact that I'm using the tutorial for warband and the might have made the system little bit more complicated than it was in Vanilla.

Ps: I finally decided to use the ordinary "icon_town" to advance in the tutorial,

Edit: nevermind, ingnore me.
 
Back
Top Bottom