Modding Encumbrance

Users who are viewing this thread

Good morning guys
Having looks everywhere I could to find out how we can mod the encumbrance effects I did not find anything.

I would like to seriously raise the encumbrance effects without touching to the weight value itself with item editors. Does anyone know where are the variables and the calculations done to edit the effect of encumbrance on speed ?

Dismounted heavy armored units feel really way too fast, and I do not feel any difference between me with heavy armor and me with light armor, I would like to make it more perceptible  :mrgreen:
Thank you !
 
Modify them in mission templates with use of the agent_set_speed_modifier operation in ti_on_agent_spawn (might also need to add in a loop trigger to check for the player, as he can swap weapons and armor after spawning). Troop agility and athletics also affect movement speed.
 
Here is how you need to set the agent_set_speed_modifier operation:
Code:
agent_set_speed_modifier               = 2093   # (agent_set_speed_modifier, <agent_id>, <value>), # value is in percentage, 100 is default, value can be between [0..1000]

So for example if you wanted to reduce the speed 50% than normal you need to find the mission template where you want to set the modifier. For example, if you want to set it during a town fight search for ti_on_agent_spawn in module_mission_templates until you find your desired template (siege, alley fight, bandit lair etc...). Then you set the operation like this:

Code:
      (ti_on_agent_spawn, 0, 0, [],
      [
        (store_trigger_param_1, ":agent_no"),
        (agent_set_speed_modifier, ":agent_no", 50), #set half speed for every agent that is spawned
        ...

This reduces the speed for all agents that are spawned in the scene. This only affects the state in they are spawned and does not check again if there are any changes in the equipment.

Protip: Do a file-wide search on a specific keyword on the source files if you try to figure something out (eg. "speed").
 
Thank you !
Then, it means that the encumbrance effect is hardcoded ? (I mean the slowing down caused by 1 weight cannot be changed ?)
I did not find any such news, but it is maybe because either the forum or my computer takes milleniums loading each page... :oops:
 
AFAIK weight calculation is hardcoded and can not be changed but I haven't done anything weight-related yet. Maybe someone more experienced might help you out :smile:
 
Then, it means that the encumbrance effect is hardcoded ? (I mean the slowing down caused by 1 weight cannot be changed ?)
Yes, but it can be mitigated via using agent_set_speed_modifier. 

From a technical POV, you could make all equipment weigh nothing at all and simply set agent_set_speed_modifier based on their armors only, for example, if you have a specific goal.
 
Something like this should work
I haven't tried it myself but should work

(ti_on_agent_spawn, 0, 0, [],
      [
        (store_trigger_param_1, ":agent_no"),
        (agent_has_item_equipped,":agent_no","itm_really_heavy_armor"),
        (agent_set_speed_modifier, ":agent_no", 50), #set half speed for every agent that is spawned
        ...

Replace itm_really_heavy_armor with any item you want,and all troops with that item will move 50% slower

 
Goutlard said:
And if the guy changes weapon will it still work ? If it does that's awesome  :grin:
It should work as long as the troop has the heavy armor equipped.
The guy should be able to change the weapon,and it still to work.
It'll stop working when he change the armor to some lightweight armor.
 
Back
Top Bottom