Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I think this is where I ask short question right?

Some of the troops I have given spears as well as 1-handed weapons, but it seems they don't always spawn with the spears, as I don't see the spears on their backs that often even if that particular troop is only supposed to have 1 type of 1-handed weapon and spear. How can I make them always spawn with spears and another "secondary" weapon like a sword? I also seem to have this problem if a troop has 1-handed and two-handed weapons.
 
VC has a new tf_guarantee_polearm in their source code.
Code:
tf_guarantee_boots            = 0x00100000
tf_guarantee_armor            = 0x00200000
tf_guarantee_helmet           = 0x00400000
tf_guarantee_gloves           = 0x00800000
tf_guarantee_horse            = 0x01000000
tf_guarantee_shield           = 0x02000000
tf_guarantee_ranged           = 0x04000000
tf_guarantee_polearm          = 0x08000000
tf_unmoveable_in_party_window = 0x10000000
If it's equipped, it will show up.

=======================
My problem: No villages have cattle.
You can recruit them for campaigns, you can't raid them and you can't buy them from village elders or the townfolk.

They key constant is: slot_village_number_of_cattle.
I've compared my new edition with the old and all the relevant scripts and menus are unchanged.
The module constant number is unchanged.
The Last full version from May doesn't have this problem.
What could be going on?

What could be causing this behavior?
 
Is there any downside to adding to much meshes to one brf? For example, have all of your custom meshes and textures into one brf. Was asking necause I saw an OSP mod that did this, and this mod will not load for me. So i was wondering if the game can't handle it or something. Thanks ahead of time!
 
Is there any downside to adding to much meshes to one brf? For example, have all of your custom meshes and textures into one brf. Was asking necause I saw an OSP mod that did this, and this mod will not load for me. So i was wondering if the game can't handle it or something. Thanks ahead of time!

I guess it might clog up the brf if it has to much **** in it like any file. I hope not anyway, one brf file for my mod has a lot of armors plus the LODs for them. that brf file has like 80 something meshes and alot of textures so i think the limit must be pretty high if there is one to begin with

Anyway I noticed that in the materials configuration in openBRF (that little pop up window when you want to see all the bits) that there's an option for a material to have multiple frames (animated) i'm interested in how you would put the multiple frames in and what shader are you supposed to you use so it appears ingame?
 
Thanks @CutContent.

Off topic:
Just found found out about your mod...I must say: great work! Pretty cool how you have managed to go so far on M&B. I don't own M&B myself, but expect me to keep watch over your progress.

I can't even imagine what you could do with Warband :grin:
I wish i could help you, but I'm just learning how to use OpenBRF myself  :oops:
 
Please tell me where should i Exactly place these codes in Module_mission_templates to make an Invasion server:

(ti_before_mission_start, 0, 0, [],
      [
        (assign, "$wave_number", 0),
        (assign, "$wave_is_spawned", 0),
        (assign, "$wave_end_time", 0),
]),

(ti_on_agent_killed_or_wounded, 0, 0, [],
[
  (store_trigger_param_1, ":dead_agent_no"),
  (store_trigger_param_2, ":killer_agent_no"),
 
  (try_begin),
    (agent_is_human, ":dead_agent_no"),
    (assign, ":team1_living_players", 0),
    (assign, ":team2_living_players", 0),
    (try_for_agents, ":cur_agent"),
      (agent_is_human, ":cur_agent"),       
      (try_begin),
        (agent_is_alive, ":cur_agent"), 
        (agent_get_team, ":cur_agent_team", ":cur_agent"),
        (try_begin),
          (eq, ":cur_agent_team", 0),
            (val_add, ":team1_living_players", 1),
        (else_try),
          (eq, ":cur_agent_team", 1),
            (val_add, ":team2_living_players", 1),
        (try_end),
      (try_end),
    (try_end),       
    (try_begin),
      (eq, ":team2_living_players", 0),
      (eq, ":dead_agent_team", 1),
        (store_mission_timer_a, "$wave_end_time"),
        (assign, "$wave_is_spawned", 0),
    (try_end),
(try_end),
]),



(1, 0, 0, [
  (eq, "$wave_is_spawned", 0),
  (store_mission_timer_a, ":round_time"),
  (val_sub, ":round_time", "$wave_end_time"),
  (ge, ":round_time", 5),                        ### 5 means how many seconds needs to pass between waves to spawn
    (val_add, "$wave_number", 1),
],[
  (try_begin), ### choose our wave troop to spawn (this is only a simple way of choosing the troop (I would not recommend using this way))
    (eq, "$wave_number", 1),
      (assign, ":troop_to_spawn", "trp_hired_assassin"),
  (else_try),
    (eq, "$wave_number", 2),
      (assign, ":troop_to_spawn", "trp_sword_sister"),
  (else_try),
    (eq, "$wave_number", 3),
      (assign, ":troop_to_spawn", "trp_hired_blade"),
  (else_try),
      (assign, ":troop_to_spawn", "trp_belligerent_drunk"),
  (try_end),
 
  (assign, ":num_troops_to_spawn", 10),          ### if you want dificulty, then modify this value based on how many players are (count the players, then do whatever you want)
 
  (store_current_scene, ":cur_scene"),
  (modify_visitors_at_site, ":cur_scene"),
 
  (add_visitors_to_current_scene, 1, ":troop_to_spawn", ":num_troops_to_spawn", 1, 0),
                                                  ## the first 1 represents the entry point at which we will spawn the troops
                                                  ## the second 1 represents the team ( 0 - first team; 1 - second team)
                                                  ## the last 0 represents the player that will control the troops ( 0 is the server)
  (assign, "$wave_is_spawned", 1),
]),



