Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Thx for the reply

I am very sorry for flooding the forum with posts, but since i saw people active on this thread i tried my luck again and you replied :grin:

I am using Native Module Compilation as base ( which also uses Diplomacy, CC, PBOD and custom player troop tree)

So i didnt mess up any .py file , i just editet txt and used OSP-s.

In game my relation with the lords is negative ( i see their faction on red) but they don't attack me, tho bandits do.
And i remember the modder saying he was playing on easy and i think this might influence the game, even though i never played on easy, so i dont know how the AI behaves on that difficulty setting.

If somehow the mod's options are ignoring my game options is there a way to fix it?


Thank you and sorry again for multiple posting
 
The Archduke of Hell said:
Hello!

This problem has persisted for a while now, and I still haven't found a fix.

I've implemented the ability to customize regular troops, but once I reload my save they revert back to their original inventory, losing all of their new equipment. The method to which I am using is through dialogue, I've copied and pasted the companion inventory swap dialogue, and made it work with regular troops. Does anyone know what the problem is?

Please help.
 
Marius Aetius said:
In game my relation with the lords is negative ( i see their faction on red) but they don't attack me, tho bandits do.

relation is a double thingy. The question is, what is theirs faction relation to yours? Not yours to theirs. If you don't use .py (modules), you will have to try a savegame editor to check the number

A hates B, but B loves A, so B won't attack A, even tho A can attack B

Can't you download modules? Not familiar with that compilation, so thats something you will need to check on the mod subforum
 
kalarhan said:
meminimina said:
how do you give a polearm item its length dpending on the brf.
for instance..i do not know what value of weapon length to put on module_items...because i do not know the actual length of it ingame

BRF has a rule for measures



Arthur_Pendragon said:
Does anyone have any idea why in the world no agent is being added to the scene????
at this point im ready to jump out my window.
I don't mod MP, so won't comment on that. However, you could add debug messages (display_message) to see what is working, and what is not. Don't hope for the best, test it

can you explain to me how?
 
Khamukkamu said:
What's the best a good way to test triggers (simple or regular triggers)? Bind it to a key click then see if it triggers? Anyone have best practices?

Thanks
To test I usually used shortened timings for simple triggers, keys for battle tirggers and global vars (that allow skipping conditions) and menu for regular ones.
 
meminimina said:
can you explain to me how?
In case of mystery, first, that is good to check is if the code even is called.
Adding
(display_log_message, "@my debug message"),
may help a lot, especially if it's not displayed.
Later, you may yield some critical vars, to check effects of the code.

(assign, reg24, ":value"),
(display_log_message, "@{reg24}"),
 
meminimina said:
where do i actually do this.?
sorry im kinda new to these kinds of stuff sorry. :oops:
In the code, which you are investigating.

Did you read this https://forums.taleworlds.com/index.php/topic,240255.0.html ?
 
Hello, I'd like to know how to remove the requierement to become a mercenary. My goal is to be able to become mercenary once the beginning of the game(that is possible in  Europa 1257, but not in vanilla).

May someone help please?
 
_Sebastian_ said:
Arthur_Pendragon said:
Its not native its a completely rewritten module system.
There is no troop selection instead the bot is Spawned in
Code:
def itm_bot_roman_spawn():
  return (ti_on_missile_hit, 
   [(multiplayer_is_server),
    (store_trigger_param_1, ":shooter_agent"),
    (agent_get_player_id, ":player_id", ":shooter_agent"),
    (assign, ":min", 500),
    (player_get_gold, ":gold_amount", ":player_id"),
    (try_begin),
        (gt, ":gold_amount", ":min"),
        (player_is_admin, ":player_id"),
        (set_spawn_position, pos1),
        (spawn_agent, "trp_roman_bot"),
        (agent_set_group, reg0, ":player_id"),
        #(try_for_agents, ":bot_agents"),
         #   (agent_is_non_player, ":bot_agents"),
          #  (agent_get_troop_id, ":troop_id", ":bot_agents"),
           # (eq, ":troop_id", "trp_roman_bot"),
        (agent_set_team, reg0, team_bot_roman),
        (agent_set_wielded_item, reg0, -1),
        (val_sub, ":gold_amount", ":min"),
        (player_set_gold, ":player_id",":gold_amount"),
Check if the specific agents still have the correct group id before giving orders... add debug messages to track it.

troycall said:
If I would like this to work in multiplayer, do I only have to switch the get_player_agent_no operation to agent_get_player_id operation?
also, does agent_get_team work in multiplayer?
No.
You would need to write a server event to do so.
Your trigger is client side ofc, but you have to call the server to execute the animation, otherwise it wont synce to other clients.

agent_get_team works on multiplayer aswell.
Check this code out:
3 Questions:
1. Are the agent_get_team parameters necessary here? It looks like I don't need them for a multiplayer version if I use the player_id as the team_no.
2. I'm getting an error at line 10, group ID error: 25, any idea on what might be causing this?
3. agent_get_player_id dosen't work for me, instead player_get_agent_id seems to work right, is that fine, any ideas?

Code:
  ("crouch_command_coop", #Coop Variant, patched to an extent.
 [
 #(store_script_param_2, ":script_param_2"),
 #(agent_get_player_id, ":player_agent"), #Bad
 (player_get_agent_id, ":player_agent"), #Good
 #(player_get_agent_id, ":player_agent", ":script_param_2"), #Test3
 #(agent_get_player_id, ":player_agent", ":script_param_2"),  #Test4
 #(gt,  ":player_agent", -1), #if dead/spectator
  (agent_get_team, ":player_team", ":player_agent"),
  (store_script_param_1, ":command"),
  (try_for_agents, ":agent"),
    (neq, ":agent", ":player_agent"),
    (agent_is_alive, ":agent"),
    (agent_is_human, ":agent"),   
    (agent_get_team, ":team", ":agent"),
    (eq, ":team", ":player_team"),
    (agent_get_division, ":class", ":agent"), #Group ID error
    (class_is_listening_order, ":player_agent", ":class"), 
    (agent_get_horse, ":horse", ":agent"),
    (le, ":horse", 0),
    (call_script, "script_agent_do_crouch_coop", ":agent", ":command"),     
 (try_end), ]),
 
troycall said:
2. I'm getting an error at line 10, group ID error: 25, any idea on what might be causing this?

Code:
(agent_get_division, ":class", ":agent"), #Group ID error
(class_is_listening_order, ":player_agent", ":class"),
Are you sure? I would assume that line 10 is
(class_is_listening_order, ":player_agent", ":class"),
class_is_listening_order  wants a team, not an agent.

 
gokiller said:
How can I decrease scene props of polygon on openbrf, Is there any way?
Are you talking about LOD? https://en.wikipedia.org/wiki/Level_of_detail

If not use your 3D tool for that. OpenBRF is the glue to teach the game engine how to find your props, not where you create them. For that you have Blender, Wings, 3dMax, etc



troycall said:
1. Are the agent_get_team parameters necessary here? It looks like I don't need them for a multiplayer version if I use the player_id as the team_no.
2. I'm getting an error at line 10, group ID error: 25, any idea on what might be causing this?
3. agent_get_player_id dosen't work for me, instead player_get_agent_id seems to work right, is that fine, any ideas?
1. Use appropriate names for parameters. "trigger_param_1" is just silly hehe, and tells anyone (you, us) nada/nothing. It looks like you are using a decompiler instead of trying to write code for humans

2. Find the line of error (11th line, counting from zero). Remember to check the operation ID, and look for it on header_operations.py. Read the documentation there. Im doubt, search for examples of usage of that operation on Native or Floris. Or even better, download NW code, as it is all MP (even if old now)

3. Both operations work for MP, just be mindful of you state (client or server) and the current case (trigger, etc) parameters



G.Colonna said:
Hello, I'd like to know how to remove the requierement to become a mercenary. My goal is to be able to become mercenary once the beginning of the game(that is possible in  Europa 1257, but not in vanilla).

Are you working with modules? You gave us very little there. Assuming you are:
1) Read tutorial on how to work with game code (sticky thread)
2) Search for the mercenary dialog on module_dialogs.py
3) Change the conditions (requirements) from there



Rongar said:
meminimina said:
where do i actually do this.?
sorry im kinda new to these kinds of stuff sorry. :oops:
In the code, which you are investigating.

Did you read this https://forums.taleworlds.com/index.php/topic,240255.0.html ?
What a weird conversation. I am lost. @meminimina asked about weapons lenght, then did a full quote of another post, @Rongar then decided to answer something that @meminimina did not ask in the first place, and here we are. Lost.

If you are still trying to figure out the first question: check OpenBRF subforum, the faq there should help. All you need to do is open your item, find the rule on the menus and use it to measure your weapon



Khamukkamu said:
What's the best a good way to test triggers (simple or regular triggers)? Bind it to a key click then see if it triggers? Anyone have best practices?

That would be a very long post. Probably a tutorial. As there are many different cases here. The very shorter version:

1) Use debug messages (display_message) while in dev mode
2) Put debug messages when done inside a flag check for testing later. Example:
Code:
      (try_begin),
        (eq, "$cheat_mode", 1),
        (display_message, "@TEST"),
      (try_end),
--> I prefer to use a Python variable for each feature. That way you can choose WHAT to turn on/off for testing...
Code:
      (try_begin),
        (eq, DEBUG_WEAPON_BREAKING, 1),
        (display_message, "@TEST"),
      (try_end),
3) Keep your code short. We have scripts for that ... that way you can test parts of your code more easily, and actually read it.
See this example. You could have 300 lines of code on a trigger. Or something you can read in a few seconds.
Note you don't even need comments. The script names ARE the comments.
Code:
  (ti_on_agent_hit, 0, 0, [
      (neq, "$goredec_on", 0), # SP only. Gore ON from options menu.
    ],
    
    [
      (assign, ":reg0_backup", reg0),
      (store_trigger_param, ":inflicted_agent_id", 1),
      (store_trigger_param, ":attacker_agent_id", 2),
      (store_trigger_param, ":damage", 3),
      (store_trigger_param, ":hit_bone", 4),
      (store_trigger_param, ":missile_item_kind_no", 5),
      (assign, ":weapon_id", ":reg0_backup"),
      
      (call_script, "script_cf_goredec",
        ":inflicted_agent_id",
        ":hit_bone",
        ":missile_item_kind_no",
        ":damage",
      ":weapon_id"),
      
      (call_script, "script_cf_goredec_probability",
        ":inflicted_agent_id",
        ":attacker_agent_id",
      ":weapon_id"),
      
      (call_script, "script_goredec_special_effects",
      ":inflicted_agent_id"),
      
      (call_script, "script_change_courage_around_agent",
        -20,
      ":inflicted_agent_id"),
      
      (call_script, "script_goredec_debug_log",
        ":inflicted_agent_id",
      ":attacker_agent_id"),
      
      (assign, reg0, ":reg0_backup"),
  ]),


Marius Aetius said:
Forgot that the relations are scripted in both ends. Do you know by any chance what is the default value?
0 (zero) hehe. Download MnBSaveGameEditor from the tools section


The Archduke of Hell said:
I've implemented the ability to customize regular troops, but once I reload my save they revert back to their original inventory, losing all of their new equipment.
Unless you change your troops, that won't work. So consider using a backup mechanism. Save the gear data on a array and reload it with a trigger when you load your game.



troycall said:
Would agent_get_rider work in here without much of a performance impact?
Probably, as you do not need to loop agents to find the horse/rider, they are a direct reference to each other (inside the engine).
 
@kalarhan

I'm trying to change mercenaries in the mod Hispania 1200, I don't even get what is the requierement, though I think I've identified the part related to mercenaries in module_dialogs.py, could the requirement be "(troop_slot_ge, "trp_player", slot_troop_renown, 30),"?


[anyone|auto_proceed,"lord_request_mission_ask",
  [(eq, "$players_kingdom", 0),
    (ge, "$g_talk_troop_faction_relation", 0),
    (ge, "$g_talk_troop_relation", 0),
    (troop_slot_ge, "trp_player", slot_troop_renown, 30),
    (neg|faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
    (faction_get_slot, ":last_offer_time", "$g_talk_troop_faction", slot_faction_last_mercenary_offer_time),

    (assign, ":num_enemies", 0),
    (try_for_range, ":faction_no", kingdoms_begin, kingdoms_end),
      (faction_slot_eq, "$g_talk_troop_faction", slot_faction_state, sfs_active),
      (store_relation, ":reln", "$g_talk_troop_faction", ":faction_no"),
      (lt, ":reln", 0),
      (val_add, ":num_enemies", 1),
    (try_end),
    (ge, ":num_enemies", 1),
    (store_current_hours, ":cur_hours"),
    (store_add,  ":week_past_last_offer_time", ":last_offer_time", 7 * 24),
    (val_add,  ":last_offer_time", 24),
    (ge, ":cur_hours", ":last_offer_time"),
    (store_random_in_range, ":rand", 0, 100),
    (this_or_next|lt, ":rand", 20),
(ge, ":cur_hours", ":week_past_last_offer_time"),


(troop_get_type, ":type", "trp_player"),
(this_or_next|eq, ":type", 0),
(this_or_next|troop_slot_eq, "$g_talk_troop", slot_lord_reputation_type, lrep_cunning),
(troop_slot_eq, "$g_talk_troop", slot_lord_reputation_type, lrep_goodnatured),
    ],
  "{!}Warning: This line should never display.", "lord_propose_mercenary",[(store_current_hours, ":cur_hours"),
                                  (faction_set_slot, "$g_talk_troop_faction", slot_faction_last_mercenary_offer_time,  ":cur_hours")]],

 
 
 
 
  [anyone,"lord_propose_mercenary", [(call_script, "script_party_calculate_strength", "p_main_party", 0),
                                    (assign, ":eek:ffer_value", reg0),
                                    (val_add, ":eek:ffer_value", 100),
                                    (call_script, "script_round_value", ":eek:ffer_value"),
                                    (assign, ":eek:ffer_value", reg0),
                                    (assign, "$temp", ":eek:ffer_value"),
                                    (faction_get_slot, ":faction_leader", "$g_talk_troop_faction", slot_faction_leader),
                                    (neq, ":faction_leader", "$g_talk_troop"),
                                    (str_store_faction_name, s9, "$g_talk_troop_faction"),
                                    (str_store_troop_name, s10, ":faction_leader"),

(troop_get_type, ":is_female", "trp_player"),
(try_begin),
(eq, ":is_female", 3), #disabled
(troop_slot_eq, "$g_talk_troop", slot_lord_reputation_type, lrep_martial),
    (str_store_string, s11, "str_now_some_might_say_that_women_have_no_business_leading_mercenary_companies_but_i_suspect_that_you_would_prove_them_wrong_what_do_you_say"),
(else_try),
    (str_store_string, s11, "@What do you say to entering the service of {s9} as a mercenary captain?\
I have no doubt that you would be up to the task."),
(try_end)
],
 
G.Colonna said:
I'm trying to change mercenaries in the mod Hispania 1200, I don't even get what is the requierement

when posting code remember to use these two tags: CODE, SPOILER
Code:
your code goes here

you are in the right place. Now check the conditions and remove the ones you don't want. If in doubt about the code, download Lav's version of hte modules, as the header_operations.py there is well documented.

Examples:
Code:
(eq, "$players_kingdom", 0),
means you must be independent (not a lord or a king)
Code:
(ge, "$g_talk_troop_faction_relation", 0),
(ge, "$g_talk_troop_relation", 0),
your relation with the NPC you are talking to, and his faction, must be 0 or more.
 
Status
Not open for further replies.
Back
Top Bottom