Modding Q&A [For Quick Questions and Answers]

Currently viewing this thread:

Status
Not open for further replies.

bobross419

Sergeant
M&BWBWF&S
Thanks, I wasn’t specifically asking about that but that does kinda confirm that modding takes patience lol.

I’m more looking for Set of tools I can use to make items appear in my inventory, or troops in my party.  Maybe something in the ~ menu?

Like, my character has a saddle horse but I’m trying to reskin a sumpter horse without traveling all over Calradia to find one.

I know I can do that through save editor but it seems tedious when checking a bunch of things... like a developers tool bag or something.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
bobross419 said:
I’m more looking for Set of tools I can use to make items appear in my inventory, or troops in my party.  Maybe something in the ~ menu?

you can use the cheat menu, but that takes time as well. So just use a trigger that gives you all the stuff, or change the code that gives gear for a new player. You can also skip the character creation and tutorial quests for a quick new game.

https://forums.taleworlds.com/index.php/topic,349118.msg8377882.html#msg8377882

if you dont know about triggers check the tutorial section. Use the operation
Code:
troop_add_item                           = 1530  # (troop_add_item, <troop_id>, <item_id>, [modifier]),
                                                 # Adds an item to the troop, optionally with a modifier (see imod_* constants in header_item_modifiers.py).

you can change pretty much anything you want. So create your own workflow and tools is also possible. Want a console-like system to add items? Write one. You can also check the OSP section for some ideas.
 

cwr

Count
M&BWB
Here is some super simple party template dialog. You can see the use of party_tpl|pt_senate_loyalists that you should modify to your own needs.
Code:
  [anyone,"senate_introduce", [], "For the Senate!", "close_window",[[encounter_attack]]],
  [anyone,"senate_introduce_noattack", [],"The Senate must be restored, Titus is a traitor to Aginnum. What say you?", "party_encounter_hostile_defender",[]],

  [party_tpl|pt_senate_loyalists|auto_proceed,"start", [(eq,"$talk_context",tc_party_encounter),(encountered_party_is_attacker)],
   "{!}Warning: This line should never display.", "senate_introduce",[]],
  [party_tpl|pt_senate_loyalists|auto_proceed,"start", [(eq,"$talk_context",tc_party_encounter),],
   "{!}Warning: This line should never display.", "senate_introduce_noattack",[]],

#the part below is already in Native- I'm posting it so you see the full dialog tree
  [anyone|plyr,"party_encounter_hostile_defender", [],
   "Surrender or die!", "party_encounter_hostile_ultimatum_surrender", []],
  [anyone,"party_encounter_hostile_ultimatum_surrender", [],
   "{s43}", "close_window", [(call_script, "script_lord_comment_to_s43", "$g_talk_troop", "str_lord_challenged_default"),]],
  [anyone|plyr,"party_encounter_hostile_defender", [],
   "We'll leave you in peace.", "close_window", [(assign, "$g_leave_encounter",1)]],
The party_encounter_hostile_defender bit is part of Native so you should be able to find that already in your own code.

In general I recommend reading Native code, especially when implementing things that are already done within Native. (ie speaking to a party)
 

Avareee

Sergeant at Arms
WBNWWF&S
kalarhan said:
Avareee said:
EDIT: Today I had this error, anyone knows what can I do against it? It happened when a lord left the faction and took the fiefs with him. But in reality he just left the faction with no fiefs. (says the notes, "no fiefs")
https://imgur.com/SBr3RXH

track the error point (as the error log shows it). Remember the "no fiefs" is just a text that is updated often, so dont trust that text. Check if the lord has or not any fiefs. If the update notes worked or not. And why that part of get notes is blowing up.

Code:
script_update_faction_notes = 400
script_update_faction_political_notes = 401
script_update_faction_traveler_notes = 402
script_update_troop_notes = 403
script_update_troop_location_notes = 404
script_update_troop_location_notes_prisoned = 405
script_update_troop_political_notes = 406
script_update_center_notes = 407
script_update_center_recon_notes = 408
script_update_all_notes = 409

How do I track it? Sorry, I didn't get it. I'm a noob in modding still :p. I looked and looked but didn't get it or found something.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Avareee said:
How do I track it?

start by reading the error message and looking at that line in your code. It tells you the file (scripts), the script in particular (name of the script), the operation used, the parameter that was invalid (scene id) and the line of code inside that script.
 

bobross419

Sergeant
M&BWBWF&S
Posting here instead of openbrf sub because it seems like a pretty dead forum.

Can anyone confirm a working version (and service pack) of Windows and OpenBRF?  I’m trying to get it running in VirtualBox and neither 32 or 64 bit versions of Windows 10 would run it.  I have access to other keys, but my local internet’s are slow and I don’t want to waste more time pulling ISOs that aren’t going to work.

I’ve found other people with the same issue I have (blank preview) and some people must be able to get it to work.
I’ve also tried getting it to run under WINE with various settings.


EDIT: I stumbled across a working solution (for me)... https://www.mbrepository.com/file.php?id=3487 contains an OpenBrf.exe along with some dll files in the Resources/ folder and it just kinda worked for me on Mac on WINE.
 

coderjosh

Recruit
WBNWM&BWF&S
Trying to make player camera lock onto the closest enemy troop. I just started doing this a week ago so I'm sure this is wrong

