Author Topic: Hide factions?  (Read 2377 times)

0 Members and 1 Guest are viewing this topic.

Offline Mercuri

  • Second Lieutenant
  • *
  • Posts: 346
  • Spanish King's Walloon Guard
    • View Profile
    • Comunidad Gamer Hispana
  • Nick: 2aBH_Mercuri / 5thFL_JacksonTeller
  • Side: Confederacy
Hide factions?
« on: November 11, 2014, 05:31:12 pm »
Hi, I want to know if it's posible to hide factions and not remove it, I'm making a mod and I only need to do that to finish it.
Cheers.

Offline Mercuri

  • Second Lieutenant
  • *
  • Posts: 346
  • Spanish King's Walloon Guard
    • View Profile
    • Comunidad Gamer Hispana
  • Nick: 2aBH_Mercuri / 5thFL_JacksonTeller
  • Side: Confederacy
Re: Hide factions?
« Reply #1 on: November 14, 2014, 04:04:59 pm »
I posted in Taleworlds also, and an user helped me so I repost here because maybe anyone needs help

You can. The question is, how well do you want to hide the faction  :lol:
1) Easy
#To simply hide the faction:
(faction_set_note_available, ":fac_30", 0),

2) Medium
#But if you want to completely disable the faction, you have to do something about the range kingdoms_begin, kingdoms_end:
(try_for_range, ":kingdom", kingdoms_begin, kingdoms_end),

You can move the faction outside of that range, by adding a global variable:
kingdoms_end = "$g_kingdoms_end"
where you define "$g_kingdoms_end", based on a script.
Downside is, that you can only disable/enable the last faction, not a faction in-between.

3) Great
It should also be possible, to completely get rid of (try_for_range, ":kingdom", kingdoms_begin, kingdoms_end), by using a troop as a list, where you store all existing and active kingdoms inside the troop and then just iterate through that troop. That way you can disable any kingdom.

For details, check out Lumos list script. It's pretty cool:
http://forums.taleworlds.com/index.php/topic,8652.msg6845772.html#msg6845772

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: Hide factions?
« Reply #2 on: December 09, 2014, 07:17:12 pm »
That sounds pretty complicated and I dont even know if someone actually got it working in NW by  following those instructions. This is how i did it in Iron Europe. All you are going to touch are 2 files: module_factions and module_scripts, really.

Let's start from module_factions. This is how it looks like at the beginning in a NW Vanilla 1.104 Module System:

Code
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.15)], [], 0x888888),
# 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),

  ("player_faction","Player Faction",0, 0.9, [], []),
  ("player_supporters_faction","Player's Supporters",0, 0.9, [("player_faction",1.00),("outlaws",-0.05)], [], 0xFF4433), #changed name so that can tell difference if shows up on map
  ("britain",  "United Kingdom",    0, 0.9, [("outlaws",-0.05),], [], 0xCCBB99),
  ("france",  "Empire Francais", 0, 0.9, [("outlaws",-0.05)], [], 0xCC99FF),
  ("prussia",  "Konigreich Preussen", 0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),
  ("russia",  "Rossiyskaya Imperiya",    0, 0.9, [("outlaws",-0.05)], [], 0x33DDDD),
  ("austria",  "Kaisertum Osterreich",  0, 0.9, [("outlaws",-0.05)], [], 0x33DD33),
  ("kingdoms_end","{!}kingdoms_end", 0, 0,[], []),
  ("kingdom_6",  "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("kingdom_7",  "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("kingdom_8",  "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("kingdom_9",  "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("kingdom_10", "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("british_ranks", "British Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),
  ("french_ranks", "French Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCC99FF),
  ("prussian_ranks", "Prussian Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),
  ("russian_ranks", "Russian Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),
  ("austrian_ranks", "Austrian Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),

]

What you need to do is just move the string kingdoms_end up to the point where you want to exclude certain factions. For instance, should we want to remove Prussia, Austria and Russia, we are going to put the following string just below the last faction we want to include.

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

Move it like so:

Code
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.15)], [], 0x888888),
# 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),

  ("player_faction","Player Faction",0, 0.9, [], []),
  ("player_supporters_faction","Player's Supporters",0, 0.9, [("player_faction",1.00),("outlaws",-0.05)], [], 0xFF4433), #changed name so that can tell difference if shows up on map
  ("britain",  "United Kingdom",    0, 0.9, [("outlaws",-0.05),], [], 0xCCBB99),
  ("france",  "Empire Francais", 0, 0.9, [("outlaws",-0.05)], [], 0xCC99FF),
  ("kingdoms_end","{!}kingdoms_end", 0, 0,[], []),
  ("prussia",  "Konigreich Preussen", 0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),
  ("russia",  "Rossiyskaya Imperiya",    0, 0.9, [("outlaws",-0.05)], [], 0x33DDDD),
  ("austria",  "Kaisertum Osterreich",  0, 0.9, [("outlaws",-0.05)], [], 0x33DD33),
  ("kingdom_6",  "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("kingdom_7",  "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("kingdom_8",  "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("kingdom_9",  "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("kingdom_10", "Invalid Faction",  0, 0.9, [("outlaws",-0.05)], [], 0xDDDD33),
  ("british_ranks", "British Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),
  ("french_ranks", "French Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCC99FF),
  ("prussian_ranks", "Prussian Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),
  ("russian_ranks", "Russian Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),
  ("austrian_ranks", "Austrian Other Ranks",  0, 0.9, [("outlaws",-0.05)], [], 0xCCBB99),
]

After you've done this, let's go to module_scripts. Now we want to change the "Combo button" for the factions selection so that it just considers 2 factions, or the amount of factions you specified. Ah, this also works in case you're adding more than 5 factions to the game and they don't show up correctly in the selection menu. Adding a new faction would require me more time to explain how to do it, but let's go back on topic:

Search for the script multiplayer_fill_available_factions_combo_button, CTRL + F and you should get this nice wall of commented code:

Code
  ("multiplayer_fill_available_factions_combo_button",
   [
     (store_script_param, ":overlay_id", 1),
     (store_script_param, ":selected_faction_no", 2),
##     (store_script_param, ":opposite_team_selected_faction_no", 3),
##     (try_for_range, ":cur_faction", "fac_britain", "fac_kingdoms_end"),
##       (try_begin),
##         (eq, ":opposite_team_selected_faction_no", ":cur_faction"),
##         (try_begin),
##           (gt, ":selected_faction_no", ":opposite_team_selected_faction_no"),
##           (val_sub, ":selected_faction_no", 1),
##         (try_end),
##       (else_try),
##         (str_store_faction_name, s0, ":cur_faction"),
##         (overlay_add_item, ":overlay_id", s0),
##       (try_end),
##     (try_end),
##     (val_sub, ":selected_faction_no", "fac_britain"),
##     (overlay_set_val, ":overlay_id", ":selected_faction_no"),
     (try_for_range_backwards, ":cur_faction", factions_begin, factions_end),
       (str_store_faction_name, s0, ":cur_faction"),
       (overlay_add_item, ":overlay_id", s0),
     (try_end),
     
     (val_sub, ":selected_faction_no", "fac_britain"),
     (store_sub,":selected_faction_no", 4,":selected_faction_no"),
     (overlay_set_val, ":overlay_id", ":selected_faction_no"),
     ]),

In this script, there is only one thing we are going to touch. Do you see that 4 I highlighted in red? That's the amount of selectable factions - 1. So if we just want to have 2 factions in our mod, we are going to change that number to 1. By the way, why does it show the number of factions-1 ? I don't know, most likely Vince was drunk. So we are going to have the following code:

Code
  ("multiplayer_fill_available_factions_combo_button",
   [
     (store_script_param, ":overlay_id", 1),
     (store_script_param, ":selected_faction_no", 2),
##     (store_script_param, ":opposite_team_selected_faction_no", 3),
##     (try_for_range, ":cur_faction", "fac_britain", "fac_kingdoms_end"),
##       (try_begin),
##         (eq, ":opposite_team_selected_faction_no", ":cur_faction"),
##         (try_begin),
##           (gt, ":selected_faction_no", ":opposite_team_selected_faction_no"),
##           (val_sub, ":selected_faction_no", 1),
##         (try_end),
##       (else_try),
##         (str_store_faction_name, s0, ":cur_faction"),
##         (overlay_add_item, ":overlay_id", s0),
##       (try_end),
##     (try_end),
##     (val_sub, ":selected_faction_no", "fac_britain"),
##     (overlay_set_val, ":overlay_id", ":selected_faction_no"),
     (try_for_range_backwards, ":cur_faction", factions_begin, factions_end),
       (str_store_faction_name, s0, ":cur_faction"),
       (overlay_add_item, ":overlay_id", s0),
     (try_end),
     
     (val_sub, ":selected_faction_no", "fac_britain"),
     (store_sub,":selected_faction_no",1,":selected_faction_no"),
     (overlay_set_val, ":overlay_id", ":selected_faction_no"),
     ]),

Happy coding!!

« Last Edit: December 09, 2014, 10:18:16 pm by DanyEle »



Offline Mercuri

  • Second Lieutenant
  • *
  • Posts: 346
  • Spanish King's Walloon Guard
    • View Profile
    • Comunidad Gamer Hispana
  • Nick: 2aBH_Mercuri / 5thFL_JacksonTeller
  • Side: Confederacy
Re: Hide factions?
« Reply #3 on: December 10, 2014, 04:23:55 pm »
Hello DanyEle and thx for reply!

But I must say that it didn't works for me, or only works a little.  I did what you say but it didn't works 100%
Spoiler





[close]

As you can see I only want two factions (as in your example) The Carlist Side (Britain) and The Isabeline Side (France), so the 1st and the 2nd factions.

What works and what not?
The button number works, it only show that 2 factions, and If you start the new game without changing anithing it works perfectly.

Spoiler


[close]

The problem starts when you click the button, If you do that it selects the second faction and you can't change it. So it looks like:
Spoiler


[close]

And if you start the new game now the first faction is Prussia with the Russian Empire sub-name xD
Spoiler
[close]

So maybe I did something wrong or maybe you did another thing in IE that we are missing?
Cheers

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: Hide factions?
« Reply #4 on: December 10, 2014, 09:47:47 pm »
Perhaps I've forgotten mentioning something, but I can't really remember what it is, as I did it over a year ago.. Yeaah, perhaps set the new bound for factions_end in module_constants or check for factions constraints in header_common.