EffectMovementSpeedDecrease(int)

Create a Movement Speed Decrease effect to slow target.

```effect EffectMovementSpeedDecrease(
int nPercentChange
);```

Parameters

nPercentChange
Percentage to decrease the movement speed by

Description

Returns a new effect object that when applied to a target will slow their movement by nPercentChange percent.

As defined by Bioware, nPercentChange:

• 0 = no change in speed
• 50 = 50% slower
• 99 = almost immobile

Similar to EffectMovementSpeedIncrease nPercentChange capped positively, to 99, but for some reason allows negative values. This means you can have a movement speed decrease of -50 and it will increase your speed by 50%

Also note that EffectCutsceneImmobilize is a better way of stopping the creature moving at all (and cannot be resisted, like this can).

The target this effect is applied to must be a creature for it to work. This effect should not be applied instantly, only temporarily or permanently.

Remarks

There apparently is also a hard cap of 150% movement speed increase factor for the combination of movement from this effect. Monks get an exception and anyone with CLASS_TYPE_MONK get a maximum of 300%. It appears there is a lower limit of 12.5% movement speed when decreases are applied.

This effect is stopped with immunity to movement speed decreases - IMMUNITY_TYPE_MOVEMENT_SPEED_DECREASE.

This effect is used by EffectSlow, essentially providing a hidden EffectMovementSpeedDecrease(50).

A quick note is that all PC movement rates are 2.00, as defined in creatureSpeed.2da. That is their walkrate, their runrate is 4.00. This is the amount of distance, in meters, they can cover in 1 second.

There is no way to directly change a PC's movement speed (say, to 5.00 meters a round). You can make them up to almost immobile, to 99% faster.

Effect Breakdown

Multiplicative

This means the effect is multiplicative not additive. Having 2x 20% decreases with no other effects will go:

• 1.0 * 0.8 = 0.8
• 0.8 * 0.8 = 0.64

Instead of totalling them up and applying the final multiplier, so it is not 20% + 20% = 40% decrease, so 1.0 * 0.4 = 0.4 speed.

Issues When Applying

On applying this effect seems to check the current movement speed changes done, and multiply it by * nPercentageChange, for instance if we are at 1.50 speed, and we have a 20% decrease as nPercentChange, it will do 1.5 * (1.0 - 0.2), ie: 1.5 * 0.8 = 1.2 now applied.

Which seems fine, but this causes issues when we reach a cap, for instance if we have EffectMovementSpeedIncrease(50) 3 times (going beyond the 150% cap) and apply a EffectMovementSpeedDecrease(50), it will be already at the cap of 150 (1.5 speed) so it will do a calculation immediately of 1.5 * 0.5 = 0.75 (slowing you down by a lot!), instead of it really being:

• 1.0 * 1.5 = 1.5
• 1.5 * 1.5 = 2.25
• 2.25 * 1.5 = 3.375
• 3.375 * 0.5 = 1.6875 (which gets capped to 1.5)

However on removing it *will* do the above calculation. Applying a 0 movement speed change then removing it will recalculate it properly and suddenly you're fast again!

Why on earth Bioware didn't change the apply code to be the same as the removal code...who knows. Maybe they added an engine cap of 150% increase and forgot.

nIndex Parameter Value Description and Notes
GetEffectInteger
0 nPercentageChange Keeps it in the input format, and does 1.0 - nPercentageChange (as a float) to work out the multiplier. EG: 25 here would give 1.0 - 0.25 = a multiplier of 0.75 to apply.

Known Bugs

As above the full calculation of the movement rate change to apply is not properly calculated when a cap is reached, which is especially common when you have a EffectHaste item, or use a spell to speed yourself up such as Expedious Retreat. A "fix" you can try to this would be to apply the change you want, then apply a temporary effect with nPercentChange set to 0 which is either instantly removed, or has a very short duration (such as 0.1 seconds).

There is a bug that the top right effect icon applied as part of this is cleared if any *one* movement speed decrease is removed, which means it is cleared from the upper right icon space (but not the character sheet or examine screen for whatever reason).

A more minor "bug" is as noted above negative values can be put in (to any limit) and it'll increase your speed.

Needs retesting in NWN:EE: The base speed for Monks are miscalculated. If an EffectMovementSpeedDecrese is used on a monk with a 0% change the monk shall move faster than he would normally. This is not the case for other characters (Barbarians not tested)

1.62

Example

```// Sample code for applying a 50% movement speed decrease
// penalty to a target

void main()
{
// This is the Object to apply the effect to.
object oTarget = OBJECT_SELF;

// Create the effect to apply
effect eSlowDown = EffectMovementSpeedDecrease(50);

// Create the visual portion of the effect. This is instantly
// applied and not persistent with whether or not we have the
// above effect.
effect eVis = EffectVisualEffect(VFX_IMP_SLOW);

// Apply the visual effect to the target
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
// Apply the effect to the object
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSlowDown, oTarget);
}```