Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
It's probably lagging like hell because 10% of the time ALL the humans would start coughing. You absolutely need to use try_for_agents, unless you want to go with the global iterator approach which might fail at times. In the condition, you need to iterate through all candidates (human, not routed, alive, appropriate combat state) and cache whether they are viable - then in the conditions you randomize  their chances of coughing or playing the culturally inappropriate noise effects. To do things other than the sound you can set the agent's walk/stand animation cycles, again at your own discretion out of combat.
 
Essentially, run try_for_agents once, probably in ti_after_mission_start trigger, and make a list of all active human agents. I'd recommend a single sequence of slots.

Add a ti_on_agent_spawn trigger to add any agents spawning during the mission to your list.

Add a ti_on_agent_killed_or_wounded trigger to remove any agents from your list (you might want to keep the list as a single continuous list of slots, so whenever an agent from the middle of the list gets removed, replace it with the agent reference from the end of the list).

Once you have a list that's maintained (without any overhead), selecting a random agent becomes effectively a single (store_random_in_range) operation.
 
Hey guys, I have a very simple question.

So Im creating a mod, with elephants in it. Long story short I managed to get it in the game. Buut, It doesn't seem to represent a real elephant.

The question is:
1. Can you tell me the best stats for an elephant to be as realistic as possible (speed, charge, body armor, etc.)
2. Can I make the elephant bigger?

Mind me, im just getting started in modding, and is still an utter noob :oops:.

Thanks in advance!

 
Hi, I have started on M&B:WB modding a few days ago, and there is already something that I really want an answer on to be able to understand what to do.

I understand the basics, which is presented very nicely in "The Ultimate Introduction to Modding" by Lumos, just to let you know this much, so you are not mislead by my question.

I understand how the different values from the python files are converted into the text files that one can find in the module folder you compile into with the Modsys, and examining the results of different changes is also not a difficulty for me.


Now, here  comes the part where I try to explain, what I really want to know:

1. You have for an example a flag "tf_guarantee_ranged"
2. The flag is turned into a number value
3. The game engine can translate this into a meaningful functionality

(I am not asking for the "tf_guarantee_polearm" tutorial, just FYI.)


Now, I would like to know HOW the engine makes sense of these numbers, as this can become very useful information later, as it might be useful for adding functionalities to your module and actually understand the very essence of what you just did.

I imagine some kind of interpretation of the values, when the game loads it up, otherwise I can not see how a new flag is declarable.


Thank you in advance for any help or thought provided around the subject.


Captain Lannigan said:
1. Can you tell me the best stats for an elephant to be as realistic as possible (speed, charge, body armor, etc.)
2. Can I make the elephant bigger?

I can not tell you which stats would be good for an elephant, specially since I do not know what to compare it to.
I can tell you about the size though:
open it up in a 3D modelling program and resize the model, and make sure it still have the right offsets and whatnot of the technical things and reinsert the model in your mod. (remember to save a backup of the elephant model)
 
Valon said:
Now, here  comes the part where I try to explain, what I really want to know:

1. You have for an example a flag "tf_guarantee_ranged"
2. The flag is turned into a number value
3. The game engine can translate this into a meaningful functionality

(I am not asking for the "tf_guarantee_polearm" tutorial, just FYI.)

Now, I would like to know HOW the engine makes sense of these numbers, as this can become very useful information later, as it might be useful for adding functionalities to your module and actually understand the very essence of what you just did.

I imagine some kind of interpretation of the values, when the game loads it up, otherwise I can not see how a new flag is declarable.

Thank you in advance for any help or thought provided around the subject.
Essentially, most flags, constants and values defined in header_*.py files are hardcoded. So what tf_guarantee_ranged flag essentially represents is that "at some point of time Warband engine developers decided that mask 0x04000000 will be used for this particular purpose".

And new flags are obviously not declarable. :smile:
 
Lumos said:
Captain Lannigan said:
How about my first question?

Do any of you have suggestions for that?
Yeah. Nobody here is an elephant expert, at least not an apparent one, so if I were you, I'd try experimenting to see what stats feel nice and what I like.

Hey! It's you again! that fukin grammar nazi Lumos! I'm that guy at bannerlord that swears german and spanish! don't you remember :grin:?
 
Valon said:
Captain Lannigan said:
1. Can you tell me the best stats for an elephant to be as realistic as possible (speed, charge, body armor, etc.)
2. Can I make the elephant bigger?

I can not tell you which stats would be good for an elephant, specially since I do not know what to compare it to.
I can tell you about the size though:
open it up in a 3D modelling program and resize the model, and make sure it still have the right offsets and whatnot of the technical things and reinsert the model in your mod. (remember to save a backup of the elephant model)
You can also change the stat horse_scale(x) in module_items.py to make your elephant bigger.

Lord of Shadows said:
Where can I find how old is the lord? For example: I want to see how old is King Harlaus. Where can I find that?
slot_troop_age stores the value you need. You can use debug messages to see it in game.
 
module_animations.py

["ready_crossbow", acf_rot_vertical_bow|acf_anim_length(100), amf_priority_attack|amf_use_weapon_speed|amf_keep|amf_client_owner_prediction|amf_rider_rot_crossbow, 
I dont understand the red line above, one can help me, thank you
 
thank you jacobhinds, I'm doing one rifle with five rounds,and I want to shoot every bullet it will tuck back, I have 1 ani tuck the rifle bullet, it works great, but do not tuck the bullet when shot,  so I need every bullet fired by 1.5 seconds after the firing the next new, everything I need is like

http://youtu.be/uxHc_8pSCro : if too fast tuning speed slows 0.5
at 8 seconds, I do not tuck the rifle ammo

sorry about my english bad, thanks for anyone help me
 
Hello together,

I have a few questions with regards to the inventory:

1. Is there a simple way to determine within the native inventory presentation to check, what items are discarded by the player at least within a scene? I tried to achieve that with the ti_on_item_dropped trigger, but it did not work for discarding items.

Since the native inventory presentation seems to be hardcoded into the engine, the only solution I came up with is to toggle the looting screen instead of the inventory screen and use a special "hero troop" with an empty inventory as discarding container (like the household inventory troop).

2. Is it possible to "use" an item within the inventory by for example double-clicking on it or by marking the item slot and then pushing a key? I fear that this is not possible - again due to the hardcoding of the native inventory presentation.

If that is indeed the case, has anybody ever done an OSP code, which  recreates the native inventory screen as a moddable presentation?

3. Finally: I have tried to implement a different way to determine the inventory size of the player party. For that I have set the skill inventory management inactive (worked so far). Then I tried to use a routine similar to what Brytenwalda did succesfully with prisoner management. I set the skill level of inventory management "manually" via script whenever the player acquires or loses a pack animal. Since there is no trigger outside of mission templates which allows for checking whether something changed in the player inventory I had to go with a simple trigger much the same way as Brytenwalda with prisoner management and party size. Sadly I do not get consistent results. Sometimes it seems to work and inventory síze increases, then nothing happens. So, what did I do wrong?

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

Any help would be highly appreciated.

I also tried implementation via the book-bonus method, but that did not work. Either because the game engine does not call the script  for a skill flagged as inactive or because inventory management cannot be enhanced that way in general (maybe because inventory management has a hardcoded non modifiable maximum cap).

I thought about adding additional inventory space by giving each pack animal its own inventory container (aka chest-hero-troop), but then I have the problem how to access these containers easily - see question number two - and this would really add a lot of inventory space because I believe the hardcoded minimum for an inventory is 30 slots and I think that is a bit too much.


One unrelated question which suddenly popped into my mind: Is it possible to somehow affect the healing rate (besides using the hardcoded skill effect of wound treatment)?

 
DerGreif said:
Hello together,

I have a few questions with regards to the inventory:

1. Is there a simple way to determine within the native inventory presentation to check, what items are discarded by the player at least within a scene? I tried to achieve that with the ti_on_item_dropped trigger, but it did not work for discarding items.
See below.

DerGreif said:
Since the native inventory presentation seems to be hardcoded into the engine, the only solution I came up with is to toggle the looting screen instead of the inventory screen and use a special "hero troop" with an empty inventory as discarding container (like the household inventory troop).
Should work, yeah. I used the same method. :smile:

DerGreif said:
2. Is it possible to "use" an item within the inventory by for example double-clicking on it or by marking the item slot and then pushing a key? I fear that this is not possible - again due to the hardcoding of the native inventory presentation.
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).

DerGreif said:
If that is indeed the case, has anybody ever done an OSP code, which  recreates the native inventory screen as a moddable presentation?
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.

DerGreif said:
3. Finally: I have tried to implement a different way to determine the inventory size of the player party. For that I have set the skill inventory management inactive (worked so far). Then I tried to use a routine similar to what Brytenwalda did succesfully with prisoner management. I set the skill level of inventory management "manually" via script whenever the player acquires or loses a pack animal. Since there is no trigger outside of mission templates which allows for checking whether something changed in the player inventory I had to go with a simple trigger much the same way as Brytenwalda with prisoner management and party size. Sadly I do not get consistent results. Sometimes it seems to work and inventory síze increases, then nothing happens. So, what did I do wrong?

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

Any help would be highly appreciated.

I also tried implementation via the book-bonus method, but that did not work. Either because the game engine does not call the script  for a skill flagged as inactive or because inventory management cannot be enhanced that way in general (maybe because inventory management has a hardcoded non modifiable maximum cap).
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".

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.

And your scripts could really be optimized with (store_item_kind_count) operation.

DerGreif said:
One unrelated question which suddenly popped into my mind: Is it possible to somehow affect the healing rate (besides using the hardcoded skill effect of wound treatment)?
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.
 
Hello again.

My request for help still stands, I'd very much like it if some one helps me with the bug causing companion dialogue to be mixed up.

Another thing: Where can I find the equipment condition adjectives in the modsys?
 
Frenzied_Crocoduck_Herder said:
My request for help still stands, I'd very much like it if some one helps me with the bug causing companion dialogue to be mixed up.
You should give details if you need help. Not everyone possesses long-range telepathic abilities to pick them from your head. :smile:

Frenzied_Crocoduck_Herder said:
Another thing: Where can I find the equipment condition adjectives in the modsys?
Data/item_modifiers.txt

Or, if it's present in your module:

Modules/<ModuleName>/Data/item_modifiers.txt
 
Im pretty sure the same question was answered a couple of pages back. Have you changed the amount of companions? If so have you altered the constant in scripts?
 
Status
Not open for further replies.
Back
Top Bottom