ModPCMovementSpeed value get saved to the save game?

Post » Wed Feb 16, 2011 1:14 pm

I was asked to provide a spell for my Follow That Actor mod (they want a spell alternative to the dialog trigger). Casting spells to do this kind of is not very immersive to me and I do not really think it is necessary as the only NPC I can ever see the player needing to follow without being undetected are the ones that say come with me to such and such location.

But maybe I am wrong and there are some NPC that disallow any dialog and you will be told to follow them anyway.

So if I am going to make a spell for this I may as well move the script from the token it is now on to a spell instead of having both a spell and a token.

The only part of the script that worries me about using a spell (spells can break and the scripts will not finish all the command lines for a variety of reasons) is that the players speed control would not be reset properly. My script is using the OBSE command ModPCMovementSpeed. So my big question is this:

Will this ModPCMovementSpeed value get saved to the save game or erased on a new load? If it gets erased that is fine, I will not worry about it..
User avatar
Ashley Hill
 
Posts: 3516
Joined: Tue Jul 04, 2006 5:27 am

Post » Wed Feb 16, 2011 6:57 pm

I was asked to provide a spell for my Follow That Actor mod (they want a spell alternative to the dialog trigger). Casting spells to do this kind of is not very immersive to me and I do not really think it is necessary as the only NPC I can ever see the player needing to follow without being undetected are the ones that say come with me to such and such location.

But maybe I am wrong and there are some NPC that disallow any dialog and you will be told to follow them anyway.

So if I am going to make a spell for this I may as well move the script from the token it is now on to a spell instead of having both a spell and a token.

The only part of the script that worries me about using a spell (spells can break and the scripts will not finish all the command lines for a variety of reasons) is that the players speed control would not be reset properly. My script is using the OBSE command ModPCMovementSpeed. So my big question is this:

Will this ModPCMovementSpeed value get saved to the save game or erased on a new load? If it gets erased that is fine, I will not worry about it..

It does not get saved to the savegame, but the effects persist for the duration of the game session - pretty much par for the course for the majority of OBSE commands.

EDIT: A question: would something like this solve your problem?
if (yourScriptWantsToModPcMovementSpeed)  ModPCMovementSpeed amt  ; record the amount by which you modified the movement speed  SetModData "movementSpeed"::amtendif

...and elsewhere:
if GetGameLoaded  ; look up the recorded value  let moddedVal := GetModData "movementSpeed"  ; reset the movement speed  ModPCMovementSpeed -moddedVal

User avatar
Talitha Kukk
 
Posts: 3477
Joined: Sun Oct 08, 2006 1:14 am

Post » Wed Feb 16, 2011 8:35 pm

um, yes I am doing that, but then what happens if the spell is killed before it can do that?

That is why I was wondering if it stays in the savegame. If it doesn't then the worry is no big deal!

Thank you scruggsywuggsy!


It does not get saved to the savegame, but the effects persist for the duration of the game session - pretty much par for the course for the majority of OBSE commands.

EDIT: A question: would something like this solve your problem?
if (yourScriptWantsToModPcMovementSpeed)  ModPCMovementSpeed amt  ; record the amount by which you modified the movement speed  SetModData "movementSpeed"::amtendif

...and elsewhere:
if GetGameLoaded  ; look up the recorded value  let moddedVal := GetModData "movementSpeed"  ; reset the movement speed  ModPCMovementSpeed -moddedVal


User avatar
FoReVeR_Me_N
 
Posts: 3556
Joined: Wed Sep 05, 2007 8:25 pm

Post » Wed Feb 16, 2011 11:22 am

You can't be doing that,Get/ SetModLocalData aren't available yet.

The general fix for magic-effect-script-related bugs is: don't use magic effect scripts. On the other hand you are pretty much guaranteed that once the ScriptEffectUpdate block is running in a given frame it will finish executing, barring any syntax errors that cause it to terminate (e.g. calling a function on a null reference - things not specific to magic effect scripts). You don't really get a guarantee that the Finish block will run, or that variables will retain their values from one frame to the next, etc.

Personally I'd stick with the token script and have the spell do nothing but add the token to the caster. However that doesn't solve the problem I thought you were asking about.

Player casts spell -> movement speed mod = 50
Player loads a game saved prior to casting the spell -> movement speed mod still = 50 and will remain so until he exits the game.

Is that a problem?
User avatar
Ross Zombie
 
Posts: 3328
Joined: Wed Jul 11, 2007 5:40 pm

Post » Wed Feb 16, 2011 9:33 am

Sorry I was "guessing" as to what you were doing because you used the new OBSE language I do not completely understand. I still speak the old school OBSE.

This is what I am doing:

if player.getdistance target > 240
ModPCMovementSpeed 50
set playerspeedlog to playerspeedlog - 50
elseif player.getdistance target > 200
ModPCMovementSpeed 10
set playerspeedlog to playerspeedlog - 10
elseif player.getdistance target < 120
ModPCMovementSpeed -50
set playerspeedlog to playerspeedlog + 50
elseif player.getdistance target < 160
ModPCMovementSpeed -10
set playerspeedlog to playerspeedlog + 10
endif


And then I use playerspeedlog to mod the player speed (reset it) either when the player goes into a menu or when they stop moving forwarded.

This part is in a quest now not a spell. But still I believe there is a chance that any script could get stuck, so I was worried about hurting the players speed permanently.
But as you have explained it is not permanent so I am not worried.

Thanks!



You can't be doing that,Get/ SetModLocalData aren't available yet.

Player casts spell -> movement speed mod = 50
Player loads a game saved prior to casting the spell -> movement speed mod still = 50 and will remain so until he exits the game.

Is that a problem?

User avatar
Steph
 
Posts: 3469
Joined: Sun Nov 19, 2006 7:44 am


Return to IV - Oblivion