Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Hey

I'm having some trouble using modmerger

[list type=decimal]
[*]I make a new folder with native module_system files
[*]Extract modmerger files into folder
[*]Unhash "mod1", under active mods in modmerger_options
[*]Add version 1171 in modmerger_options
[*]Install modmerger
[*]Build module, works fine
[*]Extract Freelancer modmerger into folder
[*]Add "freelancer", under "mod1", in active mods in modmerger_options
[*]Build module, get loads of errors
[/list]

build_module errors
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_init.py", line 2, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_global_variables.py", line 6, in <module>
    from module_dialogs import *
  File "D:\Warband workshop\Freelancer testing\module_dialogs.py", line 26293, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_dialogs.py", line 197, in modmerge
    pos = FindDialog_i(orig_dialogs, anyone|plyr, "lord_talk", "lord_leave_prison")
NameError: global name 'FindDialog_i' is not defined
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_map_icons.py", line 6, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
Exporting faction data...
Exporting item data...
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_items.py", line 66, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
Exporting scene data...
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
Exporting troops data
Exporting particle data...
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_scene_props.py", line 7, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
Exporting party_template data...
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_parties.py", line 4, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
Exporting quest data...
Exporting info_page data...
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_scripts.py", line 7, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_game_menus.py", line 5, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_simple_triggers.py", line 5, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_dialogs.py", line 6, in <module>
    from module_dialogs import *
  File "D:\Warband workshop\Freelancer testing\module_dialogs.py", line 26293, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_dialogs.py", line 197, in modmerge
    pos = FindDialog_i(orig_dialogs, anyone|plyr, "lord_talk", "lord_leave_prison")
NameError: global name 'FindDialog_i' is not defined
D:\Warband workshop\Freelancer testing\util_scripts.py:84: UserWarning: Error injecting code into: party_give_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
Injecton 4 failed: global name 'GameMenuOptionWrapper' is not defined
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "D:\Warband workshop\Freelancer testing\process_operations.py", line 22, in <module>
    from module_game_menus import *
  File "D:\Warband workshop\Freelancer testing\module_game_menus.py", line 14518, in <module>
    modmerge(var_set)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "D:\Warband workshop\Freelancer testing\modmerger.py", line 239, in modmerge__
    _temp.__dict__[mergefn_name](var_dict)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 446, in modmerge
    modmerge_game_menus(orig_game_menus)
  File "D:\Warband workshop\Freelancer testing\freelancer_game_menus.py", line 407, in modmerge_game_menus
    menuID = GameMenuOptionWrapper(menulist).GetId()
NameError: global name 'GameMenuOptionWrapper' is not defined
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .



modmerger_options
# master options for modmerger framework
# by sphere

# -2 : print error only
# -1 : print errors and warnings
# 0 : print errors, warnings and info
# 1 : print all
DEBUG_MODE = -1

# fill this in yourself with the module system you are using, so that some mods can make smarter decisions on how to merge with your source.
module_sys_info = {
        "engine" : "warband", # only "warband" or "vanilla" for now. (unused)
        "version": 1171,      # version number * 1000
}

options={

    "process_scripts_show_script_name": 0,    # for debugging. checked by modified process_scripts.py to show name of script being processed   
}

# List of active mod code names.
# This is also the default order during bulk processing
# The specific mod source files must be in the format "{modname}_????.py". 
# for example, the mod content corresponding to "items", for mod "fc" should be in the file "fc_items.py"

mods_active = [
# insert the active mod names here
    "mod1",
    "freelancer",
#    "mymod",
#    "anothermod",
]


# Alternate process order for certain modules components
# Only need to be defined if order/combination is different from mods_active
# Each element in is is a tuple with the following elements
#
# 1) mod component name (less the "module_" prefix), e.g. for "module_items", it will be "items"
# 2) list of mod names in the order to be processed.  The mod names should be
#      the ones used in mods_active, and will only be processed if they are in
#      mods_active.
#

mods_process_order=[
#    ("{component_name}", [{list of mod names}]),

]


# check and fill in defaults for certain required variables
try:
    module_sys_info["version"]
except KeyError:
    # assume version to be latest version that modmerger was tested on
    module_sys_info["version"] = 1171

Am i missing something obvious? I also tried with "mod1", still hashtagged in modmerger_options, same result.

I used these for help https://forums.taleworlds.com/index.php?topic=346821.0
                              https://forums.taleworlds.com/index.php?topic=320834.0

There is some code that needs adding/changing, but according to the first link, i'm not even at that stage yet.
 
Jorjie said:
'Swyter's Cartographer'

check instructions in the tool thread, you can also ask questions there https://forums.taleworlds.com/index.php/topic,183658.0.html

