Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
@Lav:
First of all: Thank you so much for help. It was invaluable as always!

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).
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.

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.

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.
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.

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"),
     ]
    ),

[...]
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.

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".
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.

But I will definitely try your debugging suggestion.

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.
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.

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.

Lav said:
And your scripts could really be optimized with (store_item_kind_count) operation.
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:
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.
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?

Thanks again for your incredible help!
 
DerGreif said:
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.
Don't activate the food slot, it just leads to abnormalities, not only in the UI but also the tooltip for other items.
 
Somebody said:
DerGreif said:
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.
Don't activate the food slot, it just leads to abnormalities, not only in the UI but also the tooltip for other items.
Thank you very much! I have to think of something else then.
 
Hi everyonee, here is my problem: when you make an action in game, it will call an animation for the action, and i dont know which file are store the code for this job, sorry for my bad english please help  :grin:
 
module_animations.py, which is compiled into actions.txt. Note that the actions themselves are hardcoded - you cannot reassign them, though you can invoke them from script code.
 
Thank you lav, but in the module_action it not show when or where the animation will be call, its just describle the action, i think its would be some code will check if attack key is down then if character held a bow then call bow's animation or lance then call lance's animation
 
It doesn't show because it's hardcoded in the engine. When you walk, the engine will always use the walking animation (or more specifically, the one with the same offset even if it's been renamed). So you can replace animations with your own but they must still do essentially the same thing. Of course, some people have exploited this by replacing crossbow skill with another type of firearms and replacing all crossbow animations with appropriate firearms animations.

You can also use the reserved animation entries at the end of file to fill them with your animations - the engine will not use them, but you can invoke them through scripts. Better use the ones at the very end of the file though, as Taleworlds have been known to add new animations with new game patches, and when they do, they use the ones at the start of the reserved animations block (essentially expanding the block of actually used animations). So by starting from the end, your work has the least chance of conflict with any potential future patch.

Okay, with Bannerlord in the making there's a small chance for this, but still. :smile:

DerGreif said:
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.
Your code seems fine to me.

DerGreif said:
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?
Healing rate is non-moddable. I looked for it myself.

As for affecting, with party_stack_get_num_wounded, heal_party, party_wound_members, party_remove_members_wounded_first, inflict_casualties_to_party_group and party_add_members you should be able to do what you want.
 
DerGreif said:
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!

I believe that there is a fixed inventory space for the player (90 slots or something like that). The inventory management skill only affects how many slots are shown/accessible in the inventory or trading menus, so if you have skill 10, then add some items at the end of the inventory, then you make the skill 9, those last items will not be removed, they will not be shown.
 
Dusk Voyager said:
Try setting track_spotting_multiplier to zero in module.ini.
Did not change anything related to the visible tracks *shrug*
produno said:
Change the tracks material to alpha so its not visible?
I'm sorry, I don't understand this.

Edit: Ah, wait I forgot to say I'd like to get rid of the tracks also while CTRL+T being active, else the Cap set to 0 would work. (But I like to see the whole activity on the map, feels a bit lonely without. Sometimes I only fly through the map to see battles between other parties.)
 
Melphiz said:
produno said:
Change the tracks material to alpha so its not visible?
I'm sorry, I don't understand this.
The little track arrows are 3D meshes superimposed on the world map mesh. This means they've got a material (map_track, visible through OpenBRF) and a texture. You can edit the texture's alpha channel (i.e. transparency mask) to render the arrows transparent. (Produno seems to suggest setting a specific flag on the material instead, but I've got no idea if that's possible, and which one it should be.)
 
Please, i need for my new tournament :

this condition
"If the shield_red is broken"
and

"if the shield_blue is broken"

It is possible  :?:

:neutral:


Missions_template
      (1, 3, ti_once,
      [
          (this_or_next|main_hero_fallen,0)
  #        (shield_blue_is_broken), ???
          ],
      [
        (mission_enable_talk),
        (call_script, "script_tournament_losses"),     
        (finish_mission,0),
        ]),

     
      (1, 3, ti_once,
      [
      (try_begin),
  #      (shield_red_is_broken), ???
      (else_try),
        (store_mission_timer_a, reg1),     
        (ge, reg1, 1),
        num_active_teams_le, 1),
        (neg|main_hero_fallen),
      (try_end),
        ],
      [
        (call_script, "script_tournament_stages"),
        (finish_mission,0),
        ]),

I'm not sure for my mission templates codes, i just need this condition in first time.

thanks

edit:
Thank you Lav :grin:

Dusk Voyager said:
The behaviour of broken shields is hardcoded.

Damn  :neutral:
I'm going to find a better methode than by the broken shield.
It's for a real jousting, 1 VS 1, 2 knights...

 
FantasyWarrior said:
Please, i need for my new tournament :

this condition

"If the shield_red is broken"
and

"if the shield_blue is broken"

It is possible  :?:
You can keep track of what agents have what shields in their equipment slots, and track shields being dropped and picked up by adding ti_on_item_dropped and ti_on_item_picked_up triggers to your tournament shields. Once that is ready and working, run a repeating trigger to check the agents for their actual number of shields. Whenever their number of shields is less than what it should be according to your calculations, the only remaining reason for shield to be removed is to be destroyed.
 
The behaviour of broken shields is hardcoded. Just run a pair of triggers with ti_on item_dropped/picked_up to store the number of red/blue shields you've dropped or picked up into respective new slots or global variables. Then check how many you have equipped ATM (who says you can't turtle) with another trigger to determine if you have fewer than picked up - dropped + 1, in which case you should lose.

PS. ninja'd.
 
Hello m'alords. I'm looking for the code I have to add to make an invading faction appear on my mod, just like in Native Expansion and others.

I have not found any thread where this is explained... so can anybody help me?  :smile:
 
Well, I finally fixed the hitboxes for my trolls, but now, when dead, they start having seizures. Humans are fine, though, as well as anything using the human skeleton. What can I do to fix this?
 
Status
Not open for further replies.
Back
Top Bottom