Factionize items tool

Users who are viewing this thread

Rongar

Master Knight
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.
 
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
 
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
All you need is to change a single line in module_triggers merchant inventory refresh code
from
Code:
                        (store_sub, ":cur_town", <...>),
                        (val_add, ":cur_town", towns_begin),
                        (store_faction_of_party, ":cur_faction", ":cur_town"),
to
Code:
                        (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.

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.

 
Rongar said:
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 :smile:
Engine connects facton and culture only through module system slots, nothing else
 
GetAssista said:
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 =)

GetAssista said:
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.
 
Rongar said:
GetAssista said:
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  :grin:
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 )
 
Rongar said:
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:
                        (store_sub, ":cur_town", <...>),
                        (val_add, ":cur_town", towns_begin),
                        (store_faction_of_party, ":cur_faction", ":cur_town"),
to
Code:
                        (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.

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.
 
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.
 
Rongar said:
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:
                        (store_sub, ":cur_town", <...>),
                        (val_add, ":cur_town", towns_begin),
                        (store_faction_of_party, ":cur_faction", ":cur_town"),
to
Code:
                        (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?
 
Kellick said:
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.


The Yogi said:
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.
 
Rongar said:
The Yogi said:
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.

None, as far as I'm aware. The Error message is

Script Error on opcode 23: Invalid script parameter ID: 1; Line no: 1:
at script troop_add_gold

repeated 15 times, which by the way is the number of companions in my party.

This happens with a vanilla script file, so it's not the script in itself that's wrong.
 
The Yogi said:
Script Error on opcode 23: Invalid script parameter ID: 1; Line no: 1:
at script troop_add_gold
That means somewhere you call troop_add_gold with to few arguments.
 
I'm not very versed in Pythonic modding. Any idea how the change in inventory refresh could affect the troop_add_gold script? I mean, it hasn't been changed at all, it's the same as before applying the inventory update fix. And works perfectly again when removing the fix.

 
Trying your tool, I have one error(minor) : "Python: can't open 'factionize_itmes.py' No such file" . So i have renamed factionize_items in factonize_itmes and it's work. (sorry for my english)
 
Rather I should sorry for my English and disobedient fingers. 
Reuploaded.
Thanks, Yardryl. At least one person has run the tool :smile:
 
Back
Top Bottom