custom_camera_lock = (
      0, 0, 0, [],
      [
(get_player_agent_no, ":player_agent"),
(agent_get_look_position, pos1, ":player_agent"),
(try_for_range, ":enemy_range", "trp_novice_fighter", "trp_npc16"),
(agent_is_active, ":enemy_range"),
(assign, ":enemy_trp", ":enemy_range"),
(agent_get_position, pos1, ":player_agent"),
(agent_get_position, pos1, ":enemy_trp"),
(get_distance_between_positions_in_meters, ":distance_trp", ":player_agent", ":enemy_trp"),
(try_begin),
(le, ":distance_trp", 10),
(key_clicked, key_numpad_7),
(mission_cam_set_mode, 1),
(agent_set_look_target_agent, ":player_agent", ":enemy_trp"),
(try_end),
])

Any pointers would be nice. Thanks.
 

Avareee

Sergeant at Arms
WBNWWF&S
I have a question people.

So I have put this Horse Archer Script into the native game:

###JunYue(君悦)###
  0.5, 0, 0, [],
  [     
        (set_fixed_point_multiplier, 1000),
        (try_for_agents, ":agent_no"),
            (agent_is_alive, ":agent_no"),
            (agent_is_human, ":agent_no"),
            (agent_is_non_player, ":agent_no"),
            (neg|agent_slot_eq, ":agent_no", 1003, 1),
            (agent_get_horse, ":horse_no", ":agent_no"),
            (assign, ":melee_weapon", -1),
            (try_begin),
                (agent_slot_eq, ":agent_no", slot_agent_is_running_away, 0),
                (gt, ":horse_no", -1),
                (agent_get_team, ":team_no", ":agent_no"),
                (agent_get_division, ":class_no", ":agent_no"),
                (team_get_weapon_usage_order, ":weapon_usage_order", ":team_no", ":class_no"),
                (team_get_movement_order, ":movement_order", ":team_no", ":class_no"),
                (team_get_hold_fire_order, ":hold_fire", ":team_no", ":class_no"),
                (assign, ":thrown_ammo", 0),
                (assign, ":ranged_weapon", -1),
                (try_for_range, ":item", 0, 4),
                  (agent_get_item_slot, ":item_weapon", ":agent_no", ":item"),
                  (gt, ":item_weapon", 0),
                  (item_get_type, ":item_weapon_type", ":item_weapon"),
                  (try_begin),
                    (eq, ":item_weapon_type", itp_type_thrown),
                    (agent_get_ammo_for_slot, ":ammo_for_slot", ":agent_no", ":item"),
                    (val_add, ":thrown_ammo", ":ammo_for_slot"),
                  (else_try),
                    (this_or_next|eq, ":item_weapon_type", itp_type_bow),
                    (this_or_next|eq, ":item_weapon_type", itp_type_pistol),
                    (eq, ":item_weapon_type", itp_type_musket),
                    (assign, ":ranged_weapon", ":item_weapon"),
                  (else_try),
                    (this_or_next|eq, ":item_weapon_type", itp_type_one_handed_wpn),
                    (this_or_next|eq, ":item_weapon_type", itp_type_two_handed_wpn),
                    (eq, ":item_weapon_type", itp_type_polearm),
                    (assign, ":melee_weapon", ":item_weapon"),
                  (try_end),
                (try_end),
                (gt, ":ranged_weapon", -1),         
                (neg|item_has_property, ":ranged_weapon", itp_cant_reload_on_horseback),
                (neg|item_has_property, ":ranged_weapon", itp_cant_use_on_horseback),
                (agent_get_ammo, ":ammo", ":agent_no", 0),
                (val_sub, ":ammo", ":thrown_ammo"),
                (gt, ":ammo", 0),
                (agent_set_slot, ":agent_no", 1003, 2),
                (neg|eq, ":hold_fire", aordr_hold_your_fire),
                (neg|eq, ":weapon_usage_order", wordr_use_melee_weapons),
                (eq, ":movement_order", mordr_charge),
                (agent_get_position, pos50, ":agent_no"),
                (agent_get_speed, pos31, ":agent_no"),
                (position_get_y,":speed_y",pos31),
                (assign, ":distance_closest", 100000),#1000m
                (assign, ":enemies_closest", -1),
                (try_for_agents, ":enemies"),
                    (agent_is_alive, ":enemies"),
                    (agent_is_human, ":enemies"),
                    (agent_get_position, pos36, ":enemies"),
                    (agent_get_team, ":enemies_team", ":enemies"),
                    (teams_are_enemies, ":team_no", ":enemies_team"),
                    (get_distance_between_positions, ":distance", pos50, pos36),
                    (try_begin),
                      (agent_slot_eq, ":enemies", slot_agent_is_running_away, 1),
                      (val_add, ":distance", 10000),
                    (try_end),
                    (try_begin),
                      (agent_get_horse, ":enemies_horse", ":enemies"),
                      (gt, ":enemies_horse", -1),
                      (agent_get_speed, pos32, ":enemies"),
                      (position_get_y,":speed_y_enemies",pos32),
                      (val_sub, ":speed_y_enemies", ":speed_y"),
                      (store_div, ":distance_cavalry", ":speed_y_enemies",5),
                      (val_max, ":distance_cavalry", 0),
                      (val_add, ":distance_cavalry", 500),
                      (val_sub, ":distance", ":distance_cavalry"),
                    (else_try),
                      (agent_get_wielded_item, ":weapon_hold", ":enemies", 1),
                      (neg|gt, ":weapon_hold", 1),
                      (val_sub, ":distance", 500),
                    (try_end),
                    (lt, ":distance", ":distance_closest"),
                    (assign, ":distance_closest", ":distance"),
                    (assign, ":enemies_closest", ":enemies"),
                (try_end),
                (neq, ":enemies_closest", -1),
                (agent_get_position, pos51, ":enemies_closest"),
                (get_distance_between_positions, ":distance_true", pos50, pos51),
                (try_begin),
                  (agent_slot_eq, ":enemies_closest", slot_agent_is_running_away, 0),
                  (gt,":distance_true",200),
                  (agent_set_wielded_item, ":agent_no", ":ranged_weapon"),
                (else_try),
                  (le, ":distance_true", 200),
                  (gt, ":melee_weapon", -1),
                  (agent_set_wielded_item, ":agent_no", ":melee_weapon"),
                (try_end),
                (assign, ":speed_limit", 1000),
                (try_begin),
                    (agent_get_wielded_item, ":weapon_hold", ":agent_no", 0),
                    (gt, ":weapon_hold", 0),
                    (item_get_type, ":weapon_type", ":weapon_hold"),
                    (this_or_next|eq, ":weapon_type", itp_type_bow),
                    (this_or_next|eq, ":weapon_type", itp_type_pistol),
                    (eq, ":weapon_type", itp_type_musket),
                    (agent_get_bone_position, pos53, ":agent_no", 8, 1),
                    (agent_get_bone_position, pos54, ":enemies_closest", 9, 1),
                    (position_has_line_of_sight_to_position, pos53, pos54),
                    (agent_set_look_target_agent, ":agent_no", ":enemies_closest"),
                    (try_begin),
                      (assign, ":shoot_distance", 4000),
                      (agent_get_attack_action, ":attack_action", ":agent_no"),
                      (eq, ":attack_action", 1),
                      (try_begin),
                        (gt, ":distance_closest", 700),
                        (le, ":distance_closest", ":shoot_distance"),
                        (store_div, ":speed_limit", ":speed_y",2000),#
                        (val_max, ":speed_limit", 0),
                      (try_end),
                      (eq, ":weapon_type", itp_type_bow),
                      (try_begin),
                        (le, ":distance_true", ":shoot_distance"),
                        (agent_set_defend_action, ":agent_no", -2, 1),
                        (agent_set_attack_action, ":agent_no", 3, 0),
                      (else_try),
                        (gt, ":distance_true", ":shoot_distance"),
                        (agent_set_attack_action, ":agent_no", -2, 1),
                        (agent_set_defend_action, ":agent_no", 3, 1),
                      (try_end),
                    (else_try),
                      (eq, ":weapon_type", itp_type_bow),
                      (le, ":distance_true", ":shoot_distance"),#
                      (agent_get_combat_state, ":combat_state", ":agent_no"),
                      (neq, ":combat_state", :cool:,
                      (agent_set_attack_action, ":agent_no", 3, 1),
                    (try_end),
                (try_end),
                (agent_set_speed_limit, ":agent_no", ":speed_limit"),
                (try_begin),
                  (agent_slot_eq, ":enemies_closest", slot_agent_is_running_away, 0),
                  (lt, ":distance_closest", 10000),
                  (try_begin),
                    (get_scene_boundaries, pos2, pos3),
                    (position_transform_position_to_local, pos4, pos2,pos50),
                    (position_get_x, ":left", pos4),
                    (position_get_y, ":down", pos4),
                    (position_transform_position_to_local, pos4, pos2,pos3),
                    (position_get_x, ":map_width", pos4),
                    (position_get_y, ":map_height", pos4),
                    (store_sub, ":right", ":map_width", ":left"),
                    (store_sub, ":up", ":map_height", ":down"),
                    (position_transform_position_to_local, pos4, pos50, pos51),
                    (position_get_x, ":enemies_x", pos4),
                    (position_get_y, ":enemies_y", pos4),
                    (assign, ":effect", 0),
                    (try_begin),
                      (neg|gt, ":distance_closest", 1000),
                      (assign, ":effect", -78000),
                    (else_try),
                      (gt, ":distance_closest", 2000),#
                      (store_sub,":effect", ":distance_closest", 0),
                      (val_mul, ":effect", 5),
                      (val_clamp, ":effect", 35000, 90000),
                    (try_end),
                    (assign, ":distance_to_boundary", 30000),
                    (val_min, ":distance_to_boundary", ":left"),
                    (val_min, ":distance_to_boundary", ":up"),
                    (val_min, ":distance_to_boundary", ":right"),
                    (val_min, ":distance_to_boundary", ":down"),
                    (try_begin),
                      (lt, ":distance_to_boundary", 30000),
                      (agent_slot_eq, ":enemies_closest", slot_agent_is_running_away, 0),
                      (store_div, ":map_middle_x", ":map_width", 20),
                      (store_div, ":map_middle_y", ":map_height", 20),
                      (position_copy_origin, pos4, pos2),
                      (position_move_x, pos4, ":map_middle_x", 1),
                      (position_move_y, pos4, ":map_middle_y", 1),
                      (get_distance_between_positions,":distance_middle", pos4, pos50),
                      (position_transform_position_to_local, pos4, pos50, pos4),
                      (position_get_x, ":map_middle_x", pos4),
                      (position_get_y, ":map_middle_y", pos4),
                      (val_mul, ":map_middle_x", 100),
                      (val_mul, ":map_middle_y", 100),
                      (val_mul, ":enemies_x", 100),
                      (val_mul, ":enemies_y", 100),
                      (store_div,":cos_middle",":map_middle_x",":distance_middle"),
                      (store_div,":sin_middle",":map_middle_y",":distance_middle"),
                      (store_div,":cos_enemies",":enemies_x",":distance_true"),
                      (store_div,":sin_enemies",":enemies_y",":distance_true"),
                      (store_acos, ":angle_cos", ":cos_middle"),
                      (store_asin, ":angle_sin", ":sin_middle"),
                      (store_acos, ":angle_cos_enemies", ":cos_enemies"),
                      (store_asin, ":angle_sin_enemies", ":sin_enemies"),
                      (try_begin),
                        (lt, ":angle_sin", 0),
                        (val_mul,":angle_cos", -1),
                        (val_add,":angle_cos", 360000),
                      (try_end),
                      (try_begin),
                        (lt, ":angle_sin_enemies", 0),
                        (val_mul,":angle_cos_enemies", -1),
                        (val_add,":angle_cos_enemies", 360000),
                      (try_end),
                      (store_sub, ":k2", ":angle_cos", ":angle_cos_enemies"),
                      (val_sub, ":k2", 270000),
                      (val_sub, ":k2", ":effect"),
                      (store_add, ":effect", ":k2", ":effect"),
                      (try_begin),
                        (lt, ":angle_cos", ":angle_cos_enemies"),
                        (val_add, ":effect", 360000),
                      (try_end),
                      (val_clamp,":effect",-210000, 15000),
                      (agent_set_attack_action, ":agent_no", -2, 1),
                      (agent_set_defend_action, ":agent_no", 3, 1),
                    (try_end),
                    (store_cos, ":cos", ":effect"),
                    (store_sin, ":sin", ":effect"),
                    (store_mul, ":k_x1", ":cos", ":enemies_y",),
                    (store_mul, ":k_x2", ":sin", ":enemies_x",),
                    (store_mul, ":k_y1", ":sin", ":enemies_y",),
                    (store_mul, ":k_y2", ":cos", ":enemies_x",),
                    (store_add, ":move_x",":k_x1", ":k_x2"),
                    (store_sub, ":move_y",":k_y1", ":k_y2"),
                    (position_move_x, pos50, ":move_x", 0),
                    (position_move_y, pos50, ":move_y", 0),
                  (try_end),
                  (agent_set_scripted_destination, ":agent_no", pos50, 1),
                (else_try),
                  (agent_clear_scripted_mode, ":agent_no"),
                  (agent_force_rethink, ":agent_no"),
                (try_end),
            (else_try),
                (try_begin),
                  (agent_slot_eq, ":agent_no", 1003, 0),
                  (agent_set_slot, ":agent_no", 1003, 1),
                (else_try),
                  (agent_slot_eq, ":agent_no", 1003, 2),
                  (this_or_next|agent_slot_eq, ":agent_no", slot_agent_is_running_away, 1),
                  (this_or_next|lt, ":horse_no", 0),
                  (this_or_next|eq, ":ammo", 0),
                  (this_or_next|eq, ":hold_fire", aordr_hold_your_fire),
                  (this_or_next|eq, ":weapon_usage_order", wordr_use_melee_weapons),
                  (neq, ":movement_order", mordr_charge),
                  (agent_clear_scripted_mode, ":agent_no"),
                  (agent_set_speed_limit, ":agent_no", 100),
                  (agent_force_rethink, ":agent_no"),
                  (agent_set_slot, ":agent_no", 1003, 3),
                  (this_or_next|eq, ":hold_fire", aordr_hold_your_fire),
                  (eq, ":ammo", 0),
                  (gt, ":melee_weapon", -1),
                  (agent_set_wielded_item, ":agent_no", ":melee_weapon"),
                (try_end),
            (try_end),
        (try_end),
  ])

