[Script Question] Fortify spell

Post » Sat Sep 25, 2010 11:27 am

Hello!
I'm trying to make a Fortify spell with script. Just for educational purpose.

I know that they only ways, I can adjust skills etc is with:
ModActorValue (Problem: The score is not going over the highest lvl of its base. Example: If an Actor has 115 Magicka and I put ModActorValue 200, his magicak will not go higher that 115)
SetActorValue (Problem: This actually changes the value BUT it causes trouble. If an actor has 115 Magicka and I put SetActorValue 900, he will get 900. But if i want it to get back to normal, and type SetActorValue -900 will get 0, not 115 that he normally had)
ForceActorValue (This is not working. Same problem like ModActorValue)

Any ideas how i can create a fortify simple spell?
I want to add into the value and after a while it will go back to normal.
User avatar
Nick Pryce
 
Posts: 3386
Joined: Sat Jul 14, 2007 8:36 pm

Post » Sat Sep 25, 2010 2:31 pm

Use http://cs.elderscrolls.com/constwiki/index.php/GetActorValue to return the actor's current skill value, and store that in a variable, before modifying the value with http://cs.elderscrolls.com/constwiki/index.php/SetActorValue. Then you can use SetAV at the end of the timer to restore the value to the variable's amount.
User avatar
Georgine Lee
 
Posts: 3353
Joined: Wed Oct 04, 2006 11:50 am

Post » Sat Sep 25, 2010 2:58 pm

Check out the scripts I made for my http://www.tesnexus.com/downloads/file.php?id=35290 mod for an example of what Khettienna said. Basically, what those scripts do is get the current value of a given skill, store that value as a variable, then use SetAV to change the skill to 100 and later restore that skill to it's original value by referencing the variable that the original value was saved as. You can modify those scripts to accomplish what you desire by changing Begin OnEquip and Begin OnUnEquip to Begin ScriptEffectStart and Begin ScriptEffectFinish respectively. An example:

scn FortifyMagicaScriptshort BaseMagBegin ScriptEffectStartSet BaseMag to Player.GetAV MagickaPlayer.SetAV Magica 900EndBegin ScriptEffectFinishPlayer.SetAV Magicka BaseMagEnd


That should get you what you're after. Just remember to set the spell duration to more than 0, or the ScriptEffectFinish block will run as soon as you cast the spell and you won't notice a result.
User avatar
Bones47
 
Posts: 3399
Joined: Fri Nov 09, 2007 11:15 pm

Post » Sat Sep 25, 2010 12:16 pm

Thank you!!!
User avatar
Lil'.KiiDD
 
Posts: 3566
Joined: Mon Nov 26, 2007 11:41 am


Return to IV - Oblivion