搜索结果: *

  1. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    kalarhan 说:
    this has being done on a few mods, including this OSP: http://forums.taleworlds.com/index.php/topic,323422.0.html

    How about instead of doing it over again, you start from that and include more features?

    (and Viking Conquest RE is also adding this idea)  :wink:

    I've got lots of ideas, including a new story-line! :grin:
    I just need more time and wish.

    An excellent OSP, btw. I may use some of its code for my mod. Thank you. :smile:

    When I use troop_raise_attribute and troop_raise_skill, the attribute and skill points raise automatically as well. How can I get rid  of this?
    And almost similar question. I want to make the player start from level 30. I add some xp to him to do this. But when I added 300000 xp, only 30000 were added. And here I also want to get rid of those attribute and skills points.
    Unfortunately I have not found such information on the forum.
    Maybe you know?
  2. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    kalarhan 说:
    Unless you want to make it a rare event. Otherwise the player will end up starting new fights without a lance and have those WTF moments hehe (forgot the lance, again!)

    Hmm. I have not thought about this. Perhaps I should make a more complicated code where the lance is replaced with the lance from inventory. You remember you told about masterwork and cracked lances), what if that last lance is the masterwork and the one that actually broke - cracked? :grin:

    No need, this is a open forum for learning how to mod. If you try to give credit for small things you will go crazy trying to keep the list updated  :mrgreen:
    Unless the OSP author requested credit of course  :wink:

    OK. Anyway thank you again. I began to believe in myself as a modder as I managed to complete this lance breaking script. :grin:

    Now I've a new task. I want to allow the player to become a king from the beginning of the game. Yet it does not come out, but I'm trying to follow the story line(it's code) of "False Dmitry the Third"(you become a king at the end). Maybe you have some ideas?
  3. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    kalarhan 说:
    vitali-attila 说:
    What do you think? Maybe I left something vital?

    whatever works  :smile:. I did a quick test after you first post, and your initial solution worked for me (remove items while inside the mission). I am using 1.167 btw. Both troop_remove_item and troop_set_inventory_slot are OK.

    You can solve a problem in many ways. Some will be more complicate than others, but you will learn how to get the easy solution with experience. In any case, your code is very well organized, that is already a huge step in the right direction.

    插入代码块:
    	(0, 0, 0, [
          	(key_clicked, key_k),
          	(display_message, "@removing gear", 0xff0000),     	      	
          	],
          [
          	(get_player_agent_no, ":player"),
          	(troop_get_inventory_slot, ":item", "trp_player", 0),
          	(agent_unequip_item, ":player", ":item", 0),
          	(troop_set_inventory_slot, "trp_player", 0, -1),
    
          	(troop_get_inventory_slot, ":item2", "trp_player", 1),     
          	(agent_unequip_item, ":player", ":item2", 1), 	
          	(troop_remove_item, "trp_player", ":item2"),
          	(display_message, "@done", 0x00FF00),
          ]),

    In my case troop_remove_item removed not the first found item(that was in the weapon slot), but the last found item(that was in the inventory). I tested it while having 5-6 lances :smile:
    As for removing the item while inside a mission, I do not know why it does not work in my game.
    Yeah, and I am modifying WFaS 1.143, not Warband. :grin:  As I have noticed, you play it as well.
    I want to make a mod for WFaS and include this script into it. And I will include you in the credits, if you don't mind.
  4. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    kalarhan 说:
    vitali-attila 说:
    kalarhan 说:
    Imagine you have two lances, one is a masterwork lance and the other is a cracked lance.

    You are using the cracked lance... it *breaks*. Your script will remove the first one that finds, so it will remove the masterwork one (expensive, better quality).

    Slot  Weapon    Quality            Item_ID
    0      Lance        Masterwork      333
    1      Lance        Cracked            333
    2      Shield        Plain                50
    3      Sword      Plain                  67

    Or you could find a lance in the ground and pick it up. That won't match your troop slots. And so on.

    You are missing a try_end there. Fix your identation as that makes it easier to see it.

    Did you download Lav's version of the modules? It has a better header_operations.py (with documentation)

    Add display_message for debugging when you are doing something new and that you are unsure about it. After it is working you can exclude them
    Well, I could not find a way to define the IMOD of the ":cur_item". Maybe you know how to do this?
    Anyway, even without using a modifier the item is not removed when I get back to the World Map after a battle.
    插入代码块:
    #If it's a player remove it from the inventory forever(cause it's broken)
    (try_begin), #vitali TEST(not working yet. work on)
    	(eq, ":cur_agent", ":player_agent"), 
    	(assign, ":has_item", -1),
    	(try_for_range, ":slot_no", 0, 4),
    		(troop_get_inventory_slot, ":cur_slot", ":player_agent", ":slot_no"),
    		(eq, ":cur_slot", ":cur_item"), 
    		#(store_item_kind_count, ":num_cur_items", ":cur_item"), #add this(if 2 hussar lances, decide which to remove) and extend when the simple removing will work
    		(assign, ":has_item", ":cur_item"),
    	(try_end),
    	(try_begin),
    		(ge, ":has_item", 0),
    		(troop_remove_item, "trp_player", ":cur_item"), 
    		(display_message, "@The broken lance is removed form the inventory :)"),
    	(else_try),
    		(display_message, "@The lance could not be found :("),
    	(try_end),
    (try_end),

    You are still confused about troops X agents . Check Caba's comment again, and download Lav's version of modules as his header_operations.py is very well organized and has more helpful text in there...

    插入代码块:
    (troop_get_inventory_slot, ":cur_slot", ":player_agent", ":slot_no"),
    插入代码块:
    troop_get_inventory_slot                 = 1541  # (troop_get_inventory_slot, <destination>, <troop_id>, <inventory_slot_no>),
                                                     # Retrieves the item_id of a specified equipment or inventory slot. Returns -1 when there's nothing there.

    Besides that you should remember to post the debug messages on future questions, as saying something doesn't work can mean a lot of things  :smile:. That is why the debug messages are there, so show them to us too.



    use this struct to print variables
    插入代码块:
    (assign, reg10, ":cur_item"),
    (assign, reg11, ":player_agent"),
    (display_message, "@Stuff I am debugging... and my variables are {reg10} , {reg11}"),

    Hi. Thank you very much for the advises. With your help I finally managed to make the lance get lost.  :grin:
    It's curious that the same code(removing the lance from the player's inventory) did not succeed when I launched it during the battle, but worked perfectly when I called from the mnu_battle_debrief.
    Anyway if you are interested how I made it:
    The code works the following way:
    First a script is called from module_mission_template
    插入代码块:
    # Trigger Param 1: damage inflicted agent_id
    # Trigger Param 2: damage dealer agent_id
    # Trigger Param 3: inflicted damage
    # Register 0: damage dealer item_id
    # Position Register 0: position of the blow
    #                      rotation gives the direction of the blow
    vitali_on_couched_lance_damage = (
     ti_on_agent_hit, 0, 0, [],
     [
    	(store_trigger_param_1, ":inflicted_agent"),
    	(store_trigger_param_2, ":cur_agent"),
    	(store_trigger_param_3, ":inflicted_damage"),
    	(assign, ":cur_item", reg0),
    	(call_script, "script_vitali_game_event_agent_hit", ":inflicted_agent", ":cur_agent", ":inflicted_damage", ":cur_item"),
    	(try_end),
     ])

    Then if the agent is the player, a global variable "$g_hussar_lance_broken" is incremented. That means that there is one broken lance in the player's inventory
    插入代码块:
    #script_vitali_game_event_agent_hit
    ("vitali_game_event_agent_hit",
    [
    	#(store_script_param, ":inflicted_agent", 1), #uncomment the line when will you use this variable
    	(store_script_param, ":cur_agent", 2), 
    	(store_script_param, ":inflicted_damage", 3), 
    	(store_script_param, ":cur_item", 4), 
    	(get_player_agent_no, ":player_agent"),		
    	(try_begin),
    		(gt, ":inflicted_damage", 90), #if this is a big damage
    		(agent_is_active, ":cur_agent"),
    		#If a polish hussar lance is used
    		(this_or_next|eq, ":cur_item", itm_gusar_lanza),
    		(this_or_next|eq, ":cur_item", itm_gusar_lanza_b),
    		(             eq, ":cur_item", itm_gusar_lance),
    		(play_sound_at_position, "snd_lance_broken", pos0),
    
    		#If it's a player
    		(try_begin),
    			(eq, ":cur_agent", ":player_agent"),
    			(troop_has_item_equipped, "trp_player", ":cur_item"),
    			#add 1 more broken lance
    			(val_add, "$g_hussar_lance_broken", 1),
    		(try_end),
    . . . etc.

    Afterwards, when the mission(battle) is complete the game checks how many lances have been broken
    It is done in  mnu_battle_debrief
    插入代码块:
    #If there is 1 or more broken lances, call the script
    (try_begin),
    	(ge, "$g_hussar_lance_broken", 1),
    	(call_script, "script_vitali_remove_hussar_lance"),
    (try_end),

    Finally, depending on how many lances are broken the following script removes them from the player's inventory
    插入代码块:
    #script_vitali_remove_hussar_lance
    ("vitali_remove_hussar_lance",
    [
    #Through the lance away(cause it's broken)
    (display_message, "@script_vitali_remove_hussar_lance started"),
    (try_for_range, ":i", 0, "$g_hussar_lance_broken"), #loop as many times as the player broke the lances in the previous battle
    	(assign, ":break", 0),
    	(try_for_range, ":slot_no", 0, 4),
    		(eq, ":break", 0),
    		(troop_get_inventory_slot, ":cur_slot", "trp_player", ":slot_no"),
    		(this_or_next|eq, ":cur_slot", "itm_gusar_lanza"),
    		(this_or_next|eq, ":cur_slot", "itm_gusar_lanza_b"),
    		(             eq, ":cur_slot", "itm_gusar_lance"),
    		(troop_set_inventory_slot, "trp_player", ":slot_no", -1), 
    		(assign,":break", 1),
    		(assign, reg10, ":cur_slot"),
    		(assign, reg11, ":slot_no"),	
    		(display_message, "@The broken lance is removed from the inventory"),			
    		(display_message, "@hussar lance = {reg10}, slot_no = {reg11}"),			
    	(try_end),
    (try_end),
    (assign, "$g_hussar_lance_broken", 0), #obnulim :)
    ]),
    ...And assigns the global variable back to 0.

    What do you think? Maybe I left something vital?
  5. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    kalarhan 说:
    Imagine you have two lances, one is a masterwork lance and the other is a cracked lance.

    You are using the cracked lance... it *breaks*. Your script will remove the first one that finds, so it will remove the masterwork one (expensive, better quality).

    Slot  Weapon    Quality            Item_ID
    0      Lance        Masterwork      333
    1      Lance        Cracked            333
    2      Shield        Plain                50
    3      Sword      Plain                  67

    Or you could find a lance in the ground and pick it up. That won't match your troop slots. And so on.

    You are missing a try_end there. Fix your identation as that makes it easier to see it.

    Did you download Lav's version of the modules? It has a better header_operations.py (with documentation)

    Add display_message for debugging when you are doing something new and that you are unsure about it. After it is working you can exclude them
    Well, I could not find a way to define the IMOD of the ":cur_item". Maybe you know how to do this?
    Anyway, even without using a modifier the item is not removed when I get back to the World Map after a battle.
    插入代码块:
    #If it's a player remove it from the inventory forever(cause it's broken)
    (try_begin), #vitali TEST(not working yet. work on)
    	(eq, ":cur_agent", ":player_agent"), 
    	(assign, ":has_item", -1),
    	(try_for_range, ":slot_no", 0, 4),
    		(troop_get_inventory_slot, ":cur_slot", ":player_agent", ":slot_no"),
    		(eq, ":cur_slot", ":cur_item"), 
    		#(store_item_kind_count, ":num_cur_items", ":cur_item"), #add this(if 2 hussar lances, decide which to remove) and extend when the simple removing will work
    		(assign, ":has_item", ":cur_item"),
    	(try_end),
    	(try_begin),
    		(ge, ":has_item", 0),
    		(troop_remove_item, "trp_player", ":cur_item"), 
    		(display_message, "@The broken lance is removed form the inventory :)"),
    	(else_try),
    		(display_message, "@The lance could not be found :("),
    	(try_end),
    (try_end),
  6. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    GoldenDawnEmpire 说:
    So I need some help

    Before I ask my question I will tell you what posts I am using to begin modding:
    • The Ultimate Introduction to Modding
    • And of course this post

    So now to my question.

    I have a problem while trying to Initialize my mod.
    Here is an example (not my picture because I am having errors)
    XaazO.png

    (I cannot post my own picture of the error unless I have my own Microsoft account which I have forgotten the password and username for)

    My Error is:
    The problem with mine is that it only Exports just a few of the files.
    Here is the files it Exports:
    • strings
    • skills
    • animations
    • meshes
    • sounds
    • faction data
    • item data
    • quest data
    • postfx_prams.....
    The rest are a error (for example):
    <party_set_marshall, ":eek:ld_marshall_party", 0>,
    Name Error: name '' is not defined

    or

    Traceback <most recent call last>
    File "process_mission_tmps.py",line 8, in <module>
    from process_operations import *
    File "C:/Users/GCG/Documents/MB Mod/Module_system 1.165/ process_operations..py" (I cant read past this point)
    , line 8614, in module.
    Please Help Anyone!

    Hi. I also had such problem with "party_set_marshall". In my case there was a misprint in header_operations.py. There this operation was called party_set_marshal (one letter 'l', and it must be marshall). I solved this by just adding one more 'l' to the operation in header_operations.py. Afterwards the module compiled successfully. I hope this will help you.
  7. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    kalarhan 说:
    vitali-attila 说:
    There is another thing I can't solve. If the ":cur_agent" is the player, the code should remove the ":cur_item"(which he has in one of his weapon slots) from the inventory, of course, forever.
    The code below is what I tried to do. But it does not work...
    插入代码块:
    (try_begin),
      (eq, ":cur_agent", ":player_agent"), 
      (assign, ":break", 0),
      (try_for_range, ":slot_no", 0, 4),
        (eq, ":break", 0),
        (agent_get_item_slot, ":cur_slot", ":player_agent", ":slot_no"),
        (eq, ":cur_slot", ":cur_item"), 
        #(troop_remove_item, "trp_player", ":cur_item"), #TEST -> does not work 
        (troop_set_inventory_slot, "trp_player", ":slot_no", -1), #does not work either
      (assign,":break", 1),
    (try_end),
    (try_end),
    Could you please tell me what is wrong and how to fix it?

    did you read Caba's text about troops X agents?

    about your snippet: you are not showing how you are getting the id's for the agent and the player_agent, so no way to know if they are correct.
    If you want to remove the item for the mission duration, use a agent_ operation
    If you want to also remove the item forever, then add a extra line for your troop.

    插入代码块:
    troop_remove_item                        = 1531  # (troop_remove_item, <troop_id>, <item_id>),
                                                     # Removes an item from the troop equipment or inventory. Operation will remove first matching item it finds.

    keep in mind that operation does not take into account the IMOD of a item, and if you have duplicates it will have some weird results :XD
    you should get the current item IMOD and look for it on the troop inventory.

    You should never assume the agents slots are the same as the troop, not even for weapons. You can drop and pick new gear in a mission, and that will break your script.

    Yes, I read it, thank you for the information.

    Here is the whole code, I get the parameters from mission_template.py I have written my own mst_ block:
    插入代码块:
    # Trigger Param 1: damage inflicted agent_id
    # Trigger Param 2: damage dealer agent_id
    # Trigger Param 3: inflicted damage
    # Register 0: damage dealer item_id
    # Position Register 0: position of the blow
    #                      rotation gives the direction of the blow
    vitali_on_couched_lance_damage = (
     ti_on_agent_hit, 0, 0, [],
     [
      (store_trigger_param_1, ":inflicted_agent"),
      (store_trigger_param_2, ":cur_agent"),
      (store_trigger_param_3, ":inflicted_damage"),
      (assign, ":cur_item", reg0),
      (call_script, "script_game_event_agent_hit", ":inflicted_agent", ":cur_agent", ":inflicted_damage", ":cur_item"),
      (try_end),
     ])

    Then in "script_game_event_agent_hit":
    插入代码块:
    # Param 1: damage inflicted agent_id
    # Param 2: damage dealer agent_id
    # Param 3: inflicted damage
    # Param 4: damage dealer item_id
    # Param 5: position of the blow
    #                      rotation gives the direction of the blow
    ("game_event_agent_hit",
    [
      #(store_script_param, ":inflicted_agent", 1), #uncomment the line when will you use this variable
      (store_script_param, ":cur_agent", 2), 
      (store_script_param, ":inflicted_damage", 3), 
      (store_script_param, ":cur_item", 4), 
      (get_player_agent_no, ":player_agent"),		
      (try_begin),
        (gt, ":inflicted_damage", 70), 
        (agent_is_active, ":cur_agent"),
        #If a polish hussar lance is used
        (this_or_next|eq, ":cur_item", itm_gusar_lanza),
        (this_or_next|eq, ":cur_item", itm_gusar_lanza_b),
        (             eq, ":cur_item", itm_gusar_lance),
        (play_sound_at_position, "snd_lance_broken", pos0),
        #If it's a player through the lance away(cause it's broken)
        (try_begin),
        (eq, ":cur_agent", ":player_agent"), 
        (assign, ":break", 0),
        (try_for_range, ":slot_no", 0, 4),
          (eq, ":break", 0),
          (agent_get_item_slot, ":cur_slot", ":player_agent", ":slot_no"),
          (eq, ":cur_slot", ":cur_item"), 
          #(troop_remove_item, "trp_player", ":cur_item"), #TEST -> does not work 
          (troop_set_inventory_slot, "trp_player", ":slot_no", -1), #does not work either
          (assign,":break", 1),
          (display_message, "@The broken lance is removed form the inventory"),
        (try_end),
      (try_end),
      (agent_unequip_item, ":cur_agent", ":cur_item"),
      (agent_equip_item, ":cur_agent", "itm_konchar"),
      (agent_set_wielded_item, ":cur_agent", "itm_konchar"),
    ]),

    Everything here except removing the lance(":cur_item") from the inventory yet works.
    I did know that the IMOD of the item plays role. I thought only item's id is important. And how to get it? With troop_get_inventory_slot_modifier? But it's only for troops, right?
  8. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    kalarhan 说:
    if you are checking the weapons your agent has (in a mission), you need to use agent_ operations, and not the troop_ operations

    插入代码块:
    agent_get_wielded_item                   = 1726  # (agent_get_wielded_item, <destination>, <agent_id>, <hand_no>),
                                                     # Retrieves the item reference that the agent is currently wielding in his right hand (hand_no = 0) or left hand (hand_no = 1). Note that weapons are always wielded in right hand, and shield in left hand. When wielding a two-handed weapon (including bows and crossbows), this operation will return -1 for left hand.
    
    agent_get_item_slot                      = 1804  # (agent_get_item_slot, <destination>, <agent_id>, <value>),
                                                     # Retrieves item_id for specified agent's slot Possible slot values range in 0..7, order is weapon1, weapon2, weapon3, weapon4, head_armor, body_armor, leg_armor, hand_armor.



    Caba`drin 说:
    Troops refer to the entries in module_troops by the name assigned to them there. "trp_player" is the player, "trp_npc##" for the various companions, "trp_knight_#_##" for lords, and "trp_swadian_footman" etc, etc. With more generic soldiers, the entry in module_troops is used as a "template" to create multiple instances of them in each party, etc.

    Alternatively, agents refer to the specific actors, by number, in a scene (whether that scene is a battle, a tavern or what have you). Agents are created from the templates in module_troops...for the player, companions, NPC lords, they are still unique, but with generic soldiers multiple agents can be created from a single troop template. Each agent has a unique number for that scene, but when the scene ends, the agent doesn't exist any more so its agent id is meaningless.

    Hello. Thank you, kalarhan and fladin, for the help.
    I did what kalarhan said and it worked! Thank you very much again. :smile:

    There is another thing I can't solve. If the ":cur_agent" is the player, the code should remove the ":cur_item"(which he has in one of his weapon slots) from the inventory, of course, forever.
    The code below is what I tried to do. But it does not work...
    插入代码块:
    (try_begin),
      (eq, ":cur_agent", ":player_agent"), 
      (assign, ":break", 0),
      (try_for_range, ":slot_no", 0, 4),
        (eq, ":break", 0),
        (agent_get_item_slot, ":cur_slot", ":player_agent", ":slot_no"),
        (eq, ":cur_slot", ":cur_item"), 
        #(troop_remove_item, "trp_player", ":cur_item"), #TEST -> does not work 
        (troop_set_inventory_slot, "trp_player", ":slot_no", -1), #does not work either
      (assign,":break", 1),
    (try_end),
    (try_end),
    Could you please tell me what is wrong and how to fix it?
  9. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    Hello. I wrote a code, which should count how many empty inventory slots for weapons i have.
    插入代码块:
    (assign, ":empty_slots", 0), #number of empty slots
    #If the agent has 2 empty weapon slots
    (try_for_range, ":slot_no", 0, 4),
      (troop_get_inventory_slot, ":cur_slot", ":cur_agent", ":slot_no"),
      (eq, ":cur_slot", -1),  #if it's an empty slot
      (val_add, ":empty_slots", 1), #increment the number of empty slots
    (try_end),
    But it does not work in the game. Maybe it is incorrect?
  10. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    DruGs 说:
    vitali-attila 说:
    DruGs 说:
    vitali-attila 说:
    Add this
    插入代码块:
            #Add a fixed amount of money and xp to player after he has captured a settlement
            (call_script, "script_troop_add_gold", "trp_player", 5000),
    	(add_xp_as_reward, 500), 
         
    after this line
    插入代码块:
            (call_script, "script_change_troop_renown", "trp_player", 5),
    You can put any amount instead of 5000 and 500.
    Of course, make this changes in a separate module, not directly in Native!
    I hope this code will be improved by experienced modders.
    wow, amazing :smile:! thank you guys for answering :smile: hoping more experienced modders also will answer to this. that would be

    awesome.
    and as i mentioned in my last post: its about getting to loot + experience and money after every siege battle, because you dont in

    native.

    By the way I forgot to mention that the code above works only when you capture a settlement. Though only the message of

    receiving money appears on the screen. But in script_add_gold there is nothing written about messaging, so it must be automatically.
    Does anyone know why there how to make the message of xp received show up on the screen?

    The code for the loot screen after defending a town/castle should be the same. Again I have found where to put it and again with

    a fixed amount of gold and xp.
    So after this lines in module_game_menus.py
    插入代码块:
                  (display_message, "@The enemy has been forced to retreat. The assault is over, but the siege continues."),
                  (assign, "$g_battle_simulation_cancel_for_party", "$g_encountered_party"),
    add this code
    插入代码块:
                  (call_script, "script_troop_add_gold", "trp_player", 1000),
                  (add_xp_as_reward, 300),
    Again, you can put any numbers instead of 1000 and 300. :smile: I should check the code for the looting screen I posted in the

    previous message.

    hmm, think ive might ive found something out about the mission templates. At the end of every different type of battle i found these
    "common_battle_victory_display, common_battle_inventory, common_battle_order_panel, common_battle_order_panel_tick" and so on.

    However the siege setup is alot more complex it seems:S
    Cant really make sense of it, so its most likely a way better option what you did :razz: thank you :smile:!
    ---------------------------------------------------------------------------------------------------------------------------------------
    edited:
    i checked out different stuff and found the code:

    (call_script, "script_party_give_xp_and_gold", "p_temp_party"), <--- i haven't tested it or anything, but could that be the script for just

    giving xp and gold after a battle ? :razz:

    also, thought about 2 different codes that could be about getting up the loot menu.

    (jump_to_menu, "mnu_battle_debrief"), <-- dont really think its this one, however i found a weird siege code.
    (jump_to_menu, "$g_siege_final_menu"), <-- could be this one ? .. i can prob check later on.. will most likely lol myself, however

    worth a try.

    Hi. I have tested your code(yet only for capturing a town/castle):
    (call_script, "script_party_give_xp_and_gold", "p_temp_party"), <--- i haven't tested it or anything, but could that be the script for just

    giving xp and gold after a battle ? :razz:
    and it worked just fine :smile:. Though I think getting 30 of gold for capturing a town/castle is way to unfair. So I think I should add my own code(only for money) there as well.

    Now about the loot menu. I made it work! For the loot screen to show up after you capture a settlement in module_game_menus.py in mnu_total_victory comment the line (gt, reg0, 0),
    插入代码块:
            (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), #vitali commented line
              (troop_sort_inventory, "trp_temp_troop"),
              (change_screen_loot, "trp_temp_troop"), #vitali --> loot screen
            (else_try),
    This will make the game show an empty loot screen - obviously because reg0 <= 0.
    It seems that this reg0 has a value of total_enemy_casulties or some sort of it. And when we have a siege, the code sets it somewhere automatically to 0 or just doesn't count the casulties.

    Now for the loot screen after we have defended a settlement use the following code. I commented some of the native code lines and added mine:
    插入代码块:
                 (display_message, "@The enemy has been forced to retreat. The assault is over, but the siege continues."),
                  (assign, "$g_battle_simulation_cancel_for_party", "$g_encountered_party"),
    			  (call_script, "script_party_give_xp_and_gold", "p_temp_party"), #vitali added
    			  (call_script, "script_troop_add_gold", "trp_player", 500), #vitali added 
    			  #(leave_encounter), #vitali commented for loot screen after have defended a castle
                  #(change_screen_return), #vitali commented for loot screen after have defended a castle
                  (assign, "$g_battle_simulation_auto_enter_town_after_battle", "$g_encountered_party"),			  
    			  (assign, "$g_next_menu", -1), #vitali added for loot screen after have defended a castle
                  (jump_to_menu, "mnu_total_victory"), #vitali added for loot screen after have defended a castle
    One more thing. When the enemy assaults a castle/town and loses, he retreats having many man remaining. Originally we can't capture them after that assault. But with this code we do it and this is not right, because they routed and couldn't be captured. So it would be correct to allow the player to imprison only those who were knocked down and not everyone.
    In addition, we need to add variables to allow the mnu_total_victory loot the enemies, again only the ones who died or were wounded and not those, who routed.
    I tested both of the code blocks and they worked correctly.

    For those having the same problem:
    The problem was that the strings in your_mod/languages had priority over the strings in the module_troops.py. You just need to change them there and the game will work as needed.

    Additionally, I would ask your help. I am modifying a Custom Battle menu. But the names of the new troops remain from the old
    ones' names. So I just want to check if such bug is only for me or it's general.
    So please in module_troops.py replace this line:
    插入代码块:
     ["quick_battle_troop_1","Rodrigo de Braganca","Rodrigo de Braganca", tf_hero,0,0,fac_kingdom_1,
    插入代码块:
     ["quick_battle_troop_1","New Name","Rodrigo de Braganca", tf_hero,0,0,fac_kingdom_1,
    This should(at least I think so) change the name of the troop Rodrigo de Braganca when choosing him in the Custom Battle Menu. Unfortunately, it doesn't work for me and I get the old name again. What about you?
  11. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    jacobhinds 说:
    The custom battle troop descriptions are based on troop order, not IDs. You could name the strings absolutely anything, but as long as they're in the same order as the troops they will work.
    I agree with you. But the first and last ids are also used in module_constants.py and module_strings.py so they should be the same in all 3 files. Change quick_battle_troop_1 to e.g. quick_battle_troop_01 only in module_troops.py and you'll get an error when compiling the files.
    About strings again. I checked it on Warband as well. I changed in module_troops.py this:
    插入代码块:
    ["quick_battle_troop_1","Rodrigo de Braganca","Rodrigo de Braganca", tf_hero,0,0,fac_kingdom_1,
    to this:
    插入代码块:
    ["quick_battle_troop_1","Vitali Brezhnev","Rodrigo de Braganca", tf_hero,0,0,fac_kingdom_1,
    But the name of the troop still remained Rodrigo de Braganca.
    Check it yourself, please. Maybe only I do have such problem?

    Yeah, and I have the same problem for the strings in the menu "mnu_choose_skill".
    It was initially this:
    插入代码块:
    ("choose_skill",mnf_disable_all_keys,"You spot a battle-ready men in the distance.", "none"
    I changed it to:
    插入代码块:
    ("choose_skill", mnf_disable_all_keys,"{s13}", "none",
    But the text "You spot a battle-ready..." remained, despite the fact that I changed it and s13 has nothing in common with the old string.
  12. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    Hello. I have a weird problem. I searched a lot but didn't find anything similar to this on the forum.
    The problem is that I replaced some troops in the custom battle with new ones. I changed their names, characteristics and descriptions, only the ids(quick_battle_troop_1 etc) stayed the same.
    However, although these new troops are shown in the game, but their names and descriptions still are from the native troops, despite the fact that I changed them!
    For example, there was initially in module_troops.py:
    插入代码块:
    ["quick_battle_troop_1", "Reiter","Reiters", tf_hero,0,0,fac_kingdom_1,......
    ["quick_battle_troop_2", "Hussar","Hussars", tf_hero,.....
    ["quick_battle_troop_3", "Boyar","Boyars", tf_hero,0,0,fac_kingdom_1,.....
    .....
    ["quick_battle_troop_11", "Halberdier","Halberdiers", tf_hero,0,0,fac_kingdom_1,

    I replaced the code with:
    插入代码块:
    ["quick_battle_troop_1", "Hussar","Hussars", tf_hero,0,0,fac_kingdom_1,......
    ["quick_battle_troop_2", "Boyar","Boyars", tf_hero,0,.....
    ["quick_battle_troop_3", "Mirza Chambul","Mirza Chambul", tf_hero,0,0,fac_kingdom_1,....
    .....
    ["quick_battle_troop_18", "Winged Hussar","Winged Hussars", tf_hero,0,0,fac_kingdom_1,...
    I did the same for the strings in module_strings.py - they were replaced - but the game shows still the old strings.

    There were initially 11 troops, I made 18 of them. And the troops from 12 to 18 have the correct names(obviously :smile: ).

    Interesting note: when I change the id of quick_battle_troop_1 to quick_battle_troop_101 or any other name, it starts working as needed. It seems like the strings for the native ids are reserved and hidden or something like this.

    Please help me make the game show the correct strings. I'm sure I just made a mistake somewhere in the code.
    P.S. I'm modifying WFaS.


  13. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    TheVideoGameInn 说:
    LOD problem here, my custom skin shows up as white from far away?

    1434188943-mb38.jpg
    1434188947-mb39.jpg
    Hi. I had such problem when playing one of the mods. But there not only the heads, almost everything was just white: terrain, weapons etc. They told me it's my graphic card's problem and advised to choose DirectX7 instead of DirectX9 in the main menu options, and everything became normal. Hope this helps.
  14. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    DruGs 说:
    vitali-attila 说:
    Add this
    插入代码块:
            #Add a fixed amount of money and xp to player after he has captured a settlement
            (call_script, "script_troop_add_gold", "trp_player", 5000),
    	(add_xp_as_reward, 500), 
         
    after this line
    插入代码块:
            (call_script, "script_change_troop_renown", "trp_player", 5),
    You can put any amount instead of 5000 and 500.
    Of course, make this changes in a separate module, not directly in Native!
    I hope this code will be improved by experienced modders.
    wow, amazing :smile:! thank you guys for answering :smile: hoping more experienced modders also will answer to this. that would be awesome.
    and as i mentioned in my last post: its about getting to loot + experience and money after every siege battle, because you dont in native.

    By the way I forgot to mention that the code above works only when you capture a settlement. Though only the message of receiving money appears on the screen. But in script_add_gold there is nothing written about messaging, so it must be automatically.
    Does anyone know why there how to make the message of xp received show up on the screen?

    The code for the loot screen after defending a town/castle should be the same. Again I have found where to put it and again with a fixed amount of gold and xp.
    So after this lines in module_game_menus.py
    插入代码块:
                  (display_message, "@The enemy has been forced to retreat. The assault is over, but the siege continues."),
                  (assign, "$g_battle_simulation_cancel_for_party", "$g_encountered_party"),
    add this code
    插入代码块:
                  (call_script, "script_troop_add_gold", "trp_player", 1000),
                  (add_xp_as_reward, 300),
    Again, you can put any numbers instead of 1000 and 300. :smile: I should check the code for the looting screen I posted in the previous message.
  15. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    kraggrim 说:
    Drugs, this is what I was told when I asked that before:
    JuJu70 说:
    In mission templates you need to compare village_attack_bandits and village_raid to lead_charge and make changes, also need to edit in game_menu attack_bandits and village_raid (or whatever it's called).

    Sadly I wasn't able to figure it out.
    Hello. I'm interested in this thing as well. I am new to modding as well. I looked at these mission-templates, but didn't find the answer either. What I was thinking about: After we win in usual battles in the field we get both 'capture prisoners' and 'looting' screens. After we capture a settlement we only have the 'capture prisoners' screen So we should just copy the code of looting menu from the usual battle's code and put it after the 'capture prisoners' code from the siege victory code.
    In addition we can add the code to reward the player with money and xp after for capturing a settlement. Again we copy he code and put it in the right place.
    Unfortunately, I do not know for sure how to do this correctly but I've found some code. I hope that more experienced modders will help us.

    I did everything in module_game_menus.py
    插入代码块:
             
              (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"),
              (change_screen_loot, "trp_temp_troop"),
            (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),

    I also found a simpler way of rewarding with money and xp, but it is a fixed amount.
    Add this
    插入代码块:
            #Add a fixed amount of money and xp to player after he has captured a settlement
            (call_script, "script_troop_add_gold", "trp_player", 5000),
    	(add_xp_as_reward, 500), 
         
    after this line
    插入代码块:
            (call_script, "script_change_troop_renown", "trp_player", 5),
    You can put any amount instead of 5000 and 500.
    Of course, make this changes in a separate module, not directly in Native!
    I hope this code will be improved by experienced modders.
  16. vitali-attila

    SP Musket Era Csatádi's Visual and Historical Mod

    Hi. You told in the first post that you need translations. I can translate from English to Russian, if you'd like.
  17. vitali-attila

    Modding Q&A [For Quick Questions and Answers]

    Hello. I want to modify the map in WFaS. I used M&B Map Editor, put my module's folder in M&B's 'Modules'.
    The program launches, the WFaS' map opens as well, but there are no icons of castles/villages and the program freezes very often.
    The question is: how to make possible to successfully modify the map?
  18. vitali-attila

    Question about Polish armour

    Look, how it is in the Single player. Though I think that it's correct, because they both seem to have same amount of iron.
  19. vitali-attila

    SP Musket Era Csatádi's Visual and Historical Mod

    Csatádi 说:
    I know only the M&B Map Editor. It works but you need to put the files to an original M&B mod folder.
    Did you use the map of Caldaria as a template or the WFaS map? And which files should I put?
  20. vitali-attila

    SP Musket Era Neo Native (v1.35 en/ger)

    Hello. The game fixes in the mod are very good :smile: . I would like to make some mini-mod myself and want to modify the overland map. Could you tell me how to do this? I tried M&B Map Editor but it did not work...
后退
顶部 底部