Nope, the number of terrain types is hardcoded.Rybopiotr said:It is possible to add new terrain type(for scenes, not world map)?
Nope, the number of terrain types is hardcoded.Rybopiotr said:It is possible to add new terrain type(for scenes, not world map)?
jacobhinds said:I want to iterate menu options using a try_for_range. For example, I want a menu option for every lord in a given faction, similar to the repeat_for_troops or repeat_for_factions for module_dialogs. Annoyingly this can't be done with module_game_menus.py as far as I know.
#### export/import NPCs begin ####
("export_import_npcs", mnf_enable_hot_keys,
"Please choose a character, then press the C key to view and export or import the chosen character history.^^You choose {reg0?{s0}:none}.",
"none",
[
(assign, reg0, "$g_player_troop"),
(str_store_troop_name, s0, "$g_player_troop"),
],
[
("export_import_back",[],"Go back",
[
(assign, "$g_player_troop", "trp_player"),
(set_player_troop, "$g_player_troop"),
(jump_to_menu, "mnu_camp_action"),
]
),
]+[("export_import_npc"+str(x+1),
[
(store_add, ":dest_npc", "trp_npc1", x),
(str_store_troop_name, s0, ":dest_npc"),
], "{s0}",
[
(store_add, ":dest_npc", "trp_npc1", x),
(assign, "$g_player_troop", ":dest_npc"),
(set_player_troop, "$g_player_troop"),
]) for x in range(0, 12)]+[ #Floris - for new companions; was 0, 8
("export_import_next",[],"Next page", [(jump_to_menu, "mnu_export_import_npcs_2")]),
]
),
menu_create_new = 4800 #(menu_create_new, <destination>, <text>, [<mesh_name>], [<flags>], [<script_no>], [<script_param>]), #Creates a dynamic menu and stores its id into <destination>. [<script_no>] (-1 for no script) will be called with params 1 = menu_no, 2 = [<script_param>] when the operations block is executed
menu_add_item = 4801 #(menu_add_item, <menu_no>, <text>, [<conditions_script_no>], [<consequences_script_no>], [<script_param>]), #Adds a new menu item to <menu_no>. [<conditions_script_no>] and [<consequences_script_no>] (-1 for no script) will be called with params 1 = <menu_no>, 2 = [<script_param>] when the conditions/consequences blocks are executed
menu_clear_items = 4802 #(menu_clear_items, <menu_no>), #Removes all menu items from <menu_no>
menu_clear_generated = 4803 #(menu_clear_generated), #Removes all dynamic menus
I do a lot of dynamic/list like presentation overlays in the PBOD code, and Windyplains also has plenty of these types of displays, too, so perhaps something there could give you some ideas? (Temp dropbox link to the PBOD presentation file)jacobhinds said:Could anyone tell me how I'd do the same thing with module_presentations, or if there are any examples I could use? I couldn't find any even after searching the entire file for try_for_range's.
Actually I always try something without understanding . That is the way I can understand, firstly trying.MadVader said:You shouldn't just move try_ends without understanding. What happens when the castle is already entered and the block exits? What would be the jump point?
Here's how passage numbers as seen in the scene editor work, for reference.
MadVader said:The order of menu options corresponds to passage numbers, so adding a new town menu option (or deleting an old one) will screw your passages. If you want to add new menus, place them after the menu options used for passages. If you want to disable an option, put (eq, 1, 0) in its condition block, but don't remove it.
(try_begin),
(eq, "$town_entered", 0),
(assign, "$town_entered", 1),
(set_jump_entry, 1),
(try_end),
HyperCharge said:Is it possible to change the date after somethings happen ? should I just call the "game_get_date_text" when i want to change it ? Or if i change the ":cur_year" to global variable, then change the year whenever i want ?
I ve solved it by taking out (set_jump_entry, 1), from castle_inspect menu, now i can spawn at entry 2 when i get into courtyard by using the passage in the castle court. But when i use the passage in dungeon to go to the courtyard I get an error like this:litdum said:I dont know whether anyone noticed but the passages in the castle courts&prisons in Warband do not work correctly. when we go to a castle courtyard by using these passages we should spawn at "entry 2" when it is from the court to the courtyard, "entry 7" if it is from the prison to the courtyard. But we always spawn at "entry 1" when we use these passages. I ve checked them in edit mod. "Menu item no" and "Entry no" are correct. I want these passages to work correctly. But i know nearly nothing about passages. How can i make them correct?
and these entries in LINE: 8 and LINE: 9 in castle_visit mission:agent_get_horse = 1714 # (agent_get_horse,<destination>,<agent_id>),
agent_get_team = 1770 # (agent_get_team ,<destination>, <agent_id>),
"castle_visit",0,-1,
"Castle visit",
[(0,mtef_scene_source|mtef_team_0,af_override_horse|af_override_weapons|af_override_head,0,1,pilgrim_disguise),
(1,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(2,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(3,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(4,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise), #for doors
(5,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(6,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(7,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(8,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(9,mtef_visitor_source|mtef_team_0,af_override_horse,0,1[]), (10,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(11,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(12,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(13,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(14,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(15,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(16,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(17,mtef_visitor_source|mtef_team_0,af_override_horse,0,1, ],
(5,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(6,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(7,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(8,mtef_visitor_source,af_override_horse,0,1,[]),(9,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(10,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(11,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(12,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(13,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(14,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),(15,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
I dont know how but changing the lines I bolded works for now, most likely by chance. I think probably after i changed mtef_visitor_source in "entry 7" to mtef_scene_source it has been solved.Caba`drin said:Those lines you bolded were definitively not the problem and you should return them to their original form.
You identified the appropriate mission, however the script error you posted was for trigger 13's consequence lines 8 and 9. The lines you bolded are not part of any trigger, but of the mission template's set up. After the setup, you'll find the large block, started with an open [ that lists all of the triggers of this format:
(X, X, X, [conditions], [consequences]),
You need to find the 14th trigger in that list (counting starts with 0) and the second block of operations in that trigger and look at the agent ID being passed in the 9th and 10th lines (which as you have identified will be using the agent_get_horse and agent_get_team operations). It appears that you are missing a check that the agent ID being passed is a legitimate agent (something like agent_is_active and/or agent_is_alive should do the trick).
from header_skills import *
bodyguard_triggers = [
(ti_after_mission_start, 0, ti_once, [(neq, "$g_mt_mode", tcm_disguised)], #condition for not sneaking in; to exclude prison-breaks, etc change to (eq, "$g_mt_mode", tcm_default")
[
#Get number of bodyguards
(store_skill_level, ":leadership", skl_leadership, "trp_player"),
(troop_get_slot, ":renown", "trp_player", slot_troop_renown),
(val_div, ":leadership", 3),
(val_div, ":renown", 400),
(store_add, ":max_guards", ":renown", ":leadership"),
(val_min, ":max_guards", 4),
(ge, ":max_guards", 1),
#Get player info
(get_player_agent_no, ":player"),
(agent_get_team, ":playerteam", ":player"), #LINE:8(9th)
(agent_get_horse, ":use_horse", ":player"), #If the player spawns with a horse, the bodyguard will too. #LINE:9(10th)
#Prepare Scene/Mission Template
(assign, ":entry_point", 0),
(assign, ":mission_tpl", 0),
(try_begin),
(party_slot_eq, "$current_town", slot_party_type, spt_village),
(assign, ":entry_point", 11), #Village Elder's Entry
(assign, ":mission_tpl", "mt_village_center"),
(else_try),
(this_or_next|eq, "$talk_context", tc_prison_break),
(this_or_next|eq, "$talk_context", tc_escape),
(eq, "$talk_context", tc_town_talk),
(assign, ":entry_point", 24), #Prison Guard's Entry
(try_begin),
(party_slot_eq, "$current_town", slot_party_type, spt_castle),
(assign, ":mission_tpl", "mt_castle_visit"),
(else_try),
(assign, ":mission_tpl", "mt_town_center"),
(try_end),
(else_try),
(eq, "$talk_context", tc_tavern_talk),
(assign, ":entry_point", 17), #First NPC Tavern Entry
(try_end),
(try_begin),
(neq, "$talk_context", tc_tavern_talk),
(gt, ":use_horse", 0),
(mission_tpl_entry_set_override_flags, ":mission_tpl", ":entry_point", 0),
(try_end),
(store_current_scene, ":cur_scene"),
(modify_visitors_at_site, ":cur_scene"),
#Find and Spawn Bodyguards
(assign, ":bodyguard_count", 0),
(party_get_num_companion_stacks, ":num_of_stacks", "p_main_party"),
(try_for_range, ":i", 0, ":num_of_stacks"),
(party_stack_get_troop_id, ":troop_id", "p_main_party", ":i"),
(neq, ":troop_id", "trp_player"),
(troop_is_hero, ":troop_id"),
(neg|troop_is_wounded, ":troop_id"),
(val_add, ":bodyguard_count", 1),
(try_begin), #For prison-breaks
(this_or_next|eq, "$talk_context", tc_escape),
(eq, "$talk_context", tc_prison_break),
(troop_set_slot, ":troop_id", slot_troop_will_join_prison_break, 1),
(try_end),
(add_visitors_to_current_scene, ":entry_point", ":troop_id", 1),
(eq, ":bodyguard_count", ":max_guards"),
(assign, ":num_of_stacks", 0), #Break Loop
(try_end), #Stack Loop
(gt, ":bodyguard_count", 0), #If bodyguards spawned...
(set_show_messages, 0),
(team_give_order, ":playerteam", 8, mordr_follow), #Division 8 to avoid potential conflicts
(set_show_messages, 1),
]),
This is great learning material.You need to find the 14th trigger in that list (counting starts with 0) and the second block of operations in that trigger and look at the agent ID being passed in the 9th and 10th lines (which as you have identified will be using the agent_get_horse and agent_get_team operations).
[(0,mtef_scene_source|mtef_team_0,af_override_horse|af_override_weapons|af_override_head,0,1,pilgrim_disguise),
(1,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(2,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(3,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(4,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise), #for doors
(5,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(6,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(7,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(8,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(9,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]), ##castle chief walkers
(10,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(11,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
(ti_on_agent_spawn, 0, 0, [],
[
(store_trigger_param_1, ":agent_no"),
(call_script, "script_init_town_agent", ":agent_no"),
(get_player_agent_no, ":player_agent"),
(try_begin),
(neq, ":player_agent", ":agent_no"),
(agent_set_team, ":agent_no", 7),
(try_end),
(try_begin),
(this_or_next|eq, "$talk_context", tc_escape),
(eq, "$talk_context", tc_prison_break),
(agent_get_troop_id, ":troop_no", ":agent_no"),
(troop_get_slot, ":will_join_prison_break", ":troop_no", slot_troop_will_join_prison_break),
(eq, ":will_join_prison_break", 1),
(agent_set_team, ":agent_no", 0),
(agent_ai_set_aggressiveness, ":agent_no", 5),
(troop_set_slot, ":troop_no", slot_troop_will_join_prison_break, 0),
(try_begin),
(troop_slot_eq, ":troop_no", slot_troop_mission_participation, mp_prison_break_stand_back),
(agent_get_position, pos1, ":agent_no"),
(agent_set_scripted_destination, ":agent_no", pos1),
(try_end),
(try_end),
just additionally,gdwitt said:This is great learning material.You need to find the 14th trigger in that list (counting starts with 0) and the second block of operations in that trigger and look at the agent ID being passed in the 9th and 10th lines (which as you have identified will be using the agent_get_horse and agent_get_team operations).
So in the castle_visit template, are these the conditions:
And this is the first trigger:Code:[(0,mtef_scene_source|mtef_team_0,af_override_horse|af_override_weapons|af_override_head,0,1,pilgrim_disguise), (1,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise), (2,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise), (3,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise), (4,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise), #for doors (5,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise), (6,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise), (7,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise), (8,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]), (9,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]), ##castle chief walkers (10,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]), (11,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
Code:(ti_on_agent_spawn, 0, 0, [], [ (store_trigger_param_1, ":agent_no"), (call_script, "script_init_town_agent", ":agent_no"), (get_player_agent_no, ":player_agent"), (try_begin), (neq, ":player_agent", ":agent_no"), (agent_set_team, ":agent_no", 7), (try_end), (try_begin), (this_or_next|eq, "$talk_context", tc_escape), (eq, "$talk_context", tc_prison_break), (agent_get_troop_id, ":troop_no", ":agent_no"), (troop_get_slot, ":will_join_prison_break", ":troop_no", slot_troop_will_join_prison_break), (eq, ":will_join_prison_break", 1), (agent_set_team, ":agent_no", 0), (agent_ai_set_aggressiveness, ":agent_no", 5), (troop_set_slot, ":troop_no", slot_troop_will_join_prison_break, 0), (try_begin), (troop_slot_eq, ":troop_no", slot_troop_mission_participation, mp_prison_break_stand_back), (agent_get_position, pos1, ":agent_no"), (agent_set_scripted_destination, ":agent_no", pos1), (try_end), (try_end),
common_shield_bash, #1th(0)
dplmc_horse_speed, #2nd(1)
(ti_on_agent_spawn, 0, 0, [], #3th(2)
[
(store_trigger_param_1, ":agent_no"),
(call_script, "script_init_town_agent", ":agent_no"),
(get_player_agent_no, ":player_agent"),
(try_begin),
(neq, ":player_agent", ":agent_no"),
(agent_set_team, ":agent_no", 7),
(try_end),
(try_begin),
(this_or_next|eq, "$talk_context", tc_escape),
(eq, "$talk_context", tc_prison_break),
(agent_get_troop_id, ":troop_no", ":agent_no"),
(troop_get_slot, ":will_join_prison_break", ":troop_no", slot_troop_will_join_prison_break),
(eq, ":will_join_prison_break", 1),
(agent_set_team, ":agent_no", 0),
(agent_ai_set_aggressiveness, ":agent_no", 5),
(troop_set_slot, ":troop_no", slot_troop_will_join_prison_break, 0),
(try_begin),
(troop_slot_eq, ":troop_no", slot_troop_mission_participation, mp_prison_break_stand_back),
(agent_get_position, pos1, ":agent_no"),
(agent_set_scripted_destination, ":agent_no", pos1),
(try_end),
(try_end),
]),
Bithon said:Is it possible to have game load several different terrains? I had this idea for a Sci-Fi mod where you had a main map set in space, and one for a planet. Is that possible ?
To clarify, is it possible to have multiple terrains be loaded?
Don't use tf_allways_fall_dead. Personally I thought it was hilarious trying to keep companions alive in Expanded Gameplay with those flags.produno said:Is tf_hero hardcoded? Meaning anyone with the tf_hero flag set should not die in battles?
Im having issues where peoople have reported companions and the player permanently dieing in battles.
ti_on_switch_to_map may not be what you're looking for, I guess this trigger is used for presentations/character screen you access from the map, rather than after battle.MitchellD said:How can I get a script to run when the player returns to the map after a battle? I notice there's a ti_on_switch_to_map but I haven't figured out how to get it to work.