And everything works fine, but I want to limit the script to just Heroes/Lords.
I want to assign that script to arrows or bows. Anyone knows how to do that?

 

kalarhan

Python Saint
Count
WBNWVCWF&S
coderjosh said:
 
Code:
   (agent_get_position, pos1, ":player_agent"),
   (agent_get_position, pos1, ":enemy_trp"),
   (get_distance_between_positions_in_meters, ":distance_trp", ":player_agent", ":enemy_trp"),

there are a few issues with your code, so you will need to check the tutorials and, in special, read the header_operations.py description on each operation (get Lav's version).

for example the above. Why would you try to save two different coordinates on the same variable? The second would just remove the first. And look at how you are trying to find distance, as you are passing the wrong parameters for the operation.

https://forums.taleworlds.com/index.php/topic,142422.0.html
https://forums.taleworlds.com/index.php/topic,56798.0.html -> get the PDF
https://forums.taleworlds.com/index.php/board,12.0.html

http://forums.taleworlds.com/index.php/topic,324874.0.html -> Lav's


Avareee said:
And everything works fine, but I want to limit the script to just Heroes/Lords.
I want to assign that script to arrows or bows. Anyone knows how to do that?

Heroes/Lords.
1 TROOP : Many AGENTS
1 AGENT : 1 TROOP

you have operations to get the ID between them, like "agent_get_troop_id". Then you use other operations to check if that troop belong to the list you want, or is of a type (hero), etc.

like in
Code:
(is_between, ":variable_here", active_npcs_begin, active_npcs_end), # choose the list start-end for filtering

get Lav's and check the sections for AGENT and TROOP to see the relevant operations.

arrows or bows
similar case. Items have a ID and types. You use that information to filter them and find if they belong to a list.
 

Avareee

Sergeant at Arms
WBNWWF&S
kalarhan said:
coderjosh said:
 
Code:
   (agent_get_position, pos1, ":player_agent"),
   (agent_get_position, pos1, ":enemy_trp"),
   (get_distance_between_positions_in_meters, ":distance_trp", ":player_agent", ":enemy_trp"),

there are a few issues with your code, so you will need to check the tutorials and, in special, read the header_operations.py description on each operation (get Lav's version).

for example the above. Why would you try to save two different coordinates on the same variable? The second would just remove the first. And look at how you are trying to find distance, as you are passing the wrong parameters for the operation.

https://forums.taleworlds.com/index.php/topic,142422.0.html
https://forums.taleworlds.com/index.php/topic,56798.0.html -> get the PDF
https://forums.taleworlds.com/index.php/board,12.0.html

http://forums.taleworlds.com/index.php/topic,324874.0.html -> Lav's


Avareee said:
And everything works fine, but I want to limit the script to just Heroes/Lords.
I want to assign that script to arrows or bows. Anyone knows how to do that?

Heroes/Lords.
1 TROOP : Many AGENTS
1 AGENT : 1 TROOP

you have operations to get the ID between them, like "agent_get_troop_id". Then you use other operations to check if that troop belong to the list you want, or is of a type (hero), etc.

like in
Code:
(is_between, ":variable_here", active_npcs_begin, active_npcs_end), # choose the list start-end for filtering

get Lav's and check the sections for AGENT and TROOP to see the relevant operations.

arrows or bows
similar case. Items have a ID and types. You use that information to filter them and find if they belong to a list.


Now that I found time to edit the code, I came up with something like this:
  (0.9, 0, 0, [],
[     
        (set_fixed_point_multiplier, 1000),
        (try_for_agents, ":agent_no"),
        (agent_get_troop_id, ":troop_no", ":agent_no"),
    (this_or_next|is_between, ":troop_no", heroes_begin, heroes_end),
# (this_or_next|eq, ":troop_no", "trp_khergit_horse_archer"),
(this_or_next|eq, ":troop_no", "trp_khergit_veteran_horse_archer"),
        (this_or_next|eq, ":troop_no", "trp_khergit_lancer"),
        (this_or_next|eq, ":troop_no", "trp_khergit_heavy_lancer"),
# (this_or_next|eq, ":troop_no", "trp_rebellious_khergit_horse_archer"),
(this_or_next|eq, ":troop_no", "trp_rebellious_khergit_veteran_horse_archer"),
        (this_or_next|eq, ":troop_no", "trp_rebellious_khergit_heavy_horse_archer"),
        (this_or_next|eq, ":troop_no", "trp_rebellious_khergit_lancer"),
        (this_or_next|eq, ":troop_no", "trp_rebellious_khergit_heavy_lancer"),
        (this_or_next|eq, ":troop_no", "trp_barbarian_hardened_horse_archer"),
        (this_or_next|eq, ":troop_no", "trp_barbarian_khan"),
        (eq, ":troop_no", "trp_khergit_heavy_horse_archer"),
          # (agent_is_alive, ":agent_no"),
          # (agent_is_human, ":agent_no"),
          # (agent_is_non_player, ":agent_no"),
          # (neg|agent_slot_eq, ":agent_no", 1003, 1),
            (agent_get_horse, ":horse_no", ":agent_no"),
            (assign, ":melee_weapon", -1),
            (try_begin),
                (agent_slot_eq, ":agent_no", slot_agent_is_running_away, 0),
                (gt, ":horse_no", -1),
                (agent_get_team, ":team_no", ":agent_no"),
                (agent_get_division, ":class_no", ":agent_no"),
                (team_get_weapon_usage_order, ":weapon_usage_order", ":team_no", ":class_no"),
                (team_get_movement_order, ":movement_order", ":team_no", ":class_no"),
                (team_get_hold_fire_order, ":hold_fire", ":team_no", ":class_no"),
                (assign, ":thrown_ammo", 0),
                (assign, ":ranged_weapon", -1),
                (try_for_range, ":item", 0, 4),
                  (agent_get_item_slot, ":item_weapon", ":agent_no", ":item"),
                  (gt, ":item_weapon", 0),
                  (item_get_type, ":item_weapon_type", ":item_weapon"),
                  (try_begin),
                    (eq, ":item_weapon_type", itp_type_thrown),
                    (agent_get_ammo_for_slot, ":ammo_for_slot", ":agent_no", ":item"),
                    (val_add, ":thrown_ammo", ":ammo_for_slot"),
                  (else_try),
                  (this_or_next|eq, ":item_weapon_type", itp_type_musket),
                  (this_or_next|eq, ":item_weapon_type", itp_type_pistol),
                    (this_or_next|eq, ":item_weapon_type", itp_type_crossbow),  
                    (eq, ":item_weapon_type", itp_type_bow),
                    (assign, ":ranged_weapon", ":item_weapon"),
                  (else_try),
                    (this_or_next|eq, ":item_weapon_type", itp_type_one_handed_wpn),
                    (this_or_next|eq, ":item_weapon_type", itp_type_two_handed_wpn),
                    (eq, ":item_weapon_type", itp_type_polearm),
                    (assign, ":melee_weapon", ":item_weapon"),
                  (try_end),
                (try_end),
                (gt, ":ranged_weapon", -1),           
                (neg|item_has_property, ":ranged_weapon", itp_cant_reload_on_horseback),
                (neg|item_has_property, ":ranged_weapon", itp_cant_use_on_horseback),
                (agent_get_ammo, ":ammo", ":agent_no", 0),
                (val_sub, ":ammo", ":thrown_ammo"),
                (gt, ":ammo", 0),
                (agent_set_slot, ":agent_no", 1003, 2),
                (neg|eq, ":hold_fire", aordr_hold_your_fire),
                (neg|eq, ":weapon_usage_order", wordr_use_melee_weapons),
                (eq, ":movement_order", mordr_charge),
                (agent_get_position, pos50, ":agent_no"),
                (agent_get_speed, pos31, ":agent_no"),
                (position_get_y,":speed_y",pos31),
                (assign, ":distance_closest", 100000),#1000m
                (assign, ":enemies_closest", -1),
                (try_for_agents, ":enemies"),
                    (agent_is_alive, ":enemies"),
                    (agent_is_human, ":enemies"),
                    (agent_get_position, pos36, ":enemies"),
                    (agent_get_team, ":enemies_team", ":enemies"),
                    (teams_are_enemies, ":team_no", ":enemies_team"),
                    (get_distance_between_positions, ":distance", pos50, pos36),
                    (try_begin),
                      (agent_slot_eq, ":enemies", slot_agent_is_running_away, 1),
                      (val_add, ":distance", 10000),
                    (try_end),
                    (try_begin),
                      (agent_get_horse, ":enemies_horse", ":enemies"),
                      (gt, ":enemies_horse", -1),
                      (agent_get_speed, pos32, ":enemies"),
                      (position_get_y,":speed_y_enemies",pos32),
                      (val_sub, ":speed_y_enemies", ":speed_y"),
                      (store_div, ":distance_cavalry", ":speed_y_enemies",5),
                      (val_max, ":distance_cavalry", 0),
                      (val_add, ":distance_cavalry", 500),
                      (val_sub, ":distance", ":distance_cavalry"),
                    (else_try),
                      (agent_get_wielded_item, ":weapon_hold", ":enemies", 1),
                      (neg|gt, ":weapon_hold", 1),
                      (val_sub, ":distance", 500),
                    (try_end),
                    (lt, ":distance", ":distance_closest"),
                    (assign, ":distance_closest", ":distance"),
                    (assign, ":enemies_closest", ":enemies"),
                (try_end),
                (neq, ":enemies_closest", -1),
                (agent_get_position, pos51, ":enemies_closest"),
                (get_distance_between_positions, ":distance_true", pos50, pos51),
                (try_begin),
                  (agent_slot_eq, ":enemies_closest", slot_agent_is_running_away, 0),
                  (gt,":distance_true",200),
                  (agent_set_wielded_item, ":agent_no", ":ranged_weapon"),
                (else_try),
                  (le, ":distance_true", 200),
                  (gt, ":melee_weapon", -1),
                  (agent_set_wielded_item, ":agent_no", ":melee_weapon"),
                (try_end),
                (assign, ":speed_limit", 1000),
                (try_begin),
                    (agent_get_wielded_item, ":weapon_hold", ":agent_no", 0),
                    (gt, ":weapon_hold", 0),
                    (item_get_type, ":weapon_type", ":weapon_hold"),
                    (this_or_next|eq, ":weapon_type", itp_type_musket),
                    (this_or_next|eq, ":weapon_type", itp_type_pistol),
                    (this_or_next|eq, ":weapon_type", itp_type_crossbow),
                    (eq, ":weapon_type", itp_type_bow),
                    (agent_get_bone_position, pos53, ":agent_no", 8, 1),
                    (agent_get_bone_position, pos54, ":enemies_closest", 9, 1),
                    (position_has_line_of_sight_to_position, pos53, pos54),
                    (agent_set_look_target_agent, ":agent_no", ":enemies_closest"),
                    (try_begin),
                      (assign, ":shoot_distance", 4000),
                      (agent_get_attack_action, ":attack_action", ":agent_no"),
                      (eq, ":attack_action", 1),
                      (try_begin),
                        (gt, ":distance_closest", 700),
                        (le, ":distance_closest", ":shoot_distance"),
                        (store_div, ":speed_limit", ":speed_y",2000),#
                        (val_max, ":speed_limit", 0),
                      (try_end),
                      (eq, ":weapon_type", itp_type_bow),
                      (try_begin),
                        (le, ":distance_true", ":shoot_distance"),
                        (agent_set_defend_action, ":agent_no", -2, 1),
                        (agent_set_attack_action, ":agent_no", 3, 0),
                      (else_try),
                        (gt, ":distance_true", ":shoot_distance"),
                        (agent_set_attack_action, ":agent_no", -2, 1),
                        (agent_set_defend_action, ":agent_no", 3, 1),
                      (try_end),
                    (else_try),
                      (eq, ":weapon_type", itp_type_bow),
                      (le, ":distance_true", ":shoot_distance"),#
                      (agent_get_combat_state, ":combat_state", ":agent_no"),
                      (neq, ":combat_state", :cool:,
                      (agent_set_attack_action, ":agent_no", 3, 1),
                    (try_end),
                (try_end),
                (agent_set_speed_limit, ":agent_no", ":speed_limit"),
                (try_begin),
                  (agent_slot_eq, ":enemies_closest", slot_agent_is_running_away, 0),
                  (lt, ":distance_closest", 10000),
                  (try_begin),
                    (get_scene_boundaries, pos2, pos3),
                    (position_transform_position_to_local, pos4, pos2,pos50),
                    (position_get_x, ":left", pos4),
                    (position_get_y, ":down", pos4),
                    (position_transform_position_to_local, pos4, pos2,pos3),
                    (position_get_x, ":map_width", pos4),
                    (position_get_y, ":map_height", pos4),
                    (store_sub, ":right", ":map_width", ":left"),
                    (store_sub, ":up", ":map_height", ":down"),
                    (position_transform_position_to_local, pos4, pos50, pos51),
                    (position_get_x, ":enemies_x", pos4),
                    (position_get_y, ":enemies_y", pos4),
                    (assign, ":effect", 0),
                    (try_begin),
                      (neg|gt, ":distance_closest", 1000),
                      (assign, ":effect", -78000),
                    (else_try),
                      (gt, ":distance_closest", 2000),#
                      (store_sub,":effect", ":distance_closest", 0),
                      (val_mul, ":effect", 5),
                      (val_clamp, ":effect", 35000, 90000),
                    (try_end),
                    (assign, ":distance_to_boundary", 30000),
                    (val_min, ":distance_to_boundary", ":left"),
                    (val_min, ":distance_to_boundary", ":up"),
                    (val_min, ":distance_to_boundary", ":right"),
                    (val_min, ":distance_to_boundary", ":down"),
                    (try_begin),
                      (lt, ":distance_to_boundary", 30000),
                      (agent_slot_eq, ":enemies_closest", slot_agent_is_running_away, 0),
                      (store_div, ":map_middle_x", ":map_width", 20),
                      (store_div, ":map_middle_y", ":map_height", 20),
                      (position_copy_origin, pos4, pos2),
                      (position_move_x, pos4, ":map_middle_x", 1),
                      (position_move_y, pos4, ":map_middle_y", 1),
                      (get_distance_between_positions,":distance_middle", pos4, pos50),
                      (position_transform_position_to_local, pos4, pos50, pos4),
                      (position_get_x, ":map_middle_x", pos4),
                      (position_get_y, ":map_middle_y", pos4),
                      (val_mul, ":map_middle_x", 100),
                      (val_mul, ":map_middle_y", 100),
                      (val_mul, ":enemies_x", 100),
                      (val_mul, ":enemies_y", 100),
                      (store_div,":cos_middle",":map_middle_x",":distance_middle"),
                      (store_div,":sin_middle",":map_middle_y",":distance_middle"),
                      (store_div,":cos_enemies",":enemies_x",":distance_true"),
                      (store_div,":sin_enemies",":enemies_y",":distance_true"),
                      (store_acos, ":angle_cos", ":cos_middle"),
                      (store_asin, ":angle_sin", ":sin_middle"),
                      (store_acos, ":angle_cos_enemies", ":cos_enemies"),
                      (store_asin, ":angle_sin_enemies", ":sin_enemies"),
                      (try_begin),
                        (lt, ":angle_sin", 0),
                        (val_mul,":angle_cos", -1),
                        (val_add,":angle_cos", 360000),
                      (try_end),
                      (try_begin),
                        (lt, ":angle_sin_enemies", 0),
                        (val_mul,":angle_cos_enemies", -1),
                        (val_add,":angle_cos_enemies", 360000),
                      (try_end),
                      (store_sub, ":k2", ":angle_cos", ":angle_cos_enemies"),
                      (val_sub, ":k2", 270000),
                      (val_sub, ":k2", ":effect"),
                      (store_add, ":effect", ":k2", ":effect"),
                      (try_begin),
                        (lt, ":angle_cos", ":angle_cos_enemies"),
                        (val_add, ":effect", 360000),
                      (try_end),
                      (val_clamp,":effect",-210000, 15000),
                      (agent_set_attack_action, ":agent_no", -2, 1),
                      (agent_set_defend_action, ":agent_no", 3, 1),
                    (try_end),
                    (store_cos, ":cos", ":effect"),
                    (store_sin, ":sin", ":effect"),
                    (store_mul, ":k_x1", ":cos", ":enemies_y",),
                    (store_mul, ":k_x2", ":sin", ":enemies_x",),
                    (store_mul, ":k_y1", ":sin", ":enemies_y",),
                    (store_mul, ":k_y2", ":cos", ":enemies_x",),
                    (store_add, ":move_x",":k_x1", ":k_x2"),
                    (store_sub, ":move_y",":k_y1", ":k_y2"),
                    (position_move_x, pos50, ":move_x", 0),
                    (position_move_y, pos50, ":move_y", 0),
                  (try_end),
                  (agent_set_scripted_destination, ":agent_no", pos50, 1),
                (else_try),
                  (agent_clear_scripted_mode, ":agent_no"),
                  (agent_force_rethink, ":agent_no"),
                (try_end),
            (else_try),
                (try_begin),
                  (agent_slot_eq, ":agent_no", 1003, 0),
                  (agent_set_slot, ":agent_no", 1003, 1),
                (else_try),
                  (agent_slot_eq, ":agent_no", 1003, 2),
                  (this_or_next|agent_slot_eq, ":agent_no", slot_agent_is_running_away, 1),
                  (this_or_next|lt, ":horse_no", 0),
                  (this_or_next|eq, ":ammo", 0),
                  (this_or_next|eq, ":hold_fire", aordr_hold_your_fire),
                  (this_or_next|eq, ":weapon_usage_order", wordr_use_melee_weapons),
                  (neq, ":movement_order", mordr_charge),
                  (agent_clear_scripted_mode, ":agent_no"),
                  (agent_set_speed_limit, ":agent_no", 100),
                  (agent_force_rethink, ":agent_no"),
                  (agent_set_slot, ":agent_no", 1003, 3),
                  (this_or_next|eq, ":hold_fire", aordr_hold_your_fire),
                  (eq, ":ammo", 0),
                  (gt, ":melee_weapon", -1),
                  (agent_set_wielded_item, ":agent_no", ":melee_weapon"),
                (try_end),
            (try_end),
        (try_end),
]),  

I basically just added the script to heroes and specific units.
And it seems to work just fine, just a bit stutters in bigger battles.
Do you have any suggestions to make it better?


Also now while testing my personal mod I came across a known native bug, the Butterlord(after looting village).
Do you have an idea how I can fix that?
 

bobross419

Sergeant
M&BWBWF&S
I'm following NPC99's mount icon tutorial [1] and running into issues when I attempt to transform some of the texture coords.  The scale and translate values provided don't provide textures for some of my submeshes.  This also happened when I did the first part of the tutorial, but I was able to click through the available options (.25 increments) and find the textures.  This hasn't been the case for a few of the sub-meshes when I scaled down the man textures to add the horse.  I'm trying to better understand what the Scale and Translate values are actually doing, so I can visualize where on the template a given set of values might be showing.  I've been reading some blender docs about UV mapping, and I understand the concept of the translation but not how the values in Morgh's modify the selection.  My google and TW searches have failed me.  All I've been able to find is a brief reference to this functionality in Morgh's update log [2].

I'm very new to the visual aspects of modding and wanting to put some dumb **** in the game for my kids entertainment, but I'm happy to read reference materials.  Can anyone either explain how these values work or point me in the direction of reference docs that will help me understand this piece?

Thanks!
Bob





[1]
NPC99 said:
2. Making a mounted map icon

[2] https://forums.taleworlds.com/index.php/topic,168044.msg5138756.html#msg5138756
 

kalarhan

Python Saint
Count
WBNWVCWF&S
bobross419 said:
in Morgh's modify the selection

download the modsys. Even if you dont want to use it for modding the explanations there will be helpful.

example
Code:
####################################################################################################################
#  Each map icon record contains the following fields:
#  1) Map icon id: used for referencing map icons in other files.
#     The prefix icon_ is automatically added before each map icon id.
#  2) Map icon flags. See header_map icons.py for a list of available flags
#  3) Mesh name.
#  4) Scale. 
#  5) Sound.
#  6) Offset x position for the flag icon.
#  7) Offset y position for the flag icon.
#  8) Offset z position for the flag icon.
####################################################################################################################
those values are then used to create the .txt file, so you can translate them back and forth and see what which one does.
 

bobross419

Sergeant
M&BWBWF&S
My apologies, I got my tooling confused.  My questions are about OpenBRF not Morgh's.  I'm having trouble figuring out what these numbers are actually doing to the texture selection.

Specifically this screen:
1XFj8dMxwl92u68Y1VD4_kAe4uLdnXWZA

https://drive.google.com/file/d/1XFj8dMxwl92u68Y1VD4_kAe4uLdnXWZA/view?usp=sharing
ver 0.0.74 --  (2 Feb 2012)   

2- A [Transform UV] tool, to scale/translate all UV coordrinates.

Useful for when you unify textures in one sheet
Point 2 The UV transform tool is similar to the XYZ roto-translate-transform tool, but works with UV coordiantes (and it lacks rotations, because I'm lazy and I didn't need them). This is useful, for example, when you put two or more sheet of texture together. All the meshes using it must adapt to use 1/4 of the texture space, and this is what this tool does for you (as usual, bulk edits are possible).

It's fully interactive, meaning that you preview the results while you do it, and can cancel if you skcrew up.

Another use is when the texture is flipped in the vertical direction (this happens all the times). The tool has a preset to flip it back (scales the V by -100% and transaltes it by 1, meaning that it flips it).
 

Apathos

Recruit
Simple man with a simple question

How do I get skeletons and meshes upscaled successfully to make a giant unit
I'm hitting this weird stopping block where I can make the giant mesh and all but skeletons refuse to successfully resize in blender and they end up just floating above the ground when I put them back in the module.

Also I keep getting an 'undocumented user' message that gives me trouble in blender which I suspect is relate.
 

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
Apathos said:
Simple man with a simple question

How do I get skeletons and meshes upscaled successfully to make a giant unit
I'm hitting this weird stopping block where I can make the giant mesh and all but skeletons refuse to successfully resize in blender and they end up just floating above the ground when I put them back in the module.

Also I keep getting an 'undocumented user' message that gives me trouble in blender which I suspect is relate.
Maybe this here is a help for you:
https://forums.taleworlds.com/index.php/topic,350708.0.html
 
Hi. How can I set "agent_set_speed_modifier" for the specific animation (for example - "reload_musket")? I need to make agents walk instead of running while reloading muskets, as they do in WFaS or Gekokujo. Thanks.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Barabashenko said:
Hi. How can I set "agent_set_speed_modifier" for the specific animation (for example - "reload_musket")? I need to make agents walk instead of running while reloading muskets, as they do in WFaS or Gekokujo. Thanks.

those are different things. The operation is used to control run speed, not the animation that is in use.

You can download the modsys from WFaS and see how they used the flags to control reload as well. It is public like Warband and Viking Conquest.
 
kalarhan said:
Barabashenko said:
Hi. How can I set "agent_set_speed_modifier" for the specific animation (for example - "reload_musket")? I need to make agents walk instead of running while reloading muskets, as they do in WFaS or Gekokujo. Thanks.

those are different things. The operation is used to control run speed, not the animation that is in use.

You can download the modsys from WFaS and see how they used the flags to control reload as well. It is public like Warband and Viking Conquest.

Already did that before posting my question here, but no luck. I have no idea which script responds for this function, I even thought that it's hardcoded, but Gekokujo has the same feature.
 
Status
Not open for further replies.
Top Bottom