EffectMovementSpeedIncrease(int)

From NWN Lexicon
Revision as of 00:04, 2 March 2021 by Jasperre (talk | contribs) (Known Bugs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Create a Movement Speed Increase effect to speed target movement rate.

effect EffectMovementSpeedIncrease(
    int nPercentChange
);

Parameters

nPercentChange
Percentage change in movement speed

Description

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

nPercentChange is very odd especially since negative values can be used to bypass immunities. This is what occurs when different values are put in:

  • Values under 100 have 100 added to them. -50 will become 50. 50 will become 150.
  • Values 100 or higher will be kept the same, so 150 will stay 150. 300 will stay 300.

As per the effect breakdown, the value is applied as a multiplier (eg; nPercentChange being 300 will do a * 3.0 multiplier) against the current movement speed applied, then this is capped at a maximum of 150% of usual speed (1.5 multiplier). See breakdown for calculation details.

The default Bioware values are still reasonably accurate (if you take it "as a portion of current speed" and knowing about the 150% cap).

  • -99 = almost twice as slow
  • -50 = 50% slower
  • 0 = no change in speed
  • 50 = 50% faster
  • 99 = almost twice as fast

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.

The EffectHaste (and Haste items) apply a hidden EffectMovementSpeedIncrease(50) as part of it's effects.

This effect is not stopped with immunity to movement speed decreases. It can be used with negative value to create a slowing effect which will ignore all immunities.

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 one 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 functions are Constructors, which are special methods that help construct effect "objects". You can declare and link effects, and apply them using an ApplyEffectToObject() Command. Once applied, each effect can be got separately via looping valid effects on the target (GetFirst/NextEffect()). See the Effect tutorial for more details.

Barbarian Endurance

FEAT_BARBARIAN_ENDURANCE - Will apply an additional 0.1 speed to whatever total speed bonus/penalty. EG: at nPercentChange = 25, meaning effects total of 1.25 multiplier you'd end up * 1.35 speed

Monk Speed

Monks get, for some reason, an increased effect cap to movement speed of x3 (or 300%) at level 3 onwards. This increases the cap of these magical effects.

Then Monks with FEAT_MONK_ENDURANCE will apply an additional additive +0.1 speed every 3 levels. If you've got movement speed increases at 300% - a x3.00 multiplier - at level 40 you'd add 40/3 = 13 increases, or 1.3 increase so a crazy total of 4.3 speed multiplier or around 16 or 17 meters per second.

Cutscene Remarks

Cutscene speed is pre-set (and likely removes the Monk and Barbarian speeds) since the "camera" is the player themselves. In cases you need to alter this speed use SetCutsceneCameraMoveRate not this effect.

Effect Breakdown

Multiplicative

The effect is multiplicative. You don't add up the amounts and multiply them once, you multiply each one in turn. Having 2x 20% increases with no other effects will go:

  • 1.0 * 1.2 = 1.2
  • 1.2 * 1.2 = 1.44

Instead of adding them up, such as 20% + 20% = 40% thus 1.4 total multiplier.

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 0.125 speed (the lower limit), and we have a 20% increase as nPercentChange, it will do 0.125 * 1.2 = 0.15.

Which seems fine at first glance, but this causes issues when we reach a cap, for instance if we have EffectMovementSpeedDecrease(50) 4 times (going beyond the 12.5% cap) and apply a EffectMovementSpeedIncrease(50), it will be already at the cap of 12.5% (0.125 speed) so it will do a calculation immediately of 0.125 * 1.5 = 0.1875 (speeding you up a bit), instead of it really being:

  • 1.0 * 0.5 = 0.5
  • 0.5 * 0.5 = 0.25
  • 0.25 * 0.5 = 0.125
  • 0.125 * 0.5 = 0.0625
  • 0.0625 * 1.5 = 0.09375 (which gets capped to 0.125)

However on removing it *will* do the above calculation. Applying a 0 movement speed change then removing it will recalculate it properly and then you get the right calculation.

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 If you put in < 100 it will add 100 to it and store it here. It will do nPercentageChange/100.0 (as a float) to work out the multiplier. EG: 125 here would give 1.25. -50 would give -0.5, etc.

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 set of EffectMovementSpeedDecrease effects applied. 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).

This is reported here along with some very buggy Monk interactions.

There is a bug that the top right effect icon applied as part of this is cleared if any *one* movement speed increase 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.

Version

1.62

Example

// Sample code for applying a 50% movement speed increase
// bonus to a target
 
void main()
{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;
 
    // Create the effect to apply
    effect eGoFast = EffectMovementSpeedIncrease(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_HASTE);
 
    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGoFast, oTarget);
}

See Also

functions:  EffectMovementSpeedDecrease


 author: John Shuell, editors: Jasperre, Mistress, additional contributor: Jasperre