Aller au contenu

Photo

Reapplying Item Haste


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
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.

#2
MasterChanger

MasterChanger
  • Members
  • 686 messages
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
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
Thanks, MasterChanger, that did the trick.

#4
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
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
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
Try using

/** 
* 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
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
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.**

Modifié par Lugaid of the Red Stripes, 28 novembre 2011 - 12:03 .