Is there a way to use this modifier to boost movement speed of all units?

Narvana

Chieftain
Joined
Nov 20, 2016
Messages
62
Let's say I want to create a civ where all units have +1 to movement speed.

I have no idea how to make this happen. I was excited for finding this modifier:

Code:
MODIFIER_PLAYER_UNIT_ADJUST_MOVEMENT

But it didn't work. It went through database log without causing any errors but it didn't actually work in game - all units had the same movement speed as always...

Any ideas?
 
The modifier you're using is supposed to attach to a SINGLE unit, like through an ability, promotion, etc. What you need is a modifier with the same Effect, but the Collection for all of the Player's units. Here's a couple ways to go about it:

A) There's a Policy called Logistics that does something very similar to what you want, though I'm not sure if it affects Civilian units. Open the base game's Policies.xml, search for LOGISTICS, and find the Modifiers table entry, where it will have a ModifierType entry associated with it, and possibly a SubjectRequirementSetID. Ignore any requirements, and that's the Modifier you want to use. Look in the ModifierArguments table to see what you need in there to make it work. Probably a Value of 1, just like I'm sure you have for yours now. My guess, the ModifierType you want is MODIFIER_PLAYER_UNITS_ADJUST_MOVEMENT.

B) You have the modifier with the right effect, but not the right Collection. Open the base game's Modifiers.xml file, search for the Modifier you have, and find its Effect entry. In your mod, make a new entry in the DynamicModifiers table, as well as an entry in Types for your new Dynamic Modifier. Look around at the Collection entries of a few other Modifiers, and you'll find something like COLLECTION_PLAYER_UNITS. That's the one you'll want. Now, sometimes when doing this, you won't know what Arguments to use, which can be a problem. You might find any Modifier with the same Effect, and search through the other base game xml files for something that has that, and see what it uses as its Arguments, etc. Though, you already have your Arguments set up I'm sure, its just a Value and 1.

The above 2 methods are how you do basically anything with Modifiers. And, like I say in A, I think you're literally one letter short of getting the ModifierType you need. Next time, try searching through the MOdifiers.xml file for Modifiers containing similar names or the same Effect; I almost guarantee you'll find what you need by searching that file for 'ADJUST_MOVEMENT'.
 
Back
Top Bottom