In my modules, I have an item (belt) that gives the PC perma-haste, as well as terrain triggers that temporarily decrease the player's movement speed. The problem is, once the movement speed decrease effect has been removed by the triggers, the haste's movement speed increase effect is not reapplied.
Right now, I've fixed the terrain trigger's on-exit script to command the PC to unequip and re-equip this particular item, but I was wondering if there was a more subtle way to reapply the haste effect from the item, without the sound and chatlog messages of re-equipping the item.
Reapplying Item Haste
Débuté par
Lugaid of the Red Stripes
, nov. 23 2011 07:14
#1
Posté 23 novembre 2011 - 07:14
#2
Posté 23 novembre 2011 - 07:42
I was recently playing the Dana'an Unvanquished and hadn't realized this was happening. Have you tried removing and re-adding the item property to the item, rather than unequipping and requipping the item itself?
#3
Posté 23 novembre 2011 - 09:10
Thanks, MasterChanger, that did the trick.
#4
Posté 27 novembre 2011 - 03:35
With further testing, it seems that removing and re-adding the item property doesn't re-apply the movement speed bonus. Any other ideas?
#5
Posté 27 novembre 2011 - 09:00
Try using
examples are in the overland map code that came with soz
/** * Given a valid creature object ID, returns the movementratefactor on this creature. * The movementratefactor is applied to the creature's movement speeds. It is modified by things * such as effects, encumberance, etc. * @author RWT-OEI 04/22/08 * @param oCreature * @return */ float GetMovementRateFactor( object oCreature ); /** * Given a valid creature ID and a new movement factor, sets the creature's movement factor to * that value. This movement factor is also modified by effects, encumberance, etc. @author RWT-OEI 04/22/08 * @param oCreature * @param fFactor */ void SetMovementRateFactor( object oCreature, float fFactor );
examples are in the overland map code that came with soz
#6
Posté 27 novembre 2011 - 11:56
Thanks, pain, but actually being able to see the numbers made the problem even weirder.
Apparently, even if I reset the MovementRateFactor to 1.50, by the time the next heartbeat comes around something has set it back down to 1.1 (my testing PC has woodland stride). My best guess is that as I remove the movement speed decrease effect, something tells the engine to recalculate the movement speed, which happens a few milliseconds later. This recalibration, though, ignores the perma-haste effect.
I'm gonna continue to mess around with it, but I think I might take this bug and turn it into a feature. The perma-haste item was supposed to be a late-game trump card in the first module, and in the sequel it just makes other speed feat useless. But if I script in just a temporary speed boost (like a quick sprint) whenever the PC leaves a terrain trigger, then the other speed feats are useful to boost long-distance speed.
**Edit: A 0.5 second delay fixes it.**
Apparently, even if I reset the MovementRateFactor to 1.50, by the time the next heartbeat comes around something has set it back down to 1.1 (my testing PC has woodland stride). My best guess is that as I remove the movement speed decrease effect, something tells the engine to recalculate the movement speed, which happens a few milliseconds later. This recalibration, though, ignores the perma-haste effect.
I'm gonna continue to mess around with it, but I think I might take this bug and turn it into a feature. The perma-haste item was supposed to be a late-game trump card in the first module, and in the sequel it just makes other speed feat useless. But if I script in just a temporary speed boost (like a quick sprint) whenever the PC leaves a terrain trigger, then the other speed feats are useful to boost long-distance speed.
**Edit: A 0.5 second delay fixes it.**
Modifié par Lugaid of the Red Stripes, 28 novembre 2011 - 12:03 .





Retour en haut