these codes are for making an Invasion server but I don't know where should i place them in module_mission_template.py ?!
 
Tahagx said:
Please tell me where should i Exactly place these codes in Module_mission_templates to make an Invasion server:

guess you copied it from somewhere, like a OSP thread or tutorial. So add the link to the original and tell us what you know, and what is not working. It is very likely the original thread already has that information.
 
Those are the codes from Arch3r's invasion script, where he explains everything. The codes you pasted are just a part of the whole code and should go under a mission template.
 
Hi, noob here.

I've re-added undead into my personal mod. But the undead faces have white spots on the nose and jawline. So I'm not sure if I installed it right. I got the files and followed the instructions from the wiki:

http://mountandblade.wikia.com/wiki/Undead

I think I might be missing a .brf file for the face, if that's a thing. If I did install it correctly, is there a new "face" or head I can download that works better?
 
How is cur_scene_prop_set_tableau_material used? I ve added Cartread's Deployable Pavise Shield and I want it to happen to Native's tableau pavise shields. But i couldnt add banner mesh to them. The codes i ve tried:
1 -
module_scene_props.py (prop meshes are from PBOD)
  ("tab_shield_pavise_d",sokf_moveable|sokf_destructible,"tableau_shield_pavise_prop_1","bo_tableau_shield_pavise_prop_1", [
(ti_on_init_scene_prop,
    [  (cur_scene_prop_set_tableau_material, "tableau_pavise_shield_prop_1", "trp_player"),
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 100),
    ]),
...
...
the front of shield becomes always black
2 -
module_scene_props.py
  ("tab_shield_pavise_d",sokf_moveable|sokf_destructible,"tableau_shield_pavise_prop_1","bo_tableau_shield_pavise_prop_1", [
    #check_castle_door_use_trigger,

  (ti_on_init_scene_prop,
    [(store_trigger_param_1, ":instance_no"),
    (store_trigger_param_2, ":troop_no"),
    (call_script, "script_agent_troop_get_banner_mesh", ":instance_no", ":troop_no"),
    (cur_scene_prop_set_tableau_material, "tableau_pavise_shield_prop_1", ":troop_no"),
    (scene_prop_set_hit_points, ":instance_no", 100),
    ]),
...
...
I get SCRIPT ERROR ON OPCODE 1718: Invalid agent ID    at script agent_troop_get_banner_mesh and operation 1718 is agent_get_troop_id .
3 -
I created a new script:
    ("shield_prop_set_banner",
    [
      (store_script_param, ":tableau_no",1),
      (store_script_param, ":agent_no", 2),
      (store_script_param, ":troop_no", 3),
      (call_script, "script_agent_troop_get_banner_mesh", ":agent_no", ":troop_no"),
      (cur_scene_prop_set_tableau_material, ":tableau_no", reg0),
    ]),
and called it in module_scene_props.py:
  ("tab_shield_pavise_d",sokf_moveable|sokf_destructible,"tableau_shield_pavise_prop_1","bo_tableau_shield_pavise_prop_1", [
    #check_castle_door_use_trigger,

  (ti_on_init_scene_prop,
    [(store_trigger_param_1, ":instance_no"),
    (store_trigger_param_2, ":troop_no"),
(call_script, "script_shield_prop_set_banner", "tableau_pavise_shield_prop_1", ":instance_no", ":troop_no"),
    (scene_prop_set_hit_points, ":instance_no", 100),
    ]),
...
...
but again i got SCRIPT ERROR ON OPCODE 1718: Invalid agent ID    at script agent_troop_get_banner_mesh
How can i add banner mesh to that shield? (btw  AI will not use deploying shields, just for player is enough for me)

Edit: Its done
 
See my post from yesterday:
The cattle are in the villages:
Code:
DEBUG cattle initially at number 210
 DEBUG refreshed cattle number 220
 DEBUG cattle initially at number 60
 DEBUG refreshed cattle number 60
 DEBUG cattle initially at number 57
 DEBUG refreshed cattle number 57
 DEBUG cattle initially at number 20
 DEBUG refreshed cattle number 18
 DEBUG cattle initially at number 43
 DEBUG refreshed cattle number 45
 DEBUG cattle initially at number 30
 DEBUG refreshed cattle number 30
 DEBUG cattle initially at number 105
 DEBUG refreshed cattle number 110
 DEBUG cattle initially at number 76
However, when I ask to buy some, they are at 0.
I refresh them every 24 hours for testing.
Rgl_log: DEBUG cattle in village menu at number 0
Code:
("buy_cattle2", 0,
     "There are {reg5} heads of cattle, each for {reg6} scillingas. How many do "
     "you want to buy?", "none", [
        (set_background_mesh, "mesh_pic_cattle"),

        (party_get_slot, reg5, "$g_encountered_party", "slot_village_number_of_cattle"),
          #(party_get_slot, ":num_cattle", ":village_no", "slot_center_head_cattle"),
      #(assign, reg2, ":num_cattle"),
       (display_message, "@{!}DEBUG cattle in village menu at number {reg5}",0xFF0000),
        (gt, reg5, 0),
        (store_item_value, ":cattle_cost", "itm_cattle_meat"),
        (call_script, "script_game_get_item_buy_price_factor", "itm_cattle_meat"),
        (val_mul, ":cattle_cost", reg0),
        (val_div, ":cattle_cost", 50),  # Multiplied by 2 and divided by 100
        (assign, "$temp", ":cattle_cost"),
        (assign, reg6, ":cattle_cost"),
     ], [

        ("cattle_ok", [
            (party_get_slot, reg6, "$g_encountered_party", "slot_village_number_of_cattle"),

            (ge, reg6, 1),
            (display_message, "@{!}DEBUG cattle prepurchase no. is {reg6}"),
            (store_troop_gold, ":gold", "trp_player"),
            (ge, ":gold", "$temp"),
        ], "One.", [
            (call_script, "script_buy_cattle_from_village", "$g_encountered_party", 1, "$temp"),
        ]),

        ("cattle_ok2", [
            (party_get_slot, ":num_cattle", "$g_encountered_party", "slot_village_number_of_cattle"),
            (ge, ":num_cattle", 5),
            (store_troop_gold, ":gold", "trp_player"),
            (store_mul, ":cost", "$temp", 5),
            (ge, ":gold", ":cost"),
        ], "Five", [
            (call_script, "script_buy_cattle_from_village", "$g_encountered_party", 5, "$temp"),
        ]),

        ("cattle_ok3", [], "Forget it.", [
            (jump_to_menu,"mnu_village")
        ]),
    ]),

slot_village_number_of_cattle seems to be the culprit, but it is set up as it always has been in mconstants.
Any suggestions?
 
CutContent said:
How do you get a scene prop to move forever? I want to have spinning disks that spin forever
This is what Gotha has done for his Adimitools (WB MP), you could probably do something similar in M&B SP:
Code:
      (0, 0, 0, [(call_script, "script_cf_turn_windmill_fans", 0)], []),
Code:
  ("cf_turn_windmill_fans",
    [(store_script_param_1, ":instance_no"),
      (scene_prop_get_instance, ":windmill_fan_object", "spr_windmill_fan_turning", ":instance_no"),
      (ge, ":windmill_fan_object", 0),
      (prop_instance_get_position, pos1, ":windmill_fan_object"),
      (position_rotate_y, pos1, 10),
      (prop_instance_animate_to_position, ":windmill_fan_object", pos1, 100),
      (val_add, ":instance_no", 1),
      (call_script, "script_cf_turn_windmill_fans", ":instance_no"), 
 ]),
 
Is there anyone who ever seen "You shouldn't be reading this" menu bug. When i besiege a castle or town and win, this menu appears and i cannot close this. when i click 'Continue' it just gives me coins, nothing else happen. It may be about "total_victory" menu. i'm not sure(I ve never changed it by the way) :
  (
    "total_victory", 0,
    "You shouldn't be reading this... {s9}",
    "none",
    [
        # We exploit the menu condition system below.
        # The conditions should make sure that always another screen or menu is called.
        (assign, ":break", 0),
        (try_begin),
          (eq, "$routed_party_added", 0), #new
          (assign, "$routed_party_added", 1),

          #add new party to map (routed_warriors)
          (call_script, "script_add_routed_party"),
        (end_try),

(try_begin),
(check_quest_active, "qst_track_down_bandits"),
(neg|check_quest_succeeded, "qst_track_down_bandits"),
(neg|check_quest_failed, "qst_track_down_bandits"),

(quest_get_slot, ":quest_party", "qst_track_down_bandits", slot_quest_target_party),
(party_is_active, ":quest_party"),
(party_get_attached_to, ":quest_party_attached"),
(this_or_next|eq, ":quest_party", "$g_enemy_party"),
(eq, ":quest_party_attached", "$g_enemy_party"),
(call_script, "script_succeed_quest", "qst_track_down_bandits"),
(try_end),

(try_begin),
(gt, "$g_private_battle_with_troop", 0),
(troop_slot_eq, "$g_private_battle_with_troop", slot_troop_leaded_party, "$g_encountered_party"),
(assign, "$g_private_battle_with_troop", 0),
##diplomacy start+
#g_disable_condescending_comments is also used to track the "enhanced/diminished prejudice" setting
(try_begin),
(eq, "$g_disable_condescending_comments", 0),
(assign, "$g_disable_condescending_comments", 1),
(else_try),
(eq, "$g_disable_condescending_comments", 2),
(assign, "$g_disable_condescending_comments", 3),
##diplomacy end+
(try_end),
(try_end),

#new - begin
        (party_get_num_companion_stacks, ":num_stacks", "p_collective_enemy"),
        (try_for_range, ":i_stack", 0, ":num_stacks"),
          (party_stack_get_troop_id, ":stack_troop", "p_collective_enemy", ":i_stack"),
          (is_between, ":stack_troop", lords_begin, lords_end),
          (troop_is_wounded, ":stack_troop"),
          (party_add_members, "p_total_enemy_casualties", ":stack_troop", 1),
        (try_end),
        #new - end

        (try_begin),
          # Talk to ally leader
          (eq, "$thanked_by_ally_leader", 0),
          (assign, "$thanked_by_ally_leader", 1),

          (gt, "$g_ally_party", 0),
          #(store_add, ":total_str_without_player", "$g_starting_strength_ally_party", "$g_starting_strength_enemy_party"),

          (store_add, ":total_str_without_player", "$g_starting_strength_friends", "$g_starting_strength_enemy_party"),
          (val_sub, ":total_str_without_player", "$g_starting_strength_main_party"),

          (store_sub, ":ally_strength_without_player", "$g_starting_strength_friends", "$g_starting_strength_main_party"),

          (store_mul, ":ally_advantage", ":ally_strength_without_player", 100),
          (val_add, ":total_str_without_player", 1),
          (val_div, ":ally_advantage", ":total_str_without_player"),
          #Ally advantage=50  means battle was evenly matched

          (store_sub, ":enemy_advantage", 100, ":ally_advantage"),

          (store_mul, ":faction_reln_boost", ":enemy_advantage", "$g_starting_strength_enemy_party"),
          (val_div, ":faction_reln_boost", 3000),
          (val_min, ":faction_reln_boost", 4),

          (store_mul, "$g_relation_boost", ":enemy_advantage", ":enemy_advantage"),
          (val_div, "$g_relation_boost", 700),
          (val_clamp, "$g_relation_boost", 0, 20),

          (party_get_num_companion_stacks, ":num_ally_stacks", "$g_ally_party"),
          (gt, ":num_ally_stacks", 0),
          (store_faction_of_party, ":ally_faction","$g_ally_party"),
          (call_script, "script_change_player_relation_with_faction", ":ally_faction", ":faction_reln_boost"),
          (party_stack_get_troop_id, ":ally_leader", "$g_ally_party"),
          (party_stack_get_troop_dna, ":ally_leader_dna", "$g_ally_party", 0),
          (try_begin),
            (troop_is_hero, ":ally_leader"),
            (troop_get_slot, ":hero_relation", ":ally_leader", slot_troop_player_relation),
            (assign, ":rel_boost", "$g_relation_boost"),
            (try_begin),
              (lt, ":hero_relation", -5),
              (val_div, ":rel_boost", 3),
            (try_end),
            (call_script,"script_change_player_relation_with_troop", ":ally_leader", ":rel_boost"),
          (try_end),
          (assign, "$talk_context", tc_ally_thanks),
          (call_script, "script_setup_troop_meeting", ":ally_leader", ":ally_leader_dna"),
        (else_try),
          # Talk to enemy leaders
          (assign, ":break", 0),

          (party_get_num_companion_stacks, ":num_stacks", "p_total_enemy_casualties"), #p_encountered changed to total_enemy_casualties
          (try_for_range, ":stack_no", "$last_defeated_hero", ":num_stacks"), #May 31 bug note -- this now returns some heroes in victorious party as well as in the other party
            (eq, ":break", 0),
            (party_stack_get_troop_id, ":stack_troop", "p_total_enemy_casualties", ":stack_no"),
            (party_stack_get_troop_dna, ":stack_troop_dna", "p_total_enemy_casualties", ":stack_no"),

            (troop_is_hero, ":stack_troop"),

            (store_troop_faction, ":defeated_faction", ":stack_troop"),
            #steve post 0912 changes begin - removed, this is duplicated elsewhere in game menus
            #(call_script, "script_add_log_entry", logent_lord_defeated_by_player, "trp_player",  -1, ":stack_troop", ":defeated_faction"),
            (try_begin),
    (store_relation, ":relation", ":defeated_faction", "fac_player_faction"),
  (ge, ":relation", 0),
  (str_store_troop_name, s4, ":stack_troop"),

  (try_begin),
(eq, "$cheat_mode", 1),
(display_message, "@{!}{s4} skipped in p_total_enemy_casualties capture queue because is friendly"),
  (try_end),
(else_try),
              (try_begin),
                (party_stack_get_troop_id, ":party_leader", "$g_encountered_party", 0),
                (is_between, ":party_leader", active_npcs_begin, active_npcs_end),
                (troop_slot_eq, ":party_leader", slot_troop_occupation, slto_kingdom_hero),
                (store_sub, ":kingdom_hero_id", ":party_leader", active_npcs_begin),
                (get_achievement_stat, ":was_he_defeated_player_before", ACHIEVEMENT_BARON_GOT_BACK, ":kingdom_hero_id"),
                (eq, ":was_he_defeated_player_before", 1),

                (unlock_achievement, ACHIEVEMENT_BARON_GOT_BACK),
              (try_end),

              (store_add, "$last_defeated_hero", ":stack_no", 1),
              (call_script, "script_remove_troop_from_prison", ":stack_troop"),
              (troop_set_slot, ":stack_troop", slot_troop_leaded_party, -1),

              (call_script, "script_cf_check_hero_can_escape_from_player", ":stack_troop"),

              (str_store_troop_name, s1, ":stack_troop"),
              (str_store_faction_name, s3, ":defeated_faction"),
              (str_store_string, s17, "@{s1} of {s3} managed to escape."),
              (display_log_message, "@{!}{s17}"),
              (jump_to_menu, "mnu_enemy_slipped_away"),
              (assign, ":break", 1),
(else_try),
              (store_add, "$last_defeated_hero", ":stack_no", 1),
              (call_script, "script_remove_troop_from_prison", ":stack_troop"),
              (troop_set_slot, ":stack_troop", slot_troop_leaded_party, -1),

              (assign, "$talk_context", tc_hero_defeated),

              (call_script, "script_setup_troop_meeting", ":stack_troop", ":stack_troop_dna"),
              (assign, ":break", 1),
            (try_end),
          (try_end),

          (eq, ":break", 1),
        (else_try),
          # Talk to freed heroes
          (assign, ":break", 0),
          (party_get_num_prisoner_stacks, ":num_prisoner_stacks", "p_collective_enemy"),
          (try_for_range, ":stack_no", "$last_freed_hero", ":num_prisoner_stacks"),
            (eq, ":break", 0),
            (party_prisoner_stack_get_troop_id, ":stack_troop", "p_collective_enemy", ":stack_no"),
            (troop_is_hero, ":stack_troop"),
            (party_prisoner_stack_get_troop_dna, ":stack_troop_dna", "p_collective_enemy", ":stack_no"),
            (store_add, "$last_freed_hero", ":stack_no", 1),
            (assign, "$talk_context", tc_hero_freed),
            (call_script, "script_setup_troop_meeting", ":stack_troop", ":stack_troop_dna"),
            (assign, ":break", 1),
          (try_end),
          (eq, ":break", 1),
        (else_try),
          (eq, "$capture_screen_shown", 0),
          (assign, "$capture_screen_shown", 1),
          (party_clear, "p_temp_party"),
          (assign, "$g_move_heroes", 0),
          #(call_script, "script_party_prisoners_add_party_companions", "p_temp_party", "p_collective_enemy"),

          #p_total_enemy_casualties deki yarali askerler p_temp_party'e prisoner olarak eklenecek.
          (call_script, "script_party_add_wounded_members_as_prisoners", "p_temp_party", "p_total_enemy_casualties"),

          (call_script, "script_party_add_party_prisoners", "p_temp_party", "p_collective_enemy"),
          (try_begin),
            (call_script, "script_party_calculate_strength", "p_collective_friends_backup",0),
            (assign,":total_initial_strength", reg(0)),
            (gt, ":total_initial_strength", 0),
            #(gt, "$g_ally_party", 0),
            (call_script, "script_party_calculate_strength", "p_main_party_backup",0),
            (assign,":player_party_initial_strength", reg(0)),
            # move ally_party_initial_strength/(player_party_initial_strength + ally_party_initial_strength) prisoners to ally party.
            # First we collect the share of prisoners of the ally party and distribute those among the allies.
            (store_sub, ":ally_party_initial_strength", ":total_initial_strength", ":player_party_initial_strength"),

            #(call_script, "script_party_calculate_strength", "p_ally_party_backup"),
            #(assign,":ally_party_initial_strength", reg(0)),
            #(store_add, ":total_initial_strength", ":player_party_initial_strength", ":ally_party_initial_strength"),
            (store_mul, ":ally_share", ":ally_party_initial_strength", 1000),
            (val_div, ":ally_share", ":total_initial_strength"),
            (assign, "$pin_number", ":ally_share"), #we send this as a parameter to the script.
            (party_clear, "p_temp_party_2"),
            (call_script, "script_move_members_with_ratio", "p_temp_party", "p_temp_party_2"),

            #TODO: This doesn't handle prisoners if our allies joined battle after us.
            (try_begin),
              (gt, "$g_ally_party", 0),
              (distribute_party_among_party_group, "p_temp_party_2", "$g_ally_party"),
            (try_end),
            #next if there's anything left, we'll open up the party exchange screen and offer them to the player.
          (try_end),
          (party_get_num_companions, ":num_rescued_prisoners", "p_temp_party"),
          (party_get_num_prisoners,  ":num_captured_enemies", "p_temp_party"),

          (store_add, ":total_capture_size", ":num_rescued_prisoners", ":num_captured_enemies"),

          (gt, ":total_capture_size", 0),
          (change_screen_exchange_with_party, "p_temp_party"),
        (else_try),
          (eq, "$loot_screen_shown", 0),
          (assign, "$loot_screen_shown", 1),
#          (try_begin),
#            (gt, "$g_ally_party", 0),
#            (call_script, "script_party_add_party", "$g_ally_party", "p_temp_party"), #Add remaining prisoners to ally TODO: FIX it.
#          (else_try),
#            (party_get_num_attached_parties, ":num_quick_attachments", "p_main_party"),
#            (gt, ":num_quick_attachments", 0),
#            (party_get_attached_party_with_rank, ":helper_party", "p_main_party", 0),
#            (call_script, "script_party_add_party", ":helper_party", "p_temp_party"), #Add remaining prisoners to our reinforcements
#          (try_end),
          (troop_clear_inventory, "trp_temp_troop"),
          (call_script, "script_party_calculate_loot", "p_total_enemy_casualties"), #p_encountered_party_backup changed to total_enemy_casualties
          (gt, reg0, 0),
          (troop_sort_inventory, "trp_temp_troop"),
  ##diplomacy start+
  #Here: we jump to rubik's autoloot from CC if applicable instead of using the standard loot screen
  (try_begin),
(call_script, "script_cf_dplmc_player_party_meets_autoloot_conditions"),
(assign, "$dplmc_return_menu", "mnu_total_victory"),
            (jump_to_menu, "mnu_dplmc_manage_loot_pool"),
  (else_try),
#Old behavior:
(change_screen_loot, "trp_temp_troop"),
  (try_end),
  ##diplomacy end+
        (else_try),
          #finished all
          (try_begin),
            (le, "$g_ally_party", 0),
            (end_current_battle),
          (try_end),
          (call_script, "script_party_give_xp_and_gold", "p_total_enemy_casualties"), #p_encountered_party_backup changed to total_enemy_casualties
          (try_begin),
            (eq, "$g_enemy_party", 0),
            (display_message,"str_error_string"),
          (try_end),

  (try_begin),
    (party_is_active, "$g_ally_party"),
(call_script, "script_battle_political_consequences", "$g_enemy_party", "$g_ally_party"),
  (else_try),
(call_script, "script_battle_political_consequences", "$g_enemy_party", "p_main_party"),
  (try_end),

          (call_script, "script_event_player_defeated_enemy_party", "$g_enemy_party"),
          (call_script, "script_clear_party_group", "$g_enemy_party"),
          (try_begin),
            (eq, "$g_next_menu", -1),

            #NPC companion changes begin
            (call_script, "script_post_battle_personality_clash_check"),
            #NPC companion changes end

            #Post 0907 changes begin
            (party_stack_get_troop_id, ":enemy_leader", "p_encountered_party_backup",0),
            (try_begin),
              (is_between, ":enemy_leader", active_npcs_begin, active_npcs_end),
              (neg|is_between, "$g_encountered_party", centers_begin, centers_end),
              (store_troop_faction, ":enemy_leader_faction", ":enemy_leader"),

              (try_begin),
                (eq, "$g_ally_party", 0),
                (call_script, "script_add_log_entry", logent_lord_defeated_by_player, "trp_player",  -1, ":enemy_leader", ":enemy_leader_faction"),
                (try_begin),
                  (eq, "$cheat_mode", 1),
                  (display_message, "@{!}Victory comment. Player was alone"),
                (try_end),
              (else_try),
                (ge, "$g_strength_contribution_of_player", 40),
                (call_script, "script_add_log_entry", logent_lord_defeated_by_player, "trp_player",  -1, ":enemy_leader", ":enemy_leader_faction"),
                (try_begin),
                  (eq, "$cheat_mode", 1),
                  (display_message, "@{!}Ordinary victory comment. The player provided at least 40 percent forces."),
                (try_end),
              (else_try),
                (gt, "$g_starting_strength_enemy_party", 1000),
                (call_script, "script_get_closest_center", "p_main_party"),
                (assign, ":battle_of_where", reg0),
                (call_script, "script_add_log_entry", logent_player_participated_in_major_battle, "trp_player",  ":battle_of_where", -1, ":enemy_leader_faction"),
                (try_begin),
                  (eq, "$cheat_mode", 1),
                  (display_message, "@{!}Player participation comment. The enemy had at least 1k starting strength."),
                (try_end),
              (else_try),
                (eq, "$cheat_mode", 1),
                (display_message, "@{!}No victory comment. The battle was small, and the player provided less than 40 percent of allied strength"),
              (try_end),
            (try_end),
            #Post 0907 changes end
            (val_add, "$g_total_victories", 1),
            (leave_encounter),
            (change_screen_return),
          (else_try),
            (try_begin), #my kingdom
            ##diplomacy begin
              (eq, "$g_next_menu", "mnu_dplmc_town_riot_removed"),
              (jump_to_menu, "$g_next_menu"),
            (else_try),
            ##diplomacy end
              #(change_screen_return),
              (eq, "$g_next_menu", "mnu_castle_taken"),

              (call_script, "script_add_log_entry", logent_castle_captured_by_player, "trp_player", "$g_encountered_party", -1, "$g_encountered_party_faction"),
              (store_current_hours, ":hours"),
  (faction_set_slot, "$players_kingdom", slot_faction_ai_last_decisive_event, ":hours"),

              (try_begin), #player took a walled center while he is a vassal of npc kingdom.
    ##diplomacy start+ Handle player is co-ruler of NPC faction
(assign, ":is_coruler", 0),
                (is_between, "$players_kingdom", npc_kingdoms_begin, npc_kingdoms_end),
                (call_script, "script_dplmc_get_troop_standing_in_faction", "trp_player", "$players_kingdom"),
                (ge, reg0, DPLMC_FACTION_STANDING_LEADER_SPOUSE),
(assign, ":is_coruler", 1),

(assign, "$g_center_taken_by_player_faction", "$g_encountered_party"),
(faction_get_slot, ":faction_leader", "fac_player_supporters_faction", slot_faction_leader),
(try_begin),
(eq, ":faction_leader", "trp_player"),
(assign, ":faction_leader", heroes_end),
(try_for_range, ":troop_no", heroes_begin, ":faction_leader"),
(this_or_next|troop_slot_eq, slot_troop_spouse, "trp_player"),
(troop_slot_eq, "trp_player", slot_troop_spouse, ":troop_no"),
(neg|troop_slot_ge, ":faction_leader", slot_troop_prisoner_of_party, 0),#Not a prisoner
(neg|troop_slot_ge, ":faction_leader", slot_troop_occupation, slto_retirement),#Not retired, exiled, dead
(assign, ":faction_leader", ":troop_no"),#assign and break the loop
(try_end),
(try_end),

(is_between, ":faction_leader", heroes_begin, heroes_end),#Not the player, and not a bogus value
(neg|troop_slot_ge, ":faction_leader", slot_troop_prisoner_of_party, 0),#Not a prisoner
(neg|troop_slot_ge, ":faction_leader", slot_troop_occupation, slto_retirement),#Not retired, exiled, dead

(change_screen_return),
(start_map_conversation, ":faction_leader", -1),
  (else_try),
  #player took a walled center while he is a vassal of npc kingdom.
    (neq, ":is_coruler", 1),
  ##diplomacy end+
                (is_between, "$players_kingdom", npc_kingdoms_begin, npc_kingdoms_end),
                (jump_to_menu, "$g_next_menu"),
              (else_try), #player took a walled center while he is a vassal of rebels.
                (eq, "$players_kingdom", "fac_player_supporters_faction"),
                (assign, "$g_center_taken_by_player_faction", "$g_encountered_party"),
                (neg|faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
                (faction_get_slot, ":faction_leader", "fac_player_supporters_faction", slot_faction_leader),
                (change_screen_return),
                (start_map_conversation, ":faction_leader", -1),
              (else_try), #player took a walled center for player's kingdom
    ##diplomacy start+ Handle player is co-ruler of faction
(this_or_next|eq, ":is_coruler", 1),
##diplomacy end+
                (neg|is_between, "$players_kingdom", npc_kingdoms_begin, npc_kingdoms_end),
                (assign, "$g_center_taken_by_player_faction", "$g_encountered_party"),
                (assign, "$talk_context", tc_give_center_to_fief),
                (change_screen_return),

                (assign, ":best_troop", "trp_swadian_sharpshooter"),
##diplomacy start+
#Trivial aesthetic change, change the default troop to be appropriate to the
#culture of the player kingdom (instead of defaulting always to a Swadian troop).
(assign, ":players_culture", "$players_kingdom"),
(try_begin),
#If not the co-ruler of an NPC kingdom, use the player faction culture.
  (neg|is_between, "$players_kingdom", npc_kingdoms_begin, npc_kingdoms_end),
  (assign, ":best_troop", "trp_mercenary_crossbowman"),#<- while we're at it, use a mercenary default
  (assign, ":players_culture", "$g_player_culture"),
  (this_or_next|is_between, ":players_culture", npc_kingdoms_begin, npc_kingdoms_end),
(is_between, ":players_culture", cultures_begin, cultures_end),
(else_try),
#If not the co-ruler of an NPC kingdom, and there wasn't a valid player faction
#culture, try to use the faction of the player's court.
(neg|is_between, "$players_kingdom", npc_kingdoms_begin, npc_kingdoms_end),
(is_between, "$g_player_court", centers_begin, centers_end),
(party_slot_ge, "$g_player_court", slot_center_original_faction, 1),
(party_get_slot, ":players_culture", "$g_player_court", slot_center_original_faction),
(try_end),
(try_begin),
#Resolve from kingdom to culture if necessary
  (is_between, ":players_culture", kingdoms_begin, kingdoms_end),
  (faction_get_slot, ":players_culture", ":players_culture", slot_faction_culture),
(try_end),
(try_begin),
#If the final result is a culture, get the best troop if valid
  (is_between, ":players_culture", cultures_begin, cultures_end),
  (neq, ":players_culture", "fac_culture_1"),
  (faction_get_slot, reg0, ":players_culture", slot_faction_guard_troop),
  (ge, reg0, soldiers_begin),
  (assign, ":best_troop", reg0),
(try_end),
##diplomacy end+
                (assign, ":maximum_troop_score", 0),

                (party_get_num_companion_stacks, ":num_stacks", "p_main_party"),
                (try_for_range, ":stack_no", 0, ":num_stacks"),
                  (party_stack_get_troop_id, ":stack_troop", "p_main_party", ":stack_no"),
                  (neq, ":stack_troop", "trp_player"),

                  (party_stack_get_size, ":stack_size", "p_main_party", ":stack_no"),
                  (party_stack_get_num_wounded, ":num_wounded", "p_main_party", ":stack_no"),
                  (troop_get_slot, ":num_routed", "p_main_party", slot_troop_player_routed_agents),

                  (assign, ":continue", 0),
                  (try_begin),
                    (neg|troop_is_hero, ":stack_troop"),
                    (store_add, ":agents_which_cannot_speak", ":num_wounded", ":num_routed"),
                    (gt, ":stack_size", ":agents_which_cannot_speak"),
                    (assign, ":continue", 1),
                  (else_try),
                    (troop_is_hero, ":stack_troop"),
                    (neg|troop_is_wounded, ":stack_troop"),
                    (assign, ":continue", 1),
                  (try_end),
                  (eq, ":continue", 1),

                  (try_begin),
                    (troop_is_hero, ":stack_troop"),
                    (troop_get_slot, ":troop_renown", ":stack_troop", slot_troop_renown),
                    (store_mul, ":troop_score", ":troop_renown", 100),
                    (val_add, ":troop_score", 1000),
                  (else_try),
                    (store_character_level, ":troop_level", ":stack_troop"),
                    (assign, ":troop_score", ":troop_level"),
                  (try_end),

                  (try_begin),
                    (gt, ":troop_score", ":maximum_troop_score"),
                    (assign, ":maximum_troop_score", ":troop_score"),
                    (assign, ":best_troop", ":stack_troop"),
                    (party_stack_get_troop_dna, ":best_troop_dna", "p_main_party", ":stack_no"),
                  (try_end),
                (try_end),

                (start_map_conversation, ":best_troop", ":best_troop_dna"),
              (try_end),
            (try_end),
          (try_end),
        (try_end),
      ],
    [
      ("continue",[],"Continue...",[]),
        ]
  ),
Is there anyone who knows the solution?
 
Hello,
Is it possible to make killable companions? (at least some of them)

I want to make a small mod with some companions and some soldiers that can lvl up, change armor, have some kind of story, but can also die... i guess if they coud die, then they shouldnt be able to become lord, but it would be ok as they would just be in player party as soldiers which you would miss if they die and not only see their death as number in causalities
 
dykjozo said:
Is it possible to make killable companions?

companions are just troops with the hero flag, some dialogs and a few triggers. Nothing hardcoded. You can do whatever you want.

For example you could have a system that a wounded companion dies after the battle, with some kind of report, and you remove it from the player's party and from the recruiting pool.
^ so very little to change on the game code per si



litdum said:
Is there anyone who knows the solution?

Debug your code to see which flags are incorrect
:arrow: https://forums.taleworlds.com/index.php/topic,347990.msg8335287.html#msg8335287
 
Hello, everyone!

Lately I've seen a couple of OSPs in which there were several items that had different color but were based on the same textures.
it's not the material RGB setting, neither multiple item textures placed on 1 texture file, it's the meshes.
Like the texture is light brown, there is only 1 material file, but 1 mesh looks light brown and the other looks dark brown.

I tried googling something like "mesh color filter" in Russian and English, but it gave me nothing.
So can someone tell me what this "setting" is called?
Or even give me a screenshot of where it is located in Blender or some other program, if it doesn't take you long?

Thanks in advance!
 
Sounds like vertex painting maybe? There should be a mode for it in blender (where you select object/edit/etc). Though after painting it didn't show up in OpenBRF for me, never got round to figuring out the problem.

If you just want to recolour the whole object there should be an option in OpenBRF, tune colour HSB or something.
 
Status
Not open for further replies.
Back
Top Bottom