Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Ruthven said:
Ah, thought so. I'll have to find a workaround then. Cheers.

if you show us the code, and explain what you are trying to do, we may be able to help. You can override the engine events, just need to know why and when  :mrgreen:



MadGuarang said:
Hi guys! Some players of my mod suggested that minor faction parties could capture towns, or castles.

minor, major. Those are names you gave them. They are all factions and as the events/code used to control AI and ownership is open on modsys you can do whatever you want with it.

what is a "minor" faction on your mod? What is the difference between a "minor", a "minor with a center", and a "major" ?
 
what is a "minor" faction on your mod? What is the difference between a "minor", a "minor with a center", and a "major" ?

Major factions are those coded by original Warband, ie Sarranids are called "Sanitarium Cosnpiracy" but I haven't made any significant changes to them.

Minor faction are for my understanding "Outlaws" or "Deserters". I created a lot of factions just by putting more names. To be exact here is my factions file:
Code:
from header_factions import *

####################################################################################################################
#  Each faction record contains the following fields:
#  1) Faction id: used for referencing factions in other files.
#     The prefix fac_ is automatically added before each faction id.
#  2) Faction name.
#  3) Faction flags. See header_factions.py for a list of available flags
#  4) Faction coherence. Relation between members of this faction.
#  5) Relations. This is a list of relation records.
#     Each relation record is a tuple that contains the following fields:
#    5.1) Faction. Which other faction this relation is referring to
#    5.2) Value: Relation value between the two factions.
#         Values range between -1 and 1.
#  6) Ranks
#  7) Faction color (default is gray)
####################################################################################################################

default_kingdom_relations = [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.05),("mountain_bandits", -0.02),("forest_bandits", -0.02),("undeads",-0.1)]
factions = [
  ("no_faction","No Faction",0, 0.9, [], []),
  ("commoners","Commoners",0, 0.1,[("player_faction",0.1)], []),
  ("outlaws","Outlaws", max_player_rating(-30), 0.5,[("commoners",-0.6),("player_faction",-0.25)], [], 0xd00000),
# Factions before this point are hardwired into the game end their order should not be changed.

  ("neutral","Neutral",0, 0.1,[("player_faction",0.0)], [],0xFFFFFF),
  ("innocents","Innocents", ff_always_hide_label, 0.5,[("outlaws",-0.05)], []),
  ("merchants","Merchants", ff_always_hide_label, 0.5,[("outlaws",-0.5),], []),

  ("dark_knights","{!}Dark Knights", 0, 0.5,[("innocents",-0.9),("player_faction",-0.4)], []),

  ("culture_1",  "{!}culture_1", 0, 0.9, [], []),
  ("culture_2",  "{!}culture_2", 0, 0.9, [], []),
  ("culture_3",  "{!}culture_3", 0, 0.9, [], []),
  ("culture_4",  "{!}culture_4", 0, 0.9, [], []),
  ("culture_5",  "{!}culture_5", 0, 0.9, [], []),
  ("culture_6",  "{!}culture_6", 0, 0.9, [], []),

#  ("swadian_caravans","Swadian Caravans", 0, 0.5,[("outlaws",-0.8), ("dark_knights",-0.2)], []),
#  ("vaegir_caravans","Vaegir Caravans", 0, 0.5,[("outlaws",-0.8), ("dark_knights",-0.2)], []),

  ("player_faction","Player Faction",0, 0.9, [], [],0x2ccb4a),
  ("player_supporters_faction","Player's Supporters",0, 0.9, [("player_faction",1.00),("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.5),("mountain_bandits", -0.05),("forest_bandits", -0.05),("doomsday_cultists",-1.0),("a_pirates",-0.3)], [], 0x6fcb2c), #changed name so that can tell difference if shows up on map
  ("kingdom_1",  "People's Democratic Republic of Morlok", 0, 0.9, [("undeads",-0.05),("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.25),("forest_bandits", 0.2)], [], 0x4c473d),
  ("kingdom_2",  "Weimear Reich",    0, 0.9, [("deithwen_brigade",1.00),("undeads",-0.05),("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x35c191),
  ("kingdom_3",  "Alien Shogunate", 0, 0.9, [("deithwen_brigade",-0.2),("manhunters",-0.3),("undeads",-0.05),("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0x339bdd),
  ("kingdom_4",  "Fantasy Magioucracy",    0, 0.9, [("deithwen_brigade",-0.2),("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", 0.25),("forest_bandits", -0.05)], [], 0xCC99FF),
  ("kingdom_5",  "United States of Renaissance",  0, 0.9, [("undeads",-0.05),("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05)], [], 0xff4e00),
  ("kingdom_6",  "Sanitarium Conspiracy",  0, 0.9, [("undeads",-0.05),("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02)], [], 0xDDDD33),

##  ("kingdom_1_rebels",  "Swadian rebels", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0xCC2211),
##  ("kingdom_2_rebels",  "Vaegir rebels",    0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0xCC2211),
##  ("kingdom_3_rebels",  "Khergit rebels", 0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0xCC2211),
##  ("kingdom_4_rebels",  "Nord rebels",    0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0xCC2211),
##  ("kingdom_5_rebels",  "Rhodok rebels",  0, 0.9, [("outlaws",-0.05),("peasant_rebels", -0.1),("deserters", -0.02),("mountain_bandits", -0.05),("forest_bandits", -0.05)], [], 0xCC2211),

  ("kingdoms_end","{!}kingdoms_end", 0, 0,[], []),

  ("robber_knights",  "{!}robber_knights", 0, 0.1, [], []),

  ("khergits","{!}Khergits", 0, 0.5,[("player_faction",0.0)], []),
  ("black_khergits","{!}Black Khergits", 0, 0.5,[("player_faction",-0.3),("kingdom_1",-0.02),("kingdom_2",-0.02)], []),

##  ("rebel_peasants","Rebel Peasants", 0, 0.5,[("vaegirs",-0.5),("player_faction",0.0)], []),

  ("manhunters","Pirate Hunters", 0, 0.5,[("kingdom_3", -0.2),("a_pirates", -1),("deserters", -0.5),("outlaws",-0.6),("player_faction",0.1)], [], 0x608cfc),
  ("rogue_manhunters","Rogue Pirate Hunters", 0, 0.5,[("doomsday_cultists",-0.1),("kingdom_6",0.2),("kingdom_1",-0.2),("kingdom_2",-0.2),("manhunters",-0.3),("undeads",-0.05),("kingdom_3",-0.55),("outlaws",-0.6),("player_faction",0.1)], [], 0x0036ff),
  ("deserters","Deserters", 0, 0.5,[("commoners",-0.7),("manhunters",-0.6),("merchants",-0.5),("player_faction",-0.1)], [], 0x1c7011),
  ("mountain_bandits","Scoiatael Commando", 0, 0.5,[("deserters", -0.05),("kingdom_2", -0.2),("kingdom_5", -0.2),("kingdom_4", 0.2),("deithwen_brigade", -0.2)], [], 0x237733),
  ("deithwen_brigade","Deithwen Death Squad", 0, 0.5,[("deserters", -0.05),("kingdom_2", 0.2),("kingdom_5", 0.2),("kingdom_4", 0.2)], [], 0x116ab6),
  ("forest_bandits","Scav Mutated Morloks", 0, 0.5,[("deserters", -0.05),("kingdom_1", 0.2),("kingdom_3", 0.2),("doomsday_cultists", -0.2),("commoners", -0.2)], [], 0xffb464),
  #like fantasy
  ("undeads","Undeads", 0, 0.5, [("player_faction",-0.2),("deserters", -0.05),("kingdom_1", -0.2),("kingdom_2", -0.2),("kingdom_3", -0.2),("kingdom_4", 0.2),("kingdom_5", -0.2),("kingdom_6", -0.2)],[], 0x52245d),
  #like morlok
  ("doomsday_cultists","Doomsday Cultists", 0, 0.5,[("outlaws",0.2),("commoners",-0.2),("kingdom_1", 0.2),("kingdom_2", -0.2),("kingdom_3", -0.2),("kingdom_4", -0.4),("kingdom_5", -0.2),("kingdom_6", -0.2)], [], 0xe97257),
  #like alien
  ("a_pirates","Alien Pirates", 0, 0.5,[("techno_mages", 0.05),("player_faction", -0.05),("commoners",-0.7),("kingdom_1", -0.2),("kingdom_2", -0.2),("kingdom_3", 0.2),("kingdom_4", -0.4),("kingdom_5", -0.2),("kingdom_6", -0.2)], [], 0xffa200),
  #like sanitarium
  ("stargate","Star Gate Expedition", 0, 0.5,[("crazy_pikt", -0.1),("player_faction", -0.15),("commoners",-0.7),("kingdom_1", -0.2),("kingdom_2", -0.2),("kingdom_3", 0.2),("kingdom_4", -0.4),("kingdom_5", -0.2),("kingdom_6", 0.2)], [], 0x924c19), 
  #neutral good don't like medievals
  ("techno_mages","Techno Mages", 0, 0.5,[("a_pirates", 0.05),("deserters", -0.2),("old_gods", -0.2),("crazy_pikt", -0.2)], [], 0x00fff6),  
  #neutral good like weimear
  ("old_gods","Old Gods Crusaders", 0, 0.5,[("undeads",-0.3),("outlaws",-0.2),("crazy_pikt", -0.2),("deserters", -0.5),("kingdom_2", 0.2),("kingdom_3", -0.2),("a_pirates", -0.2),("techno_mages", -0.2)], [], 0xffffff),
  #neutral good like Renaissance
  ("lost_legion","Lost Legion", 0, 0.5, [("crazy_pikt", -0.2),("deserters", -0.05),("kingdom_1", -0.2),("kingdom_2", -0.2),("kingdom_3", 0.2),("kingdom_4", -0.2),("kingdom_5", 0.2),("kingdom_6", -0.2)],[], 0xff0048),
  #neutral evil, like bandits, outlaws
  ("crazy_pikt","Crazy Pikts", 0, 0.5,[("player_faction",-0.2),("outlaws",0.2),("kingdom_1", -0.2),("kingdom_2", -0.2),("kingdom_3", -0.2),("kingdom_4", -0.2),("kingdom_5", 0.2),("kingdom_6", -0.2)], [], 0xff4800),
  #minor_factions_end
  #("undeads","{!}Undeads", max_player_rating(-30), 0.5,[("commoners",-0.7),("player_faction",-0.5)], []),
  ("slavers","{!}Slavers", 0, 0.1, [], []),
  ("peasant_rebels","{!}Peasant Rebels", 0, 1.0,[("noble_refugees",-1.0),("player_faction",-0.4)], []),
  ("noble_refugees","{!}Noble Refugees", 0, 0.5,[], []),
  
  #
  #minor cultures start
  
# ("culture_7",  "{!}culture_7", 0, 0.9, [], []),
# ("culture_8",  "{!}culture_8", 0, 0.9, [], []),
 
 
]
# modmerger_start version=201 type=4
try:
    component_name = "factions"
    var_set = { "factions":factions,"default_kingdom_relations":default_kingdom_relations, }
    from modmerger import modmerge
    modmerge(var_set, component_name)
except:
    raise
# modmerger_end

I don't have minor factions with centers. Major faction is in my understanding faction created by the tutorial on factions with all lords, ladies and so on.

My minor factions have only one npc hero lord, but it is only "working" as boss, very powerful unit that can be captured.

If you could also look at my question regarding problem with ragdolls :smile: ? It is in the same post that question about factions....
 
Be careful about adding factions with a single lord, or without centres, or without a culture, or whatever. Plenty of codes cycle between kingdoms_begin and kingdoms_end (defined in module_constants), and most of the codes expect all the factions to be the same and there is potential for bugs and glitches if this rule isn't followed.

The problem with sieges is that the code requires that the besiegers be part of a regular faction with a king and settlements, so even if you were to give them exceptions in the code they might never actually besiege a settlement, because they never make the decision to do so.

Have a look at the code for starting a siege, and create your own for the minor faction. Look at what needs to be done for the AI to lay siege to a settlement, and do that same process in your new code.
 
Be careful about adding factions with a single lord, or without centres, or without a culture, or whatever. Plenty of codes cycle between kingdoms_begin and kingdoms_end (defined in module_constants), and most of the codes expect all the factions to be the same and there is potential for bugs and glitches if this rule isn't followed.

I've divided factions to kingdoms and minor_factions, as stated in constants:

kingdoms_begin = "fac_player_supporters_faction"
kingdoms_end = "fac_kingdoms_end"

minor_factions_begin = "fac_manhunters"
minor_factions_end = "fac_slavers"

I tried to "find all" for instance fac_manhunters and didn't find any "dangerous" scripts? I thought that I can use this "minor faction" feature safely?

I tested this for over a year and I think that it is all ok. Or am I wrong?* However, thanks for the warning.

Have a look at the code for starting a siege, and create your own for the minor faction. Look at what needs to be done for the AI to lay siege to a settlement, and do that same process in your new code.

THANK YOU, that is what I've needed :smile:

* Some people have stated that lords of kingdom factions stays in castles too much, but it is probably due to mistake I did: I made greater armies, but not enough raised salaries for lords. Now testing this propblem.


AND the second qustion about ragdolls: what is happenig, or why?
https://tw.greywool.com/i/I4FbX.jpg or better to understand my problem with ragdolls there is a certain point on this video https://youtu.be/jgGX5vBtff8?t=644. All I did was following barf tutorial on adding races I think....


@jacobhinds @kalarhan Thanks very much for all help and advices!
 
MadGuarang said:
I've divided factions to kingdoms and minor_factions

but not enough raised salaries for lords

best to create a fork of your project (keep the current as a safe backup). As you go deep into doing the changes for AI, balance, etc, you will create a ton of bugs/problems that you will need to solve along the way

here is a example: what happens when a "minor" faction conquers a center? The parties spawn at random locations in the world. Should they now travel to defend the new center? Live there? Where should they spawn? What happens when they lose the center? Should they try to conquer another? And so on. Those behaviours are not part of the AI for a bandit faction.

You may want to consider a few easier alternatives:
1) Let "minor" factions sack towns/castles/villages, but not conquer them. They can still attack, siege, etc, but they leave soon after wining the battle
2) Create inactive factions that represent the bandit factions. Activate them if they manage to conquer a center (similar to the Rebel faction the player has), that way they would be a normal "major" faction (transfer some troops, 1-2 lords, etc to the new faction, and keep the bandit faction as a friend/ally)


lords: create a trigger that prints the money + army size of lords every few hours (turn on EDIT MODE), that way you can test if your economy is working well for them.
 
Hey, I have a new error here. Can someone help me with these?

9b7992bc285528decadbc75ebad1b7dd.png


1591fd8efaa0ed60bffba9dc75952dba.png


I swear I didnt touch these things, i dont know what to do. Now, everytime I launch the mod it crashes when I start a new game.
 
Heinrik von Waiblingen said:
Hey, I have a new error here. Can someone help me with these?

you can copy the text from the terminal (no need to take a screenshot of it). A example (depends on your version): left click to select the area (it will turn white), right click to copy to memory. You can also right click the window top and use the menu (Edit -> select all), or use the shortcut CTRL+A and CTRL+C

now read what the error tells you, and solve one issue at time

1) upgrade is trying to find a troop "new_troop_1" but it is not working (either the troop doesn't exist, or you have invalid syntax on troops)

2) pretender_1 is missing. If you delete that one, you will need to update your module_constants.py and any reference to it on any other file

...
 
kalarhan said:
Heinrik von Waiblingen said:
Hey, I have a new error here. Can someone help me with these?

you can copy the text from the terminal (no need to take a screenshot of it). A example (depends on your version): left click to select the area (it will turn white), right click to copy to memory. You can also right click the window top and use the menu (Edit -> select all), or use the shortcut CTRL+A and CTRL+C

now read what the error tells you, and solve one issue at time

1) upgrade is trying to find a troop "new_troop_1" but it is not working (either the troop doesn't exist, or you have invalid syntax on troops)

2) pretender_1 is missing. If you delete that one, you will need to update your module_constants.py and any reference to it on any other file

...

Yes, I changed the pretender thing, I was so dumb posting that error. Reading it again I fixed it with not so many issues.

By the way, what really bothers me is that error in process_troops, I really didnt even open that file. :-\
 
Heinrik von Waiblingen said:
By the way, what really bothers me is that error in process_troops, I really didnt even open that file. :-\

process = do stuff with a file
_troops = do the stuff with the file module_troops.py


process_troops.py -:> take the module_troops.py and create the troops.txt


but, says the compiler, the file module_troops.py is bugged? Well, you tell the compiler, show a error message so the modder can fix that file!  :mrgreen:
 
Fine, I solved everything. Thank you :smile:


Another, but different thing: Since I added new factions and nobles I run out of banners, there are not enough banners for everyone. Is there a banner pack I can put in the .py modules? I just found those useful for the .txt files.
 
Okay, so I have have no idea how battle scenes are different from regular scenes. How do battle scenes work? I seem to stumble upon some smaller battle scenes sometimes, and I was wondering how to fix that. Also, if they auto generate, would it still be possible to create some proper custom battle scenes and get a rotation of them going? I feel like a scrub concerning this. Can someone please enlighten me?
 
Reus said:
Also, if they auto generate, would it still be possible to create some proper custom battle scenes and get a rotation of them going?

they are random in Native, but you can change this. You can make them bigger, smaller, not random, custom made and rotate, etc.

Look for them on module_scenes.py, and how they are used
Code:
  ("random_scene_steppe",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "outer_terrain_steppe"),
  ("random_scene_plain",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "outer_terrain_plain"),
  ("random_scene_snow",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "outer_terrain_snow"),
  ("random_scene_desert",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x0000000229602800000691a400003efe00004b34000059be",
    [],[], "outer_terrain_desert_b"),
  ("random_scene_steppe_forest",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x300028000003e8fa0000034e00004b34000059be",
    [],[], "outer_terrain_plain"),
  ("random_scene_plain_forest",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x300028000003e8fa0000034e00004b34000059be",
    [],[], "outer_terrain_plain"),
  ("random_scene_snow_forest",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x300028000003e8fa0000034e00004b34000059be",
    [],[], "outer_terrain_snow"),
  ("random_scene_desert_forest",sf_generate|sf_randomize|sf_auto_entry_points,"none", "none", (0,0),(240,240),-0.5,"0x300028000003e8fa0000034e00004b34000059be",
    [],[], "outer_terrain_desert"),
not the sf_generate|sf_randomize|sf_auto_entry_points flags


a example is this script to select a random scene
Code:
  # script_setup_random_scene
  # Input: arg1 = center_no, arg2 = mission_template_no
  # Output: none
  ("setup_random_scene",
    [
      (party_get_current_terrain, ":terrain_type", "p_main_party"),
      (assign, ":scene_to_use", "scn_random_scene"),
      (try_begin),
        (eq, ":terrain_type", rt_steppe),
        (assign, ":scene_to_use", "scn_random_scene_steppe"),
      (else_try),
        (eq, ":terrain_type", rt_plain),
        (assign, ":scene_to_use", "scn_random_scene_plain"),
      (else_try),
        (eq, ":terrain_type", rt_snow),
        (assign, ":scene_to_use", "scn_random_scene_snow"),
      (else_try),
        (eq, ":terrain_type", rt_desert),
        (assign, ":scene_to_use", "scn_random_scene_desert"),
      (else_try),
        (eq, ":terrain_type", rt_steppe_forest),
        (assign, ":scene_to_use", "scn_random_scene_steppe_forest"),
      (else_try),
        (eq, ":terrain_type", rt_forest),
        (assign, ":scene_to_use", "scn_random_scene_plain_forest"),
      (else_try),
        (eq, ":terrain_type", rt_snow_forest),
        (assign, ":scene_to_use", "scn_random_scene_snow_forest"),
      (else_try),
        (eq, ":terrain_type", rt_desert_forest),
        (assign, ":scene_to_use", "scn_random_scene_desert_forest"),
      (else_try),
        (eq, ":terrain_type", rt_water),
        (assign, ":scene_to_use", "scn_water"),
      (else_try),
        (eq, ":terrain_type", rt_bridge),
        (assign, ":scene_to_use", "scn_random_scene_plain"),
      (try_end),
      (jump_to_scene,":scene_to_use"),
  ]),

a example of feature to control scenes is what they did in VC. You get special scenes for bridge battles (if near a bridge), coast scenes battles (if near the sea), and the unique scenes for places like ruins, etc if you are near them when battle begins
 
kalarhan said:
they are random in Native, but you can change this. You can make them bigger, smaller, not random, custom made and rotate, etc.
So it is possible to simply change the size in the module_scenes file, yeah? I had a look through it earlier, and figured that the (240, 240) could be the size of the scene, but they all seem to be the same size, which doesn't make much sense considering some of them are smaller in-game. Unless they just feel smaller without actually being it for some reason. Could it just be that it places the entry points close to each other?
 
Does triangulating a mesh ruin UV coordinates? I've spent an hour or so making a good UV map and I just realized I haven't triangulated the mesh yet, hoping I'm not going to have to do everything again.
 
Yarrum said:
Does triangulating a mesh ruin UV coordinates? I've spent an hour or so making a good UV map and I just realized I haven't triangulated the mesh yet, hoping I'm not going to have to do everything again.

In my experience it's usually fine.
 
why there is no lord in the map even town castle ??? http://imgur.com/a/c4Ogc im adding KAOS political in my mod and i have added some function into it and even there is no icon of my character

 
HarryPham123 said:
there is no icon of my character

your party is created on script "game_start", seems you broke something. Add some logging messages and check for error messages on a new game, or start over and test often as you add new OSP

Could be something else as well, but for that you need to test, test, and, hum, test  :grin:
 
Status
Not open for further replies.
Back
Top Bottom