your current error seems to be related to installation. You should re-download the tool and make sure you got it all (check the file size), and reinstall it. You can also google for the problem, as it is not related to the tool itself, but the underline tech used for it.



TheCaitularity said:
Does it matter where in module_items new items go?

short answer: yes
long answer: maybe

if you want to add regular items to the game, that have all the normal features for them, then keep those new entries inside their regular ranges (module_constants.py). If all you want is to add a new sword via .txt edit and get it from the cheat menu then adding that to the end of the file is fine.

Code:
trade_goods_begin = "itm_spice"
trade_goods_end = "itm_siege_supply"
food_begin = "itm_smoked_fish"
food_end = "itm_siege_supply"
reference_books_begin = "itm_book_wound_treatment_reference"
reference_books_end   = trade_goods_begin
readable_books_begin = "itm_book_tactics"
readable_books_end   = reference_books_begin
books_begin = readable_books_begin
books_end = reference_books_end
horses_begin = "itm_sumpter_horse"
horses_end = "itm_arrows"
weapons_begin = "itm_wooden_stick"
weapons_end = "itm_wooden_shield"
ranged_weapons_begin = "itm_darts"
ranged_weapons_end = "itm_torch"
armors_begin = "itm_leather_gloves"
armors_end = "itm_wooden_stick"
shields_begin = "itm_wooden_shield"
shields_end = ranged_weapons_begin
 
Ah cool, thanks kalarhan. So as long as melee weapons are between
Code:
weapons_begin = "itm_wooden_stick"
weapons_end = "itm_wooden_shield"
everything should be good? It's not like I need to put the swords with the other swords?
 
TheCaitularity said:
It's not like I need to put the swords with the other swords?

that answer is complicated, as it depends on your code. As in, what you are using as your base (Native, Floris, VC, etc) can have different ways to handle weapons stats, as this is mostly done via modsys. As always, do small stuff/changes and test them.

also remember that adding stuff in the middle of items breaks the savegame (you need to start a new campaign).
 
How to make it so faction A can't declare peace with faction B? Tried giving them -1.0 relations in Morgh's but they make peace after less than 1 in-game day.
 
benis said:
How to make it so faction A can't declare peace with faction B? Tried giving them -1.0 relations in Morgh's but they make peace after less than 1 in-game day.
Using scripts and altering randomly_start_war_peace_new script accordingly.
 
benis said:
Any way to find that trigger on the .txt? I don't have the mod's source code.
It's a script, not a trigger.
And no, you cannot edit things like this without a module system unless you spend several weeks first studying a module system and then learning how to edit numeric code.
 
Code:
                                (agent_get_item_slot, ":item1", ":agent", 0),

				(try_begin),
					(gt, ":item1", -1),
					(str_store_item_name, s0, ":item1"),
					(try_begin),#If ranged ammo, check how much left
						(this_or_next|item_has_property, ":item1", itp_type_thrown),
						(this_or_next|item_has_property, ":item1", itp_type_arrows),
						(this_or_next|item_has_property, ":item1", itp_type_bolts),
						(item_has_property, ":item1", itp_type_bullets),
						(agent_get_ammo_for_slot, reg0, ":agent", 0),
						(str_store_string, s0, "@{s0} ({reg0})"),
					(try_end),
				(else_try),
					(str_store_string, s0, "@ "),
				(try_end),

For anything that's not ammo(thrown, arrows, bolts or bullets) this should only output the items name, and for everything that is ammo it should output "ITEMNAME (AmmoLeft)".
However, it seems to ignore the checks for item properties and just outputs the itemname and the part in the brackets. Any ideas why?
 
Namakan said:
item properties

Code:
item_get_type                       = 1570  # (item_get_type, <destination>, <item_id>),
                                            # Returns item class (see header_items.py for itp_type_* constants).

itp_type_* constants

also you should look at

Code:
agent_get_wielded_item                   = 1726  # (agent_get_wielded_item, <destination>, <agent_id>, <hand_no>),
                                                 # Retrieves the item reference that the agent is currently wielding in his right hand (hand_no = 0) or left hand (hand_no = 1). Note that weapons are always wielded in right hand, and shield in left hand. When wielding a two-handed weapon (including bows and crossbows), this operation will return -1 for left hand.
agent_get_ammo                           = 1727  # (agent_get_ammo, <destination>, <agent_id>, <value>),
                                                 # Retrieves the current ammo amount agent has for his wielded item (value = 1) or all his items (value = 0).
agent_get_item_cur_ammo                  = 1977  # (agent_get_item_cur_ammo, <destination>, <agent_id>, <slot_no>),
                                                 # Version 1.153+. Returns remaining ammo for specified agent's item.
 
Code:
["nord_veteran_archer","Nord Veteran Archer","Nord Veteran Archers",tf_guarantee_ranged|tf_guarantee_boots|tf_guarantee_armor,0,0,fac_kingdom_4,
   [itm_bodkin_arrows,itm_sword_viking_2,itm_fighting_axe,itm_two_handed_axe,itm_long_bow,itm_mail_shirt,itm_mail_shirt,itm_byrnie,itm_leather_boots,itm_nordic_archer_helmet,itm_nordic_veteran_archer_helmet],
   str_12 | agi_5 | int_4 | cha_4|level(19),wp_one_handed (95) | wp_two_handed (95) | wp_polearm (95) | wp_archery (120) | wp_crossbow (95) | wp_throwing (95),knows_power_strike_3|knows_ironflesh_4|knows_power_draw_5|knows_athletics_7,nord_face_middle_1, nord_face_older_2],
Code:
itm_mail_shirt,itm_mail_shirt,
Noob question, but if an item shows up twice in a troop's inventory, does that mean that it will have twice the likelihood of spawning in the troop's actual inventory in-game? And if so, will the same effect apply if it shows up three times/four times/so on and so forth?
 
Hello,

I want to add 2 mission template(mt) trigger to a mt.

For example "crouching_triggers" and "bodyguard_triggers".

This works:
Code:
.................
] + crouching_triggers,
),
...............

This works, too:
Code:
.................
] + bodyguard_triggers,
),
...............

But I want to add 2 of them in same mt. How can I write right code?
 
Tüfekçi Başı said:
Hello,

I want to add 2 mission template(mt) trigger to a mt.

For example "crouching_triggers" and "bodyguard_triggers".

This works:
Code:
.................
] + crouching_triggers,
),
...............

This works, too:
Code:
.................
] + bodyguard_triggers,
),
...............

But I want to add 2 of them in same mt. How can I write right code?

No idea how you wrote them but I usually just do:
Code:
some_triggers1,
some_triggers2,
some_triggers3,

inside mt body.
 
its [ ] + [ ] + [ ] .... when working with a list of triggers

Tüfekçi Başı said:
Code:
.................
] + bodyguard_triggers + crouching_triggers
),
...............

its like this

a = [ trigger1, trigger2, trigger3]
b = [ trigger4, trigger5]

a + b = [ trigger1, trigger2, trigger3, trigger4, trigger5 ]
 
Crouching triggers are as you write. a = [ trigger1, trigger2, trigger3]

But this is "bodyguard triggers".
Code:
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"),
    (agent_get_horse, ":use_horse", ":player"), #If the player spawns with a horse, the bodyguard will too.

    #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),   
   ]),   

 (ti_on_agent_spawn, 0, 0, [],
   [
    (store_trigger_param_1, ":agent"),
    (agent_get_troop_id, ":troop", ":agent"),
    (neq, ":troop", "trp_player"),
    (troop_is_hero, ":troop"),
    (main_party_has_troop, ":troop"),
   
    (get_player_agent_no, ":player"),
    (agent_get_team, ":playerteam", ":player"),
    (agent_get_position,pos1,":player"),       
   
    (agent_set_team, ":agent", ":playerteam"),
    (agent_set_division, ":agent", 8),
    (agent_add_relation_with_agent, ":agent", ":player", 1),
    (agent_set_is_alarmed, ":agent", 1),
    (store_random_in_range, ":shift", 1, 3),
    (val_mul, ":shift", 100),
    (position_move_y, pos1, ":shift"),
    (store_random_in_range, ":shift", 1, 3),
    (store_random_in_range, ":shift_2", 0, 2),
    (val_mul, ":shift_2", -1),
    (try_begin),
        (neq, ":shift_2", 0),
        (val_mul, ":shift", ":shift_2"),
    (try_end),
    (position_move_x, pos1, ":shift"),
    (agent_set_position, ":agent", pos1),
   ]),
 
 (ti_on_agent_killed_or_wounded, 0, 0, [],
    [
     (store_trigger_param_1, ":dead_agent"),
       
     (agent_get_troop_id, ":troop", ":dead_agent"),
     (neq, ":troop", "trp_player"),
     (troop_is_hero, ":troop"),
     (main_party_has_troop, ":troop"),
     (party_wound_members, "p_main_party", ":troop", 1),
    ]),
 ]
Thread: https://forums.taleworlds.com/index.php/topic,151908.0.html

I clearly understood friends, thank you, but never mind. Different types. A complex situation. I don't waste your time. I can convert. Probably tihs is the best way. :smile:
 
Status
Not open for further replies.
Back
Top Bottom