Repeat for parties

From Mount&Blade Modding Wiki
Jump to: navigation, search

Contents

[edit] Description

repeat_for_parties is an operation that lets you create dynamic length dialog options by automatically evaluating the dialog script against every party.

Since this operation loops through all parties, you must use dialog scripts to evaluate each party against your listing criteria. For example, listing all towns belonging to a certain kingdom. In order do this, you must use store_repeat_object and assign a variable that will act as an iterator. Evaluate this variable against your criteria in the dialog's script.

[edit] Inputs

arg1 = (reference to a variable)

[edit] Outputs

none.

[edit] Common use

Generating a dialog options list of towns or other centers based on certain criteria defined in the dialog's script (e.g. unassigned towns)

[edit] Examples

[anyone, "start", [], "Which cooperative town would you like to send a message to?", "choose_centre", []]],
[anyone|plyr|repeat_for_parties, "choose_centre", [
  (store_repeat_object, ":centre_iterator"),  #store each party so we can test it against criteria
  (is_between, ":centre_iterator", towns_begin, towns_end), #ensure the party is a town
  (call_script,"script_get_relation_between_parties", "p_main_party", ":centre_iterator"), #saves relation to reg0
  (ge, reg0, 20), # relation must be over 20 (cooperative)
  (neq, "$current_town", ":centre_iterator"), # must not be the current location
  (str_store_party_name, s1, ":centre_iterator") #everything's good, save the name for the list
  ], "I wish to give up {s1}", []],

[edit] Also see

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox