• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Terrain Based Movement Speed

Good afternoon everyone.

I want to add a mod to change the player's movement speed depending on the type of surface. From solutions in earlier versions I could find only this:
For the BLOCK file, the following was written

    <append xpath = "/ blocks / block [@ name = 'terrConcrete']">
        <property name = "MovementFactorMultiplier" value = "1.2" />
    </append>
>>> in the end it still didn't work (changed MovementFactor to MovementFactorMultiplier)

The idea of the release is that I want to set up a buff that creeps in when the player starts moving on the surface.
From the description of the buff itself, everything seems to be clear:

    <append xpath = "/ buffs">

        <buff name = "buffAsphaltMS" name_key = "buffAsphaltMS" description_key = "buffAsphaltMS" tooltip_key = "buffAsphaltMS" icon = "ui_game_symbol_speed" icon_color = "140,75,220">
            <stack_type value = "ignore" />
            <passive_effect name = "MovementFactorMultiplier" operation = "perc_add" value = ". 5" />
        </buff>


    </append>

The question is how to configure the correct trigger for this buff? Which file?

If there are links to working mods with such mechanics, I will be glad to help.

Thank you all in advance.

 
So... First thing is movement_factor is a material property, not a property of blocks. So for your first problem you'd need to modify the material of the block type. This would change it for any block that uses that material, which might be a good thing for you so you don't have to change every block.

For your buff, again movementfactor is a material property. The way you control movement with buffs is WalkSpeed and RunSpeed. Both of these can use the perc_add / perc_subtract operation. Once you get your buff sorted how you want it, you can add a BuffsWhenWalkedOn property to blocks to give that specific buff. The way i do this is to have a 1 sec buff that is set to replace. This will allow the block to rebuff the player without the buff falling off.

 
I added a buff

<append xpath="/buffs">
<buff name="MovieSpeedBuff" name_key="MovieSpeedBuff" description_key="MovieSpeedBuffDesc" tooltip_key="MovieSpeedBuff" icon="ui_game_symbol_agility" icon_color="240,100,100">
<effect_group>
<passive_effect name="WalkSpeed" operation="perk_add" value="0.5"/>
<passive_effect name="RunSpeed" operation="perk_add" value="0.5"/>
</effect_group>
</buff>
</append>




Added a property to the block

<append xpath="/blocks/block[@name='terrConcrete']">
<property name="BuffsWhenWalkedOn" value="MovieSpeedBuff"/>
</append>




But when I step on a block, nothing happens in the game. Where did I go wrong?

 
Last edited by a moderator:
If I understand correctly, you can use MovementFactor (what is the final name of the property MovementFactor or MovementFactorMiltyplayer) as a material property to solve my problem. But then it will not be possible to give a description for the player of what is happening to him (description of a buff or debuff)

Or use buff WalkSpeed and RunSpeed effects. To do this, you need to run this buff as the BuffsWhenWalkedOn property for the desired block.

Tried both options and nothing happens. What could be the problem? (except me of course :))

 
operation="perk_add" isn't a function. perc_add is percentage add, which is what you need to use.

 
I don't recall the mod name or even how long ago I used it but I am sure there use to be one that did this. Different surfaces would change your speed. For example in desert you would be slower and on pavement you would speed up. I haven't seen it for a long while but I hope you get yours up and running

 
Mods that implement such a mechanic do not work in alpha 19. Therefore, I decided to deal with the issue myself and implement a working version.

 
Back
Top