PaladinKyle Posted June 22, 2014 Author Posted June 22, 2014 (edited) How small is the trigger box? If it is really small then the script is probably firing the OnTriggerLeave event right after the OnTriggerEnter and the character has no chance to demonstrate a slowed walk. That said, it may also be that the game doesn't use the new data until the next call for that data which would be when the player starts moving again. No idea why it would only happen with the weapon out. Did you try it without a weapon out and stopping inside the trigger box? May need to use PlayIdle and force a change in the player's animation. Perhaps even disabling player controls during the idle, then afterwards re-enable the player controls. Player would be returned to a stopped character. If you could find an appropriate animation where it appeared that the player was looking at injured feet plus a small amount of health loss, it could then be believable that the grass in question requires slower movement. The trigger box is big enough so it would not encounter that error. But, I'm pretty sure it's because the game doesn't use the new data until it's called for again. The only reason I hypothesized that it'd work with the weapon drawn is that it didn't work with it sheathed; I was thinking of using PlayIdle as well. The only skepticism I have about PlayIdle is if it can update seamlessly so the player doesn't abruptly stop when they're walking; maybe if it were to occur for a fraction of a second. Edited June 22, 2014 by Kyle8497
Ceruulean Posted June 22, 2014 Posted June 22, 2014 (edited) I honestly think you should try making a spell and magic effect, as lofgren suggests. Copy the "Slow" effects from the ice spells, remove the art shaders and sounds, make sure the "Recover," "Detrimental" checkboxes are ticked, although you may want to untick "Hostile." Change the spell from "Aimed/Target" to "Self," and "Concentration/Fire and Forget" to a "Constant Effect." Then in the spell window, set the magnitude anywhere from 1 to 100, with 50 being 50% slower. Use the script to add the spell upon entering, and removing the spell upon leaving. Scriptname SpikyGrassSlowen extends ObjectReference Spell Property SlowSpell Auto Event OnTriggerEnter(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.GetPlayer().AddSpell(SlowSpell, false) ;The 'false' parameter prevents a UI message from popping up that says, 'Spell Added' in the upper corner EndIf EndEvent Event OnTriggerLeave(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.GetPlayer().RemoveSpell(SlowSpell) ; No message will appear from removing a spell. EndIf EndEvent It'll work just like the player had a frost spell cast on them, except if it is a Constant Effect spell there is no set duration for the debuff, only when you decide to remove it. There's no point going through the whole "Playidle" business; it's excessive. Edited June 22, 2014 by Ceruulean
lofgren Posted June 22, 2014 Posted June 22, 2014 To elaborate on what Ceruulean wrote, spells are preferable because they have "memory," meaning that they can undo all of their own changes. Your script as written will conflict with any other mods and spell effects that change the actor's speed, which can result in permanently screwy actor values and very unhappy players. A magic effect also leaves a record of its existence. If a player is wondering why they are so slow they can see that it is because they have your spell on their character and remove it if necessary via console. A script leaves no record of its existence.
IsharaMeradin Posted June 22, 2014 Posted June 22, 2014 In this scenario, the spell is probably the better route provided you can set it up to work the way you want. But only because we already know that the frost spell slows character movement without needing the character to stop moving. There may very well be a purely scripted means to accomplish what you want, just might not be worth the time and effort to figure it out.
Ceruulean Posted June 22, 2014 Posted June 22, 2014 Turns out the animation bugs are part of the vanilla game. Check this mod out, it has a workaround: Frost Magic Bugfixes
PaladinKyle Posted June 23, 2014 Author Posted June 23, 2014 I suppose I'll try the spell route. I'll let everyone know if I got it working.
PaladinKyle Posted June 24, 2014 Author Posted June 24, 2014 So, I set everything up and I couldn't get it to work. I rewrote the code and then created the two spell components with effects removed and Casting and Delivery set to Constant Effect and Self, respectively. Then, I attached my slow effect with my spell effect linked. There must be an oversight somewhere. Link to images of spell settings: http://imgur.com/a/QSrg1#0 Here's my script: (It's basically a clone of Ceruulean's) Scriptname SpikyGrassSlowen extends ObjectReference Spell Property TallonGrassSlowSpell Auto Event OnTriggerEnter(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.GetPlayer().AddSpell(TallonGrassSlowSpell, false) EndIf EndEvent Event OnTriggerLeave(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.GetPlayer().RemoveSpell(TallonGrassSlowSpell) EndIf EndEvent
PaladinKyle Posted June 29, 2014 Author Posted June 29, 2014 Are we sure that AddSpell is the proper Function to use here? Not Cast?
Recommended Posts