Author Topic: Factionize items tool  (Read 19335 times)

0 Members and 1 Guest are viewing this topic.

Rongar

  • Master Knight
  • *
  • Cave canem
    • View Profile
  • Faction: Sarranid
  • M&BWB
Factionize items tool
« on: June 01, 2010, 06:43:16 PM »
What is that

In warband items have faction field that allows restricting variety of merchant's inventory.
E.g. an charger that has factions swadian and khergits is sold only by horse trades in khergis and  swadian towns.
ATM in native almost no items have set  faction field.

This is a small tool to put in sync a faction field of items and its current distribution of items between  troops.
Factionize_items
The tool set factions of troops that use item and set 

Where to get

http://www.mbrepository.com/download.php?id=1969&f=factionize_items.zip

How to use

Factionize items works with python files.
You need to extract file from archive (factionize_items.bat and factionize_items.py) to pythonic module folder.
Run factionize_items.bat.
After that you will get file module_items_factionize.py that will contain module_items_factionize.py with synced items factions.
Of course you still need to rename module_items_factionize.py to  module_items.py to get results in your module.

By default the tool does not touch items if they already have faction filed. To override such behavior you need to open  factionize_items.py and change
keep_old_faction=1
to
keep_old_faction=0



Have fun.


Factionize items tool
I hear and I forget.
I see and I remember.
I do and I understand...
 that would better if I heard.

iggorbb

  • Master Knight
  • *
  • ...meh...
    • View Profile
  • Faction: Vaegir
Re: Factionize items tool
« Reply #1 on: June 01, 2010, 08:43:26 PM »
Is this only for warband?
Бој не бије свијетло оружје, већ бој бије срце у јунака.

bb_osp

COGlory

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
Re: Factionize items tool
« Reply #2 on: June 01, 2010, 08:45:20 PM »
Applaudable tool!

FrisianDude

  • Coitus non Awesome
  • Archduke
  • *
  • Zis is Tshörman tärritorie!
    • View Profile
  • Faction: Neutral
  • MP nick: Liudulf Ward/Léodwulf
  • M&BWB
Re: Factionize items tool
« Reply #3 on: June 01, 2010, 08:48:12 PM »
Oh? Never realized items were factionizable now.
Nords ruled by King Ragnar, Khergits ruled by Sanjar Khan, Rhodoks ruled by King Graveth, Swadians ruled by King Harlaus, Vaegirs ruled by King Yaroglek. All those peoples live, fight, and die in the continent of Calradia. The Nords and Rhodoks field solely infantry and archers, the Swadians and Vaegirs have infantry, archers and cavalry and the Khergit field almost exclusively cavalry. No such things as "infarty" or "calvary" exist. Play Vikingr!

Rongar

  • Master Knight
  • *
  • Cave canem
    • View Profile
  • Faction: Sarranid
  • M&BWB
Re: Factionize items tool
« Reply #4 on: June 01, 2010, 08:54:48 PM »
Is this only for warband?
Yes, only for warband. There is no faction field for items in M&B.
Btw, there is a script that does almost the same for M&B.

« Last Edit: June 01, 2010, 09:07:03 PM by Rongar »


Factionize items tool
I hear and I forget.
I see and I remember.
I do and I understand...
 that would better if I heard.

iggorbb

  • Master Knight
  • *
  • ...meh...
    • View Profile
  • Faction: Vaegir
Re: Factionize items tool
« Reply #5 on: June 01, 2010, 09:05:45 PM »
Tnx. :D
Бој не бије свијетло оружје, већ бој бије срце у јунака.

bb_osp

Kellick

  • Sergeant
  • *
    • View Profile
  • Faction: Neutral
  • WB
Re: Factionize items tool
« Reply #6 on: June 08, 2010, 11:35:00 PM »
I haven't been able to get this to work. Probably due to lack of familiarity with the module system.
Instructions kind of vague on all but to be fair I have not put much time into it.

I have however been playing with Morgh's text tools since he added the field for it.
I found a couple things that might be of interest to anyone who wants to factionize thier items.

If you use fac_kingdom then when ownership of the town changes so does the goods list. This isn't automatic but will happen over time.
This is why others have noted that you can't get chargers anymore if the Rhodoks and Swadians are taken out.

Also if it is your holding then it will use player faction so for those highend items that you always buy you might want to make them player faction as well.

Finally I decided to see if using the fac_culture works and sure enough it does. As a quick try I set chargers to fac_culture_1 , started a new game, camped a few days and Swadians have chargers, Rhodoks do not. Now I expect that if the town is captured since as far as we know the culture doesn't change (which is why villages still give recruits of original faction I believe) so said town should always have said goods if you use culture instead of kingdom.

And of course you could mix and match if you like so some items go by kingdom and some by culture.

 :idea: If you used both then items would always be available in original place but get diluted down by whoever owns it currently
« Last Edit: June 08, 2010, 11:47:40 PM by Kellick »

Rongar

  • Master Knight
  • *
  • Cave canem
    • View Profile
  • Faction: Sarranid
  • M&BWB
Re: Factionize items tool
« Reply #7 on: June 09, 2010, 09:33:42 AM »


Quote
If you use fac_kingdom then when ownership of the town changes so does the goods list. This isn't automatic but will happen over time.
This is why others have noted that you can't get chargers anymore if the Rhodoks and Swadians are taken out.

That's probably somewhat native bug. It's too minor for bugtracker.  --- Obsolete. Fixed in  1.126
(click to show/hide)

Quote
Finally I decided to see if using the fac_culture works and sure enough it does. As a quick try I set chargers to fac_culture_1 , started a new game, camped a few days and Swadians have chargers, Rhodoks do not. Now I expect that if the town is captured since as far as we know the culture doesn't change (which is why villages still give recruits of original faction I believe) so said town should always have said goods if you use culture instead of kingdom.
I think it was luck. Chargers aren't that common for such experiments. Cultures have almost no influence (they are used as transient slot for setting banners and troop tires), imo they are redundant (e.g. in RusXIII i removed them without problem) they aren't used in merchant refresh code and I very doubt the engine can connect kingdom and culture itself.

« Last Edit: July 21, 2010, 01:26:50 PM by Rongar »


Factionize items tool
I hear and I forget.
I see and I remember.
I do and I understand...
 that would better if I heard.

GetAssista

  • Baron
  • *
  • TLD corovan robber
    • View Profile
  • Faction: Neutral
  • M&BWF&SWB
Re: Factionize items tool
« Reply #8 on: June 09, 2010, 09:51:43 AM »
Cultures have almost no influence (they are used as transient slot for setting banners and troop tires), imo they are redundant (e.g. in RusXIII i removed them without problem) they aren't used in merchant refresh code and I very doubt the engine can connect kingdom and culture itself.
I think they were meant to be cultures for spin-off factions in the beginning. But it turns out it 's easier to just copy faction slots from parent faction anyway :)
Engine connects facton and culture only through module system slots, nothing else

Rongar

  • Master Knight
  • *
  • Cave canem
    • View Profile
  • Faction: Sarranid
  • M&BWB
Re: Factionize items tool
« Reply #9 on: June 09, 2010, 10:32:44 AM »
I think they were meant to be cultures for spin-off factions in the beginning.
Another hypothesis they were supposed to be used as a memory extension in times when number of slots was limited.
Hardly we'll know truth =)

Engine connects facton and culture only through module system slots, nothing else
Sure, GetAssista, you know what I meant.
But I still want to clarify my thought. I believe calls like troop_add_merchandise_with_faction, which are used in refresh merchant's inventory to add items, unable to track cultures via kingdoms. And for correct use of cultures in refresh merchant's inventory it is necessary to rework triggers code to work with cultures instead of kingdoms.
« Last Edit: June 09, 2010, 10:59:52 AM by Rongar »


Factionize items tool
I hear and I forget.
I see and I remember.
I do and I understand...
 that would better if I heard.

GetAssista

  • Baron
  • *
  • TLD corovan robber
    • View Profile
  • Faction: Neutral
  • M&BWF&SWB
Re: Factionize items tool
« Reply #10 on: June 09, 2010, 12:36:39 PM »
Engine connects facton and culture only through module system slots, nothing else
Sure, GetAssista, you know what I meant.
But I still want to clarify my thought. I believe calls like troop_add_merchandise_with_faction...
Ah, wait, that's Warband. I'm not expert in WB MS, that's unfair  :D
In MB you have reference to culture only in music_set_culture, and that works just like faction

Edit: thinking of it, whole thread is about WB, so I rest my puny case )

Kellick

  • Sergeant
  • *
    • View Profile
  • Faction: Neutral
  • WB
Re: Factionize items tool
« Reply #11 on: June 09, 2010, 07:24:10 PM »
Quote
If you use fac_kingdom then when ownership of the town changes so does the goods list. This isn't automatic but will happen over time.
This is why others have noted that you can't get chargers anymore if the Rhodoks and Swadians are taken out.
That's probably somewhat native bug. It's too minor for bugtracker. 
All you need is to change a single line in module_triggers merchant inventory refresh code
from
Code: [Select]
                        (store_sub, ":cur_town", <...>),
                        (val_add, ":cur_town", towns_begin),
                        (store_faction_of_party, ":cur_faction", ":cur_town"),
to
Code: [Select]
                        (store_sub, ":cur_town", <...>),
                        (val_add, ":cur_town", towns_begin),
                        (party_get_slot,":cur_faction",":cur_town",slot_center_original_faction),
That's not difficult to do even via txt.
Sequence like
2105 2 v1 v2 2204 2 v3 v4
should be change to
2105 2 v1 v2 521 3 v3 v4 61

v1,...v4 --- numbers that are different in different triggers.

Quote
Finally I decided to see if using the fac_culture works and sure enough it does. As a quick try I set chargers to fac_culture_1 , started a new game, camped a few days and Swadians have chargers, Rhodoks do not. Now I expect that if the town is captured since as far as we know the culture doesn't change (which is why villages still give recruits of original faction I believe) so said town should always have said goods if you use culture instead of kingdom.
I think it was luck. Chargers aren't that common for such experiments. Cultures have almost no influence (they are used as transient slot for setting banners and troop tires), imo they are redundant (e.g. in RusXIII i removed them without problem) they aren't used in merchant refresh code and I very doubt the engine can connect kingdom and culture itself.

I thought it was a feature not a bug. I will have to check my triggers (when I revert back from betapatch) because further testing with the culture seemed not to be working properly but I can't consider the chargers to be luck when no other towns outside Swadia spawned them. But thanks for those variables and where to stick them. Certainly does give more options.

Kellick

  • Sergeant
  • *
    • View Profile
  • Faction: Neutral
  • WB
Re: Factionize items tool
« Reply #12 on: June 26, 2010, 06:12:33 PM »
Something else I noticed while going through 1.125 module system and compiling.
Aside from the merchant of Shariz all the intro quest merchants have wrong faction. The brother is also faction 2.
I had items that were showing up for certain factions that I just could not find where they were coming from and so I started going all the way up and down the troop list.
The pretenders also have some strange (for their faction) gear choices which will also put some unexpected things in.
Also all the quickbattle pc toons are faction 1. A few other wierd ones.
« Last Edit: June 27, 2010, 05:10:09 PM by Kellick »

The Yogi

  • Squire
  • *
    • View Profile
  • Faction: Neutral
Re: Factionize items tool
« Reply #13 on: July 03, 2010, 01:26:20 AM »
That's probably somewhat native bug. It's too minor for bugtracker. 
All you need is to change a single line in module_triggers merchant inventory refresh code
from
Code: [Select]
                        (store_sub, ":cur_town", <...>),
                        (val_add, ":cur_town", towns_begin),
                        (store_faction_of_party, ":cur_faction", ":cur_town"),
to
Code: [Select]
                        (store_sub, ":cur_town", <...>),
                        (val_add, ":cur_town", towns_begin),
                        (party_get_slot,":cur_faction",":cur_town",slot_center_original_faction),
Hi, after trying this tweak (the python version), inventories indeed seem to repelenish as they should, as with th original faction, but I get a script error every morning regarding the assignment of gold to a troop (I think it's the script for replenishing merchant gold). Are these two connected somehow?

Rongar

  • Master Knight
  • *
  • Cave canem
    • View Profile
  • Faction: Sarranid
  • M&BWB
Re: Factionize items tool
« Reply #14 on: July 04, 2010, 09:00:38 PM »
Something else I noticed while going through 1.125 module system and compiling.
<...>
That's why it is not a kit or a mod but a tool. Then I wrote I had in mind it wouldn't set final item factions but would  help not to set.


Hi, after trying this tweak (the python version), inventories indeed seem to repelenish as they should, as with th original faction, but I get a script error every morning regarding the assignment of gold to a troop (I think it's the script for replenishing merchant gold). Are these two connected somehow?
Which error?
I'm not sure what type of replenishing merchant gold tweak you use. But I think there should not be a problem to merge both of tweaks.


Factionize items tool
I hear and I forget.
I see and I remember.
I do and I understand...
 that would better if I heard.