Modding Q&A [For Quick Questions and Answers]

Currently viewing this thread:

Status
Not open for further replies.

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
36
DruDru the Magniscisiscent said:
it was simplified to make AI pathfinding/CPU usage lighter.
depends on your siege design, as you could have a multi stage defense and thus have to code AI behavior like where to move at each point, location priority based on class (infantry versus archers), if the castle has multiple entry points how to distribute your defenses, and so on. Something like how they are doing for Bannerlord. Its easier to let the player order troops (for the coder/modder) for sure, so you dont need to worry about any of that  :razz:

with that said you can choose which troops are under your control by using teams, just like in a normal field battle. Study that mission template and you can replicate the same idea to sieges as well.
 

Blubby

Recruit
Best answers
0
Hello.

I have got a few questions in regards to towns/castles.
Does a town need villages and castles to work properly?
Same for castles, do they need villages and towns?

I am currently working on a mod where I want to create
minor factions who do not have towns or castles depending
on the faction.

So far I have not seen any issues but I am not sure if it
would affect the game in the long run.
 

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
Best answers
91
Blubby said:
Hello.

I have got a few questions in regards to towns/castles.
Does a town need villages and castles to work properly?
Same for castles, do they need villages and towns?

I am currently working on a mod where I want to create
minor factions who do not have towns or castles depending
on the faction.

So far I have not seen any issues but I am not sure if it
would affect the game in the long run.
If you look at the mod 'The Last Day', they don't have any villages at all and it works fine^^
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
36
Blubby said:
I have got a few questions in regards to towns/castles.
Does a town need villages and castles to work properly?
Same for castles, do they need villages and towns?
nothing in that is hardcoded, so you can find all the code on your modsys. Thus all the Native rules are there to be tweaked, replaced or removed as your design demands it.

for Native the answer is yes. Castles prosperity is tied to the village. Towns economy is tied to villages. And so on.

So study the code and implement your own rulesets, just remember to think about all aspects (military, economy, diplomacy, vassal system, bandits and peasants, etc).
 

KratosMKII

Squire
Best answers
0
DruDru the Magniscisiscent said:
KratosMKII said:
I've have a bug where no matter if i'm the king, marshall or just a peasant i get to control all the troops on my side during sieges. How do i fix that? I suppose the file to be changed is module_mission_templates.py?
This is a usual issue in Native and nearly every other mod I can think of. I think it has to do with the type of parties in the conflict, I.E. a castle or town is still a party on the map, yet uses different scripts when interacting with a player, and it's possible that controlling all the troops is just an overlook on the dev's part, or it was simplified to make AI pathfinding/CPU usage lighter.

kalarhan said:
DruDru the Magniscisiscent said:
it was simplified to make AI pathfinding/CPU usage lighter.
depends on your siege design, as you could have a multi stage defense and thus have to code AI behavior like where to move at each point, location priority based on class (infantry versus archers), if the castle has multiple entry points how to distribute your defenses, and so on. Something like how they are doing for Bannerlord. Its easier to let the player order troops (for the coder/modder) for sure, so you dont need to worry about any of that  :razz:

with that said you can choose which troops are under your control by using teams, just like in a normal field battle. Study that mission template and you can replicate the same idea to sieges as well.
Thanks.
 
Best answers
0
In module_music, I added new kingdom, so I have new culture but I can't add mtf_culture_7, how can I add to module_music new cultures?

  ("mongol_1", "mongol_1.mp3", mtf_culture_7|mtf_culture_11|mtf_sit_siege|mtf_sit_travel|mtf_sit_fight, 0),

 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
36
culture != faction (kingdom)

if you have more than 6 culture types than you need to adapt your code, as the flags (hardcoded with the engine) are reserved.


Code:
mtf_culture_6                          = 0x00000020
mtf_culture_all                        = 0x0000003F

mtf_looping                            = 0x00000040
you can control the music with operations. VC, as a example, doesnt use that flag on module_music.py
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
36
Vetrogor said:
But I don't know will it work or not.
as you said the flags are used by the game, that is, the stuff inside the .exe (warband.exe). That stuff is hardcoded and we cant change it, just use it as is. So if you change the flags to arbitrary values that will look just fine on your modsys and compilation, but how will the game know what to do with them? How will is translate the meaning?
 

Vetrogor

Sergeant at Arms
Best answers
0
The game engine uses only bytes of information. I don't know the algoritm but there is a little chance that it will work. The meaning of information is coded in module system. Currently there are only two operations music_set_culture , music_set_situation . They give only flags to game engine. I suppose that it just checks flags in the list of tracks. Experiments are needed to clear this.
 

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
Best answers
91
frozenpainter said:
In module_music, I added new kingdom, so I have new culture but I can't add mtf_culture_7, how can I add to module_music new cultures?

  ("mongol_1", "mongol_1.mp3", mtf_culture_7|mtf_culture_11|mtf_sit_siege|mtf_sit_travel|mtf_sit_fight, 0),
You could look up how TLD is doing it since they have also multiple factions and cultures. You can ask at their thread here: https://forums.taleworlds.com/index.php/topic,199243.0.html
 
Best answers
0
In mission templates, lead_charge
I added this script, when player kill 6 or more enemy his strenght increase 1, but when I join another battle I dont kill enemy but script worked, I want to reset kill count, when player str increased.

(3, 0, ti_once, [], [
     
(try_begin),
(get_player_agent_kill_count, ":kill_count"),
(gt,":kill_count",5),
(troop_raise_attribute, "trp_player", ca_strength, 1),
(display_message, "@Your strenght increased, +1 Strenght"),
        ]),
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
36
troop is permanent, while the agent only exists inside that mission and while he is alive. Why are you giving a bonus to the troop? You should give the damage bonus to the agent.

one suggestion would be to apply these modifiers

Code:
agent_get_damage_modifier                = 2065  # (agent_get_damage_modifier, <destination>, <agent_id>), 
                                                 # output value is in percentage, 100 is default
agent_get_accuracy_modifier              = 2066  # (agent_get_accuracy_modifier, <destination>, <agent_id>),
                                                 # output value is in percentage, 100 is default, value can be between [0..1000]
agent_get_speed_modifier                 = 2067  # (agent_get_speed_modifier, <destination>, <agent_id>), 
                                                 # output value is in percentage, 100 is default, value can be between [0..1000]
agent_get_reload_speed_modifier          = 2068  # (agent_get_reload_speed_modifier, <destination>, <agent_id>), 
                                                 # output value is in percentage, 100 is default, value can be between [0..1000]
agent_get_use_speed_modifier             = 2069  # (agent_get_use_speed_modifier, <destination>, <agent_id>), 
                                                 # output value is in percentage, 100 is default, value can be between [0..1000]


agent_set_damage_modifier                = 2091  # (agent_set_damage_modifier, <agent_id>, <value>),
                                                 # Version 1.153+. Changes the damage delivered by this agent. Value is in percentage, 100 is default, 1000 is max possible value.
agent_set_accuracy_modifier              = 2092  # (agent_set_accuracy_modifier, <agent_id>, <value>),
                                                 # Version 1.153+. Changes agent's accuracy (with ranged weapons?). Value is in percentage, 100 is default, value can be between [0..1000]
agent_set_speed_modifier                 = 2093  # (agent_set_speed_modifier, <agent_id>, <value>),
                                                 # Version 1.153+. Changes agent's speed. Value is in percentage, 100 is default, value can be between [0..1000]
agent_set_reload_speed_modifier          = 2094  # (agent_set_reload_speed_modifier, <agent_id>, <value>),
                                                 # Version 1.153+. Changes agent's reload speed. Value is in percentage, 100 is default, value can be between [0..1000]
agent_set_use_speed_modifier             = 2095  # (agent_set_use_speed_modifier, <agent_id>, <value>),
                                                 # Version 1.153+. Changes agent's speed with using various scene props. Value is in percentage, 100 is default, value can be between [0..1000]
agent_set_ranged_damage_modifier         = 2099  # (agent_set_ranged_damage_modifier, <agent_id>, <value>),
                                                 # Version 1.157+. Changes agent's damage with ranged weapons. Value is in percentage, 100 is default, value can be between [0..1000]
remember they are in %, so you need to get the current value and apply a bonus to it. Like

get_value => value = 100%
add_bonus => value = old_value + 10 = 100 + 10 = 110%
set_new_value => new_value = 110%

if you still want to modify the troop for some reason than you will need to keep a track of the stats and reset them after the mission is over. Use a global and add the code to the mission_template or menus.
 
Best answers
0
@kalarhan
I added look like but global value not working.
lead_charge

(3, 0, ti_once, [(get_player_agent_kill_count, ":kill_count"),
(gt,":kill_count",5),
(assign,":kill_count","$base_kills_2"),
  ],
 
  [
      (get_player_agent_no, ":player_agent"),
    (agent_play_sound,":player_agent", "snd_man_victory"),
    (agent_set_animation, ":player_agent", "anim_cheer",1),
(troop_raise_attribute, "trp_player", ca_strength, 1),
(call_script,"script_change_troop_renown", "trp_player", 12),
(tutorial_message_set_background, 1),
        (tutorial_message_set_size, 20, 20),
(tutorial_message,"@You killed 70 enemies, you gain 10 renown and your strenght increased, +1 Strenght",0,7),
        ]),
game_menus,
(try_begin),
      (eq, "$g_battle_result", 1),
      (eq, "$g_enemy_fit_for_battle", 0),
      (str_store_string, s11, "@You were victorious!"),
  #70 adam
(get_player_agent_kill_count,"$base_kills_2",0),

#      (play_track, "track_bogus"), #clear current track.
#      (call_script, "script_music_set_situation_with_culture", mtf_sit_victorious),
      (try_begin),
        (gt, "$g_friend_fit_for_battle", 1),
        (set_background_mesh, "mesh_pic_victory"),
      (try_end),
    (else_try),
I added look like, but kill count not reset.
 

Pitch

Sergeant at Arms
WBNWVCM&BWF&S
Best answers
8
Create global variable like "$g_cur_kills".

In your mission , on agent kill, check if killer agent is player.

If yes add +1 to $g_cur_kills.

Later check if $g_cur_kills is greater or equal 5.

If its true, add agent buffs.

Also make it once(if you want that) or create another global variable like;

Code:
(try_begin),
(gt, "$g_cur_kills", 5),
(eq, "$g_buff_activated", 0),
###add buffs
(assign "$g_buff_activated", 1),
(try_end),
 
Best answers
0
player kill 6 enemy he gain 1 str,  this not one time, I want to if others battles player kill 6 enemy he gain 1 str again, every battle player kills 6 enemy he must gain 1 str, so I want to reset player kills.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
36
frozenpainter said:
so I want to reset player kills
you keep the kills on a global and you consider the difference between the operation result and your global. You update the global at the start of the mission.

first mission
  operation value = 0
  $kills = 0
  :current_kills = 0
  ... after 5 minutes
  operation value = 5
  $kills = 0
  :current_kills = +5

second mission
  at mission start
    operation value = 5
    set $kills = 5
  ... after some time
    operation value = 20
    :current_kills = 20 - 5 = 15

that sort of thingy. A alternative is to simple use the kill trigger to keep track of the kill agent inside a mission. If the agent is the player and the number of kills is above something, give a bonus. Then you dont need to use that operation, but in the end is the same process. A global to keep count inside the mission, that you need to reset every mission, and a trigger to control it.

Code:
ti_on_agent_killed_or_wounded = -26.0 # Agent has been defeated in battle (killed or wounded)
    # trigger param 1 = defeated agent_id
    # trigger param 2 = attacker agent_id
    # trigger param 3 = wounded flag: 0 = agent is killed, 1 = agent is wounded
    # If (set_trigger_result) with non-zero parameter is used in the code, it will override the agent's fate. Use value of 1 to force kill, and 2 to force wounded.
 
Status
Not open for further replies.