Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Hello again fellow modders. I was happily adding massive amounts of items into my mod the past few days,but i ran into a problem. Some items are not showing when they're drawn. They're staying in they holster places but you can attack with... well oxygen. So basically the item is drawn and used but the game doest show that.
Screenie:
11js5.jpg


As you can see i have the weapon selected as shown in the left bottom corner,but it doest show in the hand,it stays in the holster

Thanks in advance
 
I've been tinkering with adding some more random trade goods to my modification, just to spice things up.

Did this:

module_scripts:

Code:
      (item_set_slot, "itm_market_lemon_basket", slot_item_urban_demand, 12),
      (item_set_slot, "itm_market_lemon_basket", slot_item_rural_demand, 1),
      (item_set_slot, "itm_market_lemon_basket", slot_item_desert_demand, -1),
      (item_set_slot, "itm_market_lemon_basket", slot_item_production_slot, slot_center_lemons),
      (item_set_slot, "itm_market_lemon_basket", slot_item_production_string, "str_lemons"),

Code:
(party_set_slot, "p_town_19", slot_center_lemons, 50),

Code:
        (else_try),
          (eq, ":cur_good", "itm_market_lemon_basket"),
          (party_get_slot, ":base_production", ":center_no", slot_center_lemons),
          (val_div, ":base_production", 120),

module_constants:

Code:
slot_center_lemons  = 234


But I get these two random occuring errors in-game:

OFE5Wzd.jpg

Seem to be tied to the way the products are multiplied(?). But I just copied the exact lines from the itm_raw_date_fruit part of the module, so I can't quite figure out why it's not working.
 
Why does this code not work?
Code:
[anyone, "dplmc_constable_upgrade_player_retainer",
[],
"Very well, here is their equipment, you can equip anything that your alchemist has crafted for you, I will take care of making all the equipment for them.", "dplmc_constable_equip_retainers_2",
[(set_player_troop,"trp_player_retainer"),(change_screen_loot, "trp_armory_player"),]],

[anyone, "dplmc_constable_equip_retainers_2",
[],
"Excellent, they will now use that equipment.", "dplmc_constable_pretalk",
[(set_player_troop,"trp_player"),]],
Code:
  ["player_retainer","Household Guardsman","Household Guardsmen",tf_unkillable|tf_unmoveable_in_party_window|tf_mounted|tf_guarantee_all,0,0,fac_kingdom_3,
   [itm_spear,itm_wooden_shield,itm_leather_jerkin,itm_leather_boots,itm_saddle_horse],
   def_attrib|level(21),wp_one_handed (100) | wp_two_handed (100) | wp_polearm (100) | wp_archery (100) | wp_crossbow (100) | wp_throwing (100),knows_riding_7|knows_power_draw_5|knows_ironflesh_3|knows_horse_archery_7|knows_power_throw_4|knows_power_strike_4|knows_shield_1,bandit_face1, bandit_face2],

  ["armory_player","Constable","Constable",tf_is_merchant,0,0,fac_kingdom_3,
   [itm_spear,itm_wooden_shield,itm_leather_jerkin,itm_leather_boots,itm_saddle_horse],
   def_attrib|level(21),wp_one_handed (100) | wp_two_handed (100) | wp_polearm (100) | wp_archery (100) | wp_crossbow (100) | wp_throwing (100),knows_riding_7|knows_power_draw_5|knows_ironflesh_3|knows_horse_archery_7|knows_power_throw_4|knows_power_strike_4|knows_shield_1,bandit_face1, bandit_face2],
It loots the correct troop but does not correctly set the player troop.
 
You need an intermediate dialog between where you change the player character and where you actually loot using that character, for example
Code:
  [anyone|plyr,"regular_member_talk", [
  (troop_slot_eq, "$g_talk_troop", slot_troop_upgrade_troop, -1),
  ], "Change your loadout", "customize_char_requested",[
  (call_script, "script_copy_inventory", "$g_talk_troop", "trp_find_item_cheat"),
  (troop_sort_inventory, "trp_find_item_cheat"),
  (try_for_range, ":item_slot", slot_troop_ek_item_0, slot_troop_ek_item_0 + ek_food),
    (store_sub, ":inventory_slot", ":item_slot", slot_troop_ek_item_0),
    (try_begin), #backup old slot
      (troop_get_inventory_slot, ":item", "trp_find_item_cheat", ":inventory_slot"),
      (gt, ":item", 0),
      (troop_get_inventory_slot_modifier, ":imod", "$g_talk_troop", ":inventory_slot"),
      (troop_add_item, "$g_talk_troop", ":item", ":imod"),
    (try_end),
    (troop_get_slot, ":item", "$g_talk_troop", ":item_slot"),
    (gt, ":item", 0),
    (val_add, ":item_slot", 10),
    (troop_get_inventory_slot_modifier, ":imod", "$g_talk_troop", ":item_slot"),
    #(val_sub, ":item_slot", slot_troop_ek_item_0 + 10),
    (assign, reg0, ":inventory_slot"),
    (str_store_item_name, s0, ":item"),
    (display_message, "@loading slot {reg0} with {s0}"),
    (troop_remove_item, "$g_talk_troop", ":item"), #prevent duplicate within inventory?
    (troop_set_inventory_slot, "$g_talk_troop", ":inventory_slot", ":item"),
    (troop_set_inventory_slot_modifier, "$g_talk_troop", ":inventory_slot", ":imod"),
  (else_try),
    (troop_set_inventory_slot, "$g_talk_troop", ":inventory_slot", -1),
  (try_end),

  ]],
  [anyone,"customize_char_requested", [], "Aye captain. Let me show you my moves.", "do_custom_member_view_char",[
  (set_player_troop, "$g_talk_troop"),
  (troop_clear_inventory, "trp_temp_troop"),
  #add placeholder items here
  # set slot as -1 ; use default spawned item 
  # set slot as 0 ; forced unequip item in slot
  (change_screen_loot, "trp_temp_troop"),
  ]],
  
  #restore inventory - some might be left on the other screen
  [anyone,"do_custom_member_view_char", [], "Is this to your satisfaction?", "custom_member_talk",[]],
  [anyone|plyr,"custom_member_talk", [], "Carry on, soldier.", "close_window",[(set_player_troop, "trp_player"),
  (try_for_range, ":item_slot", ek_item_0, ek_food),
    (troop_get_inventory_slot, ":item", "$g_talk_troop", ":item_slot"),
    (gt, ":item", 0),
    (troop_remove_item, "trp_find_item_cheat", ":item"),
    (troop_get_inventory_slot_modifier, ":imod", "$g_talk_troop", ":item_slot"),
    (val_add, ":item_slot", slot_troop_ek_item_0),
    (assign, reg0, ":item_slot"),
    (str_store_item_name, s0, ":item"),
    (display_message, "@setting slot {reg0} with {s0}"),
    (troop_set_slot, "$g_talk_troop", ":item_slot", ":item"),
    (val_add, ":item_slot", 10),
    (troop_set_slot, "$g_talk_troop", ":item_slot", ":imod"),
  (else_try),
    (val_add, ":item_slot", slot_troop_ek_item_0),
    (troop_set_slot, "$g_talk_troop", ":item_slot", -1),
    (val_add, ":item_slot", 10),
    (troop_set_slot, "$g_talk_troop", ":item_slot", -1),
  (try_end),
  #this should now be missing the items that were selected
  (troop_sort_inventory, "trp_find_item_cheat"),
  #disregard this, as players can discard items randomly
  (troop_clear_inventory, "$g_talk_troop"),
  (troop_get_inventory_capacity, ":inv_cap", "trp_find_item_cheat"),
  (try_for_range, ":item_slot", 0, ":inv_cap"),
    (troop_get_inventory_slot, ":item", "trp_find_item_cheat", ":item_slot"),
    (gt, ":item", 0),
    (troop_get_inventory_slot_modifier, ":imod", "trp_find_item_cheat", ":item_slot"),
    (troop_add_item, "$g_talk_troop", ":item", ":imod"),
  (try_end),
  (call_script, "script_inventory_parity_check", "$g_talk_troop"),
  (display_message, "@post-equip: {reg0}"),
  ]],
 
I was making a mission template,When i compiled,this is coming:

WVGbYE.png

The start of mission:

Code:
(
    "tutorial_fishing",0,-1,
    "fishing",
    [
    (0,mtef_visitor_source|mtef_leader_only,af_override_horse,0,1,[]),
    (2,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
    (10,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),
     ],
    [
      (ti_before_mission_start, 0, 0, [], [(assign,"$wind_power",2),(set_fixed_point_multiplier, 1),
         (set_shader_param_float, "@vWindAmount","$wind_power")]),
	  
      (ti_tab_pressed, 0, 0, [],
       [(display_message, "str_cannot_leave_now"),
	      ]),

Why it does that ?
 
Say, how do you change party behaviors after they can no longer finish their given command?

I spawned a leader party and minion parties. I ordered the minions to escort their good leader and they follow the leader just fine and dandy. The issue is that, when their leader dies, they will try to escort (accompany) the player!  :shock:

So, how do I change their behavior after their leader is dead?

Here is my code:
Code:
     (try_begin),
       (store_num_parties_of_template, ":num_parties", "pt_sea_raiders_warlord"),
       (lt,":num_parties",1),
       (store_random,":spawn_point",num_sea_raider_spawn_points),
       (val_add,":spawn_point","p_sea_raider_spawn_point_1"),
       (set_spawn_radius, 25),
       (spawn_around_party,":spawn_point","pt_sea_raiders_warlord"),
       (assign, ":warlordid", reg0),
     (else_try),
       (store_num_parties_of_template, ":num_parties", "pt_sea_raiders_warlord"),
       (ge,":num_parties",1),
       (store_num_parties_of_template, ":num_parties", "pt_sea_raiders_warband"),
       (lt,":num_parties",3),
       (spawn_around_party,":spawn_point","pt_sea_raiders_warband"),
       (assign, ":warbandid", reg0),
       (party_set_ai_behavior, ":warbandid", ai_bhvr_escort_party),
       (party_set_ai_object, ":warbandid", ":warlordid"),
     (try_end),

I tried messing around and added this to some effect. After the leader dies they will stop escorting stuff. However the problem is that they will go numb now. They will just sit and wait without doing anything a normal AI does, like patrolling :sad:

Code:
       (party_set_ai_behavior, ":warbandid", ai_bhvr_escort_party),
       (party_set_ai_object, ":warbandid", ":warlordid"),
       (party_set_flags, ":warbandid", pf_default_behavior, 0),

What I really wanted, was for them to retreat (or at least resume normal behavior) once the leader dies. You know retreating to their landing/lair or patrolling their spawn point. Maybe even escort their new leader again once he spawns, but I figure that, to do this, I would need to learn how search through parties and store them somewhere, before making a trigger to command them to do something... The retreating option sounds better anyway...
 
Hi!

I have problem with decapitation script. Script is working correctly, but I've message in game "Invalid agent id". How I can get rid of this message?

theoris_decapitation = (
    ti_on_agent_hit, 0, 0, [],
    [
      (store_trigger_param_1, ":agent"),
      (agent_is_human, ":agent"),
      (store_trigger_param_3, ":damage"),
      (ge, ":damage", 30), #strong blow
      (store_agent_hit_points, ":hp", ":agent", 1),
      (val_add, ":hp", 5),
      (ge, ":damage", ":hp"),
      (agent_get_position, pos1, ":agent"),
      (get_distance_between_positions, ":distance", pos1, pos0),
      (is_between, ":distance", 160, 176), # *zing*
      (agent_get_item_slot, ":item", ":agent", 4), #head slot
      (try_begin),
          (ge, ":item", 1),
        (agent_unequip_item, ":agent", ":item"),
      (try_end),
      (agent_equip_item, ":agent", "itm_invisible_head"),
      (particle_system_burst, "psys_game_blood_2", pos0, 125), #Yeah..
      (set_spawn_position, pos1),
      (spawn_scene_prop, "spr_physics_head"),
  ]) 
 
Is there any way to concatenate more than one trigger list in module_mission_templates, like the one in diplomacy?

For example, I've got two lists of triggers:

Code:
jacobhinds_trigger_list_1 = [
	trigger_1,
	trigger_2,
	trigger_3,
	]


dplmc_trigger_list_1 = [
	dplmc_trigger_1,
	dplmc_trigger_2,
	dplmc_trigger_3,
  ]

I want jacobhinds_trigger_list_1 to be in almost every mission, but dplmc_trigger_list_1 only goes in a few combat ones. However, this:

Code:
{consequences for mission template}
         ]
	+ dplmc_trigger_list_1,
	+ jacobhinds_trigger_list_1,

doesn't work, but neither does this:

Code:
jacobhinds_trigger_list_1 = [
	trigger_1,
	trigger_2,
	trigger_3,
	]


dplmc_trigger_list_1 = [
	dplmc_trigger_1,
	dplmc_trigger_2,
	dplmc_trigger_3,
	jacobhinds_trigger_list_1, 
  ]

with or without the comma. How would I be able to add both trigger lists to one template?
 
Hello, ran into a prblem while i was creating a race. The game crashed after getting into a dialogue with the troop or trying to look at it in the troop menu. No crash message though.

Module_Skins:
Code:
 (
    "troll", 0,
    "troll_body", "troll_feet", "troll_handL",
    "troll_head_c", troll_face_keys,
    [], #man_hair_meshes ,"man_hair_y5","man_hair_y8",
    [], #beard meshes ,"beard_q"
    ["hair_blonde"], #hair textures
    ["beard_blonde"], #beard_materials
    [("troll",0xffcbe0e0,["hair_blonde"],[0xffffffff, 0xffb04717, 0xff502a19])], #man_face_textures,
    [(voice_die,"snd_man_die"),(voice_hit,"snd_man_hit"),(voice_grunt,"snd_man_grunt"),(voice_grunt_long,"snd_man_grunt_long"),(voice_yell,"snd_man_yell"),(voice_stun,"snd_man_stun"),(voice_victory,"snd_man_victory")], #voice sounds
    "skel_human", 2.0,
    psys_game_blood,psys_game_blood_2,
    [[1.7, comp_greater_than, (1.0,face_width), (1.0,temple_width)], #constraints: ex: 1.7 > (face_width + temple_width)
     [0.3, comp_less_than, (1.0,face_width), (1.0,temple_width)],
     [1.7, comp_greater_than, (1.0,face_width), (1.0,face_depth)],
     [0.3, comp_less_than, (1.0,eyebrow_height), (1.0,eyebrow_position)],
     [1.7, comp_greater_than, (1.0,eyebrow_height), (1.0,eyebrow_position)],
     [-0.7, comp_less_than, (1.0,nose_size), (-1.0,nose_shape)],
     [0.7, comp_greater_than, (1.0,nose_size), (-1.0,nose_shape)],
     [2.7, comp_greater_than, (1.0,chin_size), (1.0,mouth_nose_distance), (1.0,nose_height), (-1.0,face_width)],
     ]
  ),
Keep in mind that i dont know what everything in here means so imay have left something out or something. I basically copied the undead skin and edited it

header_troops:

Code:
tf_male           = 0
tf_female         = 1
tf_undead         = 2
tf_troll		  = 3


module_troops and the troop itself:

Code:
troll_face1  = 0x00000000000000000000000000000000
troll_face2  = 0xffffffffffffffffffffffffffffffff

No idea how this work... Maybe the mistake is here

Code:
 ["troll", "Wild Troll", "Wild Trolls", tf_troll, no_scene, reserved, fac_outlaws, [itm_trolls_club], def_attrib|level(24), wp(100), knows_common|knows_athletics_5|knows_power_strike_7|knows_ironflesh_10, troll_face1, troll_face2 ],


Thanks for any help! :smile:





 
Adding in a couple of new companions to Mount and Blade Warband with Diplomacy 4.3, I'm noticing some weird results that I think are coming from module_scripts.py.  I'm not getting any errors when compiling the module, but I'm getting intermittent results in game that I think are a formatting issue in the scripts file.

I copied and pasted the scripts from another character and limited my changes to the commented out sections and the NPC references so there wasn't much room for error, I thought.

First, when testing out the new companion, after a battle the character conflict was directed at my character rather than the correct NPC.  I'm not getting the random text problem related to a failure to modify (store_mul, ":string_addition", ":slot_addition", 16), to the number of companions.  I rewrote the entire script from scratch and alleviated the issue on one of the new companions.  I largely avoided commenting anything out and adding spaces between scripts.

I was also having an issue where a script wouldn't fire.  As an example, for the companions interaction when passing a certain landmark.  However, I copied this again and left the commented section in place and it worked.

So, what I'm thinking is that somehow the spacing between the script lines isn't correct and that line is being ignored.  I don't see anything technically wrong with the code.  I can post it here later today but, like I said I'm not getting any errors.

Also, my module_scripts.py  file does not look like this:
        (troop_set_slot, "trp_npc16", slot_troop_morality_type, tmt_aristocratic), #klethi
        (troop_set_slot, "trp_npc16", slot_troop_morality_value, 4),
        (troop_set_slot, "trp_npc16", slot_troop_2ary_morality_type, tmt_humanitarian),
        (troop_set_slot, "trp_npc16", slot_troop_2ary_morality_value, -1),
        (troop_set_slot, "trp_npc16", slot_troop_personalityclash_object, "trp_npc15"), #klethi
        (troop_set_slot, "trp_npc16", slot_troop_personalityclash2_object, "trp_npc1"), #klethi - borcha
        (troop_set_slot, "trp_npc16", slot_troop_personalitymatch_object, "trp_npc7"),  #deshavi - klethi
        (troop_set_slot, "trp_npc16", slot_troop_home, "p_village_20"), #Uslum
        (troop_set_slot, "trp_npc16", slot_troop_payment_request, 200),
      (troop_set_slot, "trp_npc16", slot_troop_kingsupport_argument, argument_lords),
      (troop_set_slot, "trp_npc16", slot_troop_kingsupport_opponent, "trp_npc12"), #nizar
      (troop_set_slot, "trp_npc16", slot_troop_town_with_contacts, "p_town_9"), #khudan
      (troop_set_slot, "trp_npc16", slot_lord_reputation_type, lrep_roguish), #

Instead the text is lined up with each troop_set_slot script about eight spaces away from the next one in an inconsistent wrap-around format.

Sorry for the long post and thanks for the help.
 
@Masterancza are you sure that the trigger that you posted is causing the error? Because for me it doesn't look like that...

Here is the explanation:
First error: opcode 1704 - the operation is agent_is_human (also notice the line 9).
Second error: opcode 1710 - the operation is agent_get_position (also notice the line 10).
So the errors are produced in those two operations but notice the lines (9 and 10); the lines are consecutively, but in your trigger they are not one after another. So that leads me to think that there is another trigger that is producing those errors.
 
sozzys said:
Code:
troll_face1  = 0x00000000000000000000000000000000
troll_face2  = 0xffffffffffffffffffffffffffffffff

No idea how this work... Maybe the mistake is here

This might be the source of the errors. When you're starting a new race, add a new troop near the beginning of module_troops.py (but after the hardcoded ones). Then go to the "character" menu ingame and press "next" above the image of the player until you get to the new race troop. Clicking on the image and pressing ctrl-E will allow you to access the face code.
 
jacobhinds said:
sozzys said:
Code:
troll_face1  = 0x00000000000000000000000000000000
troll_face2  = 0xffffffffffffffffffffffffffffffff

No idea how this work... Maybe the mistake is here

This might be the source of the errors. When you're starting a new race, add a new troop near the beginning of module_troops.py (but after the hardcoded ones). Then go to the "character" menu ingame and press "next" above the image of the player until you get to the new race troop. Clicking on the image and pressing ctrl-E will allow you to access the face code.

it crashes when i select him, doesnt even show the troll, it just crashes..
 
Status
Not open for further replies.
Back
Top Bottom