Kyle8497 Posted June 20, 2014 Share Posted June 20, 2014 (edited) Hello all, I'm here again to ask for your assistance once again for a rudimentary script for you coders that I can't seem to get to work. Summary: When the player enters a specific trigger box, their walking/running speed is cut in half. When the player exits, their speed returns to normal. Here's what I TRIED to get to work, but I'm too stupid to understand Papyrus. Scriptname SpikyGrassSlowen extends ObjectReference Float SpeedMult Event OnTriggerEnter(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.SetGameSettingFloat("SpeedMult",50) EndIf EndEvent Event OnTriggerExit(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.SetGameSettingFloat("SpeedMult",100) EndIf EndEvent Edited June 20, 2014 by Kyle8497 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 20, 2014 Share Posted June 20, 2014 Three things:1. You are setting a float but using integers add a .0 so that you have 50.0 and 100.0 Papyrus doesn't always want to compute when things don't quite match up 2. It is OnTriggerLeave not OnTriggerExit. 3. You need to use a valid game setting. See this listing: http://www.creationkit.com/SettingsI would suggest you consider using either or both fMoveCharWalkBase & fMoveCharRunBaseBut those are just guesses not sure what they actually affect. Link to comment Share on other sites More sharing options...
Mattiewagg Posted June 20, 2014 Share Posted June 20, 2014 As far as I can tell, "SpeedMult" isn't a property (if it is you declared it incorrectly), and it doesn't look like you declared the value of SpeedMult anywhere in your script. Link to comment Share on other sites More sharing options...
Ceruulean Posted June 20, 2014 Share Posted June 20, 2014 (edited) Why not make a magic effect that changes the actor value of speedmult? Then whenever the player enters the trigger the slow spell is cast on the player.I think that's what the path to High Hrothegar and the 7000 steps does. EDIT: Sorry, I did not mean the path to High Hrothgar, it's actually the path to Paarthurnax that will slow you down if you don't clear away the blizzards. Edited June 21, 2014 by Ceruulean Link to comment Share on other sites More sharing options...
Mattiewagg Posted June 20, 2014 Share Posted June 20, 2014 High Hrothgar makes you slower? The 7000 steps? I never noticed that before. Edit: Oh. That makes more sense :) Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 20, 2014 Share Posted June 20, 2014 More info: You are using SetGameSettingFloat which is for changing game settings of which SpeedMult is not one of them. See earlier post if you really want to use that function. SpeedMult is an ActorValue. To change that value you need to use SetActorValue, ForceActorValue, ModActorValue or DamageActorValue. Most likely it would be SetActorValue that you want to use. First use GetActorValue to ensure that you get the original value on enter, then set it back to that on exit. If using SetActorValue, SpeedMult does not need to be defined because the function will interpret the data directly. @CeruuleanWhen does the player speed get changed going up the 7000 steps to High Hrothgar? That has never happened in my game. I can run up it or walk up it without any change in my speed. Link to comment Share on other sites More sharing options...
lofgren Posted June 20, 2014 Share Posted June 20, 2014 As mentioned above whether you use a magic effect or a script, it's far preferable to change the speedmult actor value than to go messing about with game settings. Personally I would use a magic effect because it is more reliable than a script. Link to comment Share on other sites More sharing options...
Ceruulean Posted June 21, 2014 Share Posted June 21, 2014 (edited) High Hrothgar makes you slower? The 7000 steps? I never noticed that before. Ah shoot, I meant the path to Paarthurnax makes you go slower. Sorry, my memory isn't that good. In that case I think there is a hazard placed there that makes the player move slower. Edited June 21, 2014 by Ceruulean Link to comment Share on other sites More sharing options...
Kyle8497 Posted June 22, 2014 Author Share Posted June 22, 2014 (edited) So, I collectively took the given advice and produced this new script, which is still not working. Actually, it does work, but it only works if I have my sword out. My character must walk over the trigger box area with their sword out, come to a complete stop, then walk again and their actor value will be changed. What can be done about this? Some kind of update interval or something? Scriptname SpikyGrassSlowen extends ObjectReference String SpeedMult Event OnTriggerEnter(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.GetPlayer().SetActorValue("SpeedMult", 50.0) EndIf EndEvent Event OnTriggerLeave(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Game.GetPlayer().SetActorValue("SpeedMult", 100.0) EndIf EndEvent Edited June 22, 2014 by Kyle8497 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 22, 2014 Share Posted June 22, 2014 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. Link to comment Share on other sites More sharing options...
Recommended Posts