Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
PitchPL said:
Anyone know how I can edit "zoom" on shift multiplier?

If you are talking about the spyglass on NW

Code:
  ("spyglass_dummy", prsntf_read_only|prsntf_manual_end_only, 0,
   [
    (ti_on_presentation_load,
      [
          (call_script,"script_client_get_my_agent"),
          (assign,":agent_id",reg0),
          (agent_is_active,":agent_id"),
          (agent_is_alive,":agent_id"),
          (agent_set_visibility, ":agent_id", 0),
          (set_fixed_point_multiplier,100),
          (set_zoom_amount,165),
          
          (create_mesh_overlay, reg0, "mesh_mm_spyglass_ui"),
          (position_set_x, pos1, 50), #-1
          (position_set_y, pos1, 40), #-1
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 101), #-1
          (position_set_y, pos1, 100), #-1
          (overlay_set_size, reg0, pos1),
          
          (try_begin),
            (game_in_multiplayer_mode),
            (multiplayer_send_2_int_to_server,multiplayer_event_send_player_action,player_action_spyglass,spyglass_type_start),
          (else_try),
            (call_script, "script_multiplayer_server_agent_use_spyglass", ":agent_id", spyglass_type_start),
          (try_end),
          (presentation_set_duration, 999999),
      ]),

see operation set_zoom_amount

you can, of course, use it on other modules (not just NW)
 
kalarhan said:
PitchPL said:
Anyone know how I can edit "zoom" on shift multiplier?

If you are talking about the spyglass on NW

Code:
  ("spyglass_dummy", prsntf_read_only|prsntf_manual_end_only, 0,
   [
    (ti_on_presentation_load,
      [
          (call_script,"script_client_get_my_agent"),
          (assign,":agent_id",reg0),
          (agent_is_active,":agent_id"),
          (agent_is_alive,":agent_id"),
          (agent_set_visibility, ":agent_id", 0),
          (set_fixed_point_multiplier,100),
          (set_zoom_amount,165),
          
          (create_mesh_overlay, reg0, "mesh_mm_spyglass_ui"),
          (position_set_x, pos1, 50), #-1
          (position_set_y, pos1, 40), #-1
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 101), #-1
          (position_set_y, pos1, 100), #-1
          (overlay_set_size, reg0, pos1),
          
          (try_begin),
            (game_in_multiplayer_mode),
            (multiplayer_send_2_int_to_server,multiplayer_event_send_player_action,player_action_spyglass,spyglass_type_start),
          (else_try),
            (call_script, "script_multiplayer_server_agent_use_spyglass", ":agent_id", spyglass_type_start),
          (try_end),
          (presentation_set_duration, 999999),
      ]),

see operation set_zoom_amount

you can, of course, use it on other modules (not just NW)


hmm  I try this and do suceed.


Look at this please


https://pastebin.com/KXNq8NDm



https://pastebin.com/jp5Nujs9



Result


0W17Lnk.png
 
Is there a way to control the camera on the world/campaign map? I’m interested in being able to force the camera to follow the player’s icon at head height despite the presence of mountain peaks in adjacent polys. The camera height is forced up by neighbouring mountains (to avoid clipping or mesh penetration?).

Why do I want to do this? I’d like to have the player experience mountain tunnels on a campaign map without resorting to scenes. The tunnels would be map icons for visuals, but would remain paths that AI parities could traverse (i.e. must work with AI pathing).

I’d be grateful for any suggestions.
 
kalarhan said:
PitchPL said:

update your game. Those operations are from version 1.153, so you are playing a very very old Warband. Warband is now 1.173


mhm thanks .



Do you maybe remember this script/tut ?  https://forums.taleworlds.com/index.php/topic,299534.0.html

When I do same code , working database I got this in server logs after player joined.

https://pastebin.com/M62DqDqi


Some logs from httpd acces logs


https://pastebin.com/wcF9ZpkM



 
I'm hoping to get into scripting for the PW module. I don't want to create my own mods, just edit and create stuff specifically for multiplayer servers. I've never coded before, and I'm eager to learn. The big sticky seems targeted towards individuals making their own stand alone mods. And as such, I'm really not sure where to get started.
Any help would be greatly appreciated, thank you.
 
YourGuts said:
I've never coded before, and I'm eager to learn.

a submod is a submod, the coding is the same if you are creating a total conversion like PW or a tweaked version of it. It is the same MBScript (Mount Blade Scripting Language). So you can start with the basic tutorials, learn about MBScript, MP specific stuff, and go from there (ask and read about stuff as needed it)

https://forums.taleworlds.com/index.php/topic,56798.0.html
https://forums.taleworlds.com/index.php/topic,142422.0.html
https://forums.taleworlds.com/index.php/board,12.0.html

as you are doing MP only you can skip tutorials about SP features (like how to create a faction). But the base stuff (what is a troop, what is a agent, how to handle a variable, how to use a mission trigger, etc) is the same-ish (MP will need to handle the server-client coding too).
 
n9ImTYY.jpg


So I got an item to randomly change colour on spawn fairly easy with this.
Code:
[(ti_on_init_item,
		[(store_random_in_range,reg1,0,7),
		(cur_item_set_material,"@shirt_a_{reg1}SR", 0,)],
This is the material setup, just change the material names to match the item and it's an easy way to add variety.
shirt_a_0SR, = Neutral
shirt_a_1SR, = light
shirt_a_2SR, = dark
shirt_a_3SR, = red
shirt_a_4SR, = yellow
shirt_a_5SR, = green
shirt_a_6SR, = blue

So I know how to give a specific modifier in troops

IG8Kp0b.jpg


So if the item has the modifier imod_large_bag it chooses material 7 which is blue.

I just don't know how to check what modifier is active on the item.

And if I could make modifiers that don't do anything except get checked therefore apply the material.
 
Hi every one
Can you help me, please?

I have an idea that I would like to concretize ...
When I ask a recruit "Customizable" to let me manage his equipment, there is a window that opens ...
She displays his inventory,  and on the right; an inventory where are stored various articles, hat, sickle, club etc.

What I would like is that instead of this inventory it is my inventory that appears!
History to make things worse, equip the guy according to what I have in my inventory!

In your opinion, is it feasible?


Thank you



1519459550442201776.jpg


  # Custom Troops Scripts Begin

("copy_inventory", [
# 1-1 copy of all inventory details
(store_script_param_1, ":source"),
(store_script_param_2, ":dest"),

(troop_clear_inventory, ":dest"),

(troop_get_inventory_capacity, ":inv_cap", ":source"),
(try_for_range, ":i_slot", 0, ":inv_cap"),
(troop_get_inventory_slot, ":item", ":source", ":i_slot"),
(troop_set_inventory_slot, ":dest", ":i_slot", ":item"),
(troop_get_inventory_slot_modifier, ":imod", ":source", ":i_slot"),
(troop_set_inventory_slot_modifier, ":dest", ":i_slot", ":imod"),
(try_begin),
(is_between, ":item", food_begin, food_end),
(troop_inventory_slot_get_item_amount, ":amt", ":source", ":i_slot"),
(troop_inventory_slot_set_item_amount, ":dest", ":i_slot", ":amt"),
(try_end),
(try_end),
]),

("start_customizing", [
(store_script_param_1, ":troop"),

(store_skill_level, "$g_player_inventory_management", skl_inventory_management, "trp_player"),
(store_sub, ":skill_raise", 10, "$g_player_inventory_management"),
(troop_raise_skill, "trp_player", skl_inventory_management, ":skill_raise"),
(call_script, "script_copy_inventory", "trp_player", "trp_inventory_backup"),
(call_script, "script_unequip_troop", ":troop"),
(store_add, ":selection_troop", 2, ":troop"),
(call_script, "script_copy_inventory", ":selection_troop", "trp_player"),
(change_screen_loot, ":troop"),
]),

("finish_customizing", [
(store_script_param_1, ":troop"),

(store_sub, ":skill_raise", "$g_player_inventory_management", 10),
(troop_raise_skill, "trp_player", skl_inventory_management, ":skill_raise"),
(call_script, "script_copy_inventory", "trp_inventory_backup", "trp_player"),
(call_script, "script_unequip_troop", ":troop"),
(store_add, ":bak_troop", 1, ":troop"),
(call_script, "script_copy_inventory", ":troop", ":bak_troop"),
(troop_equip_items, ":troop"),
]),

("unequip_troop", [
(store_script_param_1, ":troop"),
(try_for_range, ":i_slot", 0, 10),
(troop_get_inventory_slot, ":item",":troop", ":i_slot"),
(gt, ":item", 0),
(troop_get_inventory_slot_modifier, ":imod",":troop", ":i_slot"),
(troop_set_inventory_slot, ":troop", ":i_slot", -1),
(troop_add_item, ":troop", ":item", ":imod"),
(try_end),
]),

("reload_custom_troops", [
(try_for_range, ":troop", customizable_troops_begin,  customizable_troops_end),
(neg|troop_is_hero, ":troop"),
(store_add, ":bak_troop", 1, ":troop"),
(call_script, "script_copy_inventory", ":bak_troop", ":troop"),
(troop_equip_items, ":troop"),
(try_end),
]),

# # This is just a script to recruit personal recruits from villages. Totally optional,
("village_recruit_volunteers_recruit_personal",
[(assign, ":volunteer_troop", "trp_custom_peasant"),
(party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
(party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
(val_min, ":volunteer_amount", ":free_capacity"),
(store_troop_gold, ":gold", "trp_player"),
(store_div, ":gold_capacity", ":gold", 20),#10 denars per man
  (val_min, ":volunteer_amount", ":gold_capacity"),
  (party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
  (party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
  (store_mul, ":cost", ":volunteer_amount", 20),#10 denars per man
  (troop_remove_gold, "trp_player", ":cost"),
]),

# Custom Troops End
 
 
ShaunRemo said:
I just don't know how to check what modifier is active on the item.

first: nice use of string builder to randomize the material

to check modifiers you have operations

Code:
item_has_modifier                   = 2725  # (item_has_modifier, <item_kind_no>, <item_modifier_no>),
                                            # Version 1.161+. Checks that the specified modifiers is valid for the item. See the list of imod_* values in header_item_modifiers.py.

remember that property, modifier, capability are different. See header_items.py for the list and the correct prefix like "imod_" to see which operations are valid.

the current imod of a item can be check with
Code:
(troop_get_inventory_slot_modifier, ":slot_item_imod", ":current_player_troop_id", ":wielded_item_slot"),
Code:
troop_get_inventory_slot_modifier        = 1542  # (troop_get_inventory_slot_modifier, <destination>, <troop_id>, <inventory_slot_no>),
                                                 # Retrieves the modifier value (see imod_* constants in header_items.py) for an item in the specified equipment or inventory slot. Returns 0 when there's nothing there, or if item does not have any modifiers.
t

you may also give a new item to the agent with a know modifier. Example: if you want to force the current sword to be imod_XXX, you can force him to remove the item and equip a new one (same item) but with the imod_XXX you wanted.

The trick part here is about [item] X [item instance]. The item is a generic thingy. So you can't check for a modifier (it has a list of valid modifiers). The [item instance] is the weapon used by one single agent, which is unique (unique ID), and thus has a modifier applied to it.
 
lolitablue said:
When I ask a recruit "Customizable" to let me manage his equipment, there is a window that opens ...

if the troop is a normal soldier (no hero flag like a lord or companion), then check your module.ini
Code:
dont_load_regular_troop_inventories = 1
this flag controls if soldiers should reset (reload) inventory

for the screen you need to check operations that control this menu, like "change_screen_equip_other". The trade ones are used to buy/sell (cost $$$). See header_operations.py.
 
kalarhan said:
lolitablue said:
When I ask a recruit "Customizable" to let me manage his equipment, there is a window that opens ...

if the troop is a normal soldier (no hero flag like a lord or companion), then check your module.ini
Code:
dont_load_regular_troop_inventories = 1
this flag controls if soldiers should reset (reload) inventory

for the screen you need to check operations that control this menu, like "change_screen_equip_other". The trade ones are used to buy/sell (cost $$$). See header_operations.py.

Thank you
 
Thank you kalarhan

My troop modifier assignment looks like this, borrowed VC proccess module troops to get that working.

Code:
imod_neutral = imod_champion
imod_light   = imod_fresh
imod_dark    = imod_day_old
imod_red     = imod_two_day_old
imod_yellow  = imod_smelling
imod_green   = imod_rotten
imod_blue    = imod_large_bag
(itm_linen_tunic,imod_blue),(itm_linen_tunic,imod_red),(itm_linen_tunic,imod_green),(itm_linen_tunic,imod_yellow),

The agent spawning will be given an instance of that item with a modifier, blue, red, green, or yellow.
the item instance gets checked when it's spawned, and I seemingly can't check the spawned item.

Code:
(troop_get_inventory_slot_modifier, <destination>, <troop_id>, <inventory_slot_no>),

This gets the troops modifier which is already set,

Code:
(item_has_modifier, <item_kind_no>, <item_modifier_no>),

This checks the item kinds modifier not the spawned item

Code:
(show_item_details_with_modifier, <item_id>, <item_modifier>, <position_no>, <price_multiplier>),

I'm looking into this code to see if I can get the modifier!

 
When an agent is spawned, the troop's inventory matches that of the spawned agent. So you would store that item's modifier from the ek_body slot into the agent slot, and then access it from the ti_on_item_init trigger. While you can access it directly (since the parameter provides both troop and agent) you may want to keep it in a slot anyway.
 
Yep so that works but if I give a troop two of the same item twice with different modifiers

Code:
(itm_linen_tunic,imod_blue),(itm_linen_tunic,imod_red),

The idea being the agents would be wearing one or the other but the check simply gets the first modifier in the inventory and they appear the same colour so for unique troops it works fine.
 
ShaunRemo said:
Code:
(show_item_details_with_modifier, <item_id>, <item_modifier>, <position_no>, <price_multiplier>),

that is used on presentations/menus, the tooltip of a item (just name or name + modifier)

a agent has 4 weapons (max), and one of those is equipped on hand (sword, two handed sword, bow, etc). You can force it to unequip that weapon, and give it a new one (with any modifier you want that new weapon to have). This way, you can replace [sword_XXX] with [master sword_XXX], and you know the modifier. Save that modifier on a agent slot, and you can get that modifier ID at any time in the mission.

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.
Code:
agent_set_wielded_item                   = 1747  # (agent_set_wielded_item, <agent_id>, <item_id>),
                                                 # Forces the agent to wield the specified item. Agent must have that item in his equipment for this to work. Use item_id = -1 to unwield any currently wielded item.
agent_equip_item                         = 1779  # (agent_equip_item, <agent_id>, <item_id>, [weapon_slot_no], [modifier]),
                                                 # Adds the specified item to agent and forces him to equip it. Optional weapon_slot_no parameter is only used with weapons and will put the newly added item to that slot (range 1..4) and with optional modifier. If it is omitted with a weapon item, then the agent must have an empty weapon slot for the operation to succeed.

there are many ways to solve a problem, that is just one quick suggestion
 
Someone know how to equip  plaer into armor via scene props?


I use this code for spawning horse or weapon:

Code:
siege_multi_items = (1,0,800,[(multiplayer_is_server)],[
      
      (try_for_range,":entry",90,100), 
         (entry_point_get_position,pos1,":entry"),
         (set_spawn_position,pos1),
         (spawn_horse,"itm_tank_horse",0),
      (end_try),
      
      (try_for_range,":entry",70,80), #para defensores
         (entry_point_get_position,pos1,":entry"),
         (set_spawn_position,pos1),
         (spawn_item,"itm_awesome_weapon",0),
      (end_try),      
      ])



Question 2 : Anyone have any idea how to spawn  troop/agent  on  multiplayer map where we can duell with that troop?
 
Status
Not open for further replies.
Back
Top Bottom