@Lav:
First of all: Thank you so much for help. It was invaluable as always!
Now a follow up question: If I activate the "food slot" in module.ini, could I utilise this? What I mean is: Can I detect items stored in that slot? Will that slot show up in the inventory screen? - I might have to do some testing on that.
But I will definitely try your debugging suggestion.
After a lot of pondering I think I will not use this method of advancing and limiting inventory space. Instead I will just go with encumbrance, setting the party speed to zero if too encumbered. and let the player start with inventory management ten. Encumbrance will depend on party size and pack animals. That seems easier to be tracked and handled. I have also no problem with cleaning up the inventory after losing a pack animal. I still am curious though why the code above did not work reliably.
Thanks again for your incredible help!
First of all: Thank you so much for help. It was invaluable as always!
Thank you so much for that piece of information! I did not knew about that trigger being fired within the inventory screen. That might come in handy.Lav said:You can write ti_on_init_item trigger. It fires when inventory screen is opened, item is picked up and item is dropped. Moreover,when an item is picked up from player's inventory, (store_item_kind_count) operation will return value lower by 1. This can also be used to detect "discarded" items (if it's been picked up and never dropped back before inventory window is closed, it's been discarded).
Now a follow up question: If I activate the "food slot" in module.ini, could I utilise this? What I mean is: Can I detect items stored in that slot? Will that slot show up in the inventory screen? - I might have to do some testing on that.
That is a very impressive piece of work there! I will most certainly look into it. I am pretty sure I can learn something from it. For my inventory I wold like to keep the visual representation of the native inventory screen, though. Well, since I feel not competent enough to recreate that within the module system I will have to go with another workaround.Lav said:Recreate, no. Make own version of, yes. The only one I'm aware of though, is my own Companions Overseer, though it looks like minnakodunum is working on something similar.
Did you see any apparent mistakes in the code why it would not increase the skill level of inventory management appropriately after a pack animal is bought - or decrease it for that matter? It is really strange. Someties it seems to work (both ways!), then suddenly, nothing happens at all.DerGreif said:[...]
Here is the code:
Code:(0, [ (assign, ":inv_management",0), (call_script, "script_get_troop_item_amount", "trp_player", "itm_warhorse_steppe"), (assign, ":item_amount",reg0), (val_add, ":inv_management",":item_amount"), (call_script, "script_get_troop_item_amount", "trp_player", "itm_mule"), (assign, ":item_amount",reg0), (val_add, ":inv_management",":item_amount"), (call_script, "script_get_troop_item_amount", "trp_player", "itm_donkey_mount"), (assign, ":item_amount",reg0), (val_add, ":inv_management",":item_amount"), (try_begin), #remove a pack animal from the count which is used as riding horse (this_or_next|troop_has_item_equipped,"trp_player","itm_mule"), (this_or_next|troop_has_item_equipped,"trp_player","itm_warhorse_steppe"), (troop_has_item_equipped,"trp_player","itm_donkey_mount"), (val_sub, ":inv_management",1), (try_end), (call_script, "script_troop_set_skill_level", "skl_inventory_management", ":inv_management"), ]),
Code:#asigna una skill segun el numero de hombres que lleva el ejercito del player # script_troop_set_skill_level # Input: skill, skill_level # Output: none ("troop_set_skill_level", [ (store_script_param_1, ":skill"), (store_script_param_2, ":skill_level"), (store_skill_level, ":player_skill_level", ":skill", "trp_player"), (val_sub, ":skill_level", ":player_skill_level"), (troop_raise_skill, "trp_player",":skill",":skill_level"), ] ),
[...]
I knew about that skill level cap. That is why thought it might be a reason for the game engine not calling the game_get_skill_modifier script (or whatever it is called). On the other hand, any bonus above the skill cap could be ignored.Lav said:It does have a hardcoded non-modifiable cap, and it's 10.
Whether or not the game is calling the script for inactive skills you can check by putting a debugging (display_message) inside it for "skl_inventory_management".
But I will definitely try your debugging suggestion.
Actually and rather funnily testing reveiled that the items are not "lost". If you sell a mule and lose access to the last 6 inventory slots, after buying a mule again, the items in these slots appear again! That was really strange. Mayby the game engine did not forsee a possibility for the player to lose a skill level in inventory management (which again might explain, that the game engine dies not check for skill bonuses for this skill). As thus there was no necessity to include an operation which checks for a drop in the in the skill level of inv management and to update the inventory accordingly. So you are right, I will most certainly have to write some code to let the player then at least select which of the items no longer fitting in the inventory he wants to discard, maybe by utilising again the looting screen.Lav said:Note that losing an animal when the player has some items stored at the bottom of his inventory space may cost him some items. You might want to write some code to solve this situation.
After a lot of pondering I think I will not use this method of advancing and limiting inventory space. Instead I will just go with encumbrance, setting the party speed to zero if too encumbered. and let the player start with inventory management ten. Encumbrance will depend on party size and pack animals. That seems easier to be tracked and handled. I have also no problem with cleaning up the inventory after losing a pack animal. I still am curious though why the code above did not work reliably.
Oh well, that is true. Thanks for pointing out my mistakes and giving good advice how to rectifiy the problems. I am a complete layman when it comes to coding. But thanks to the great community and a lot of OSP code (your FISH code is awesome and so easily to implement, even for me!) even a stupid amatuer like me can create a mod (ever so slowly).Lav said:And your scripts could really be optimized with (store_item_kind_count) operation.
I was more thinking of reducing the healing rate, or to be more precise to reduce the bonus wound treatment gives to the healing rate (20 % per level seems a bit excessive to me). I just hoped there was something I have missed in the module.ini to define the base healing rate like there is for party speed certain threshold etc. or some operation within the ms which affects the healing rate. Is there any way to affect the wound/not wounded status of troops from within the ms?Lav said:You can always write your own timed trigger, or add a skill modifier in the script (like you tried to do with inventory management). Just set skill cap to a higher value - 15 is the maximum value engine supports.
Thanks again for your incredible help!