Scriptname RBTZ_JetpackLowerAPCost extends activemagiceffect
Float Property fInitialValue = 32.0 Auto
{Script default is 32 - 50% less drain.}
Float Property fSustainedValue = 32.0 Auto
{Script default is 32 - 50% less drain.}
Event OnEffectStart(Actor akTarget, Actor akCaster)
Game.SetGameSettingFloat("fJetpackDrainInital", fInitialValue)
Game.SetGameSettingFloat("fJetpackDrainSustained", fSustainedValue)
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
Game.SetGameSettingFloat("fJetpackDrainInital", 64.0)
Game.SetGameSettingFloat("fJetpackDrainSustained", 64.0)
EndEvent
The purpose of the script is to override two game settings - for initial(fJetpackDrainInital) and sustained(fJetpackDrainSustained) AP drain of the jetpack. This script extends magic effect, so it is meant to be attached to one. When the magic effect is applied, the initial and sustained drain will be set to 32. This is the script default, but these values can be changed with the properties fInitialValue and fSustainedValue, so you can set them to whatever you want. When the effect is removed(unequipping the jetpack or switching to different object mod), the game settings are set to 64(vanilla game default). The function SetGameSettingFloat is added with F4SE. It's required to have the script extender installed and run the game through its loader.
Important: It seems that when you start the game and load a save with the jetpack, the game settings revert back to default. With the new version of the script, upon game load the custom game settings are applied again. Here's what the code looks like:
Scriptname RBTZ_JetpackLowerAPCost extends activemagiceffect
Float Property fInitialValue = 32.0 Auto
{Script default is 32 - 50% less drain.}
Float Property fSustainedValue = 32.0 Auto
{Script default is 32 - 50% less drain.}
Event OnEffectStart(Actor akTarget, Actor akCaster)
Game.SetGameSettingFloat("fJetpackDrainInital", fInitialValue)
Game.SetGameSettingFloat("fJetpackDrainSustained", fSustainedValue)
EndEvent
Event OnPlayerLoadGame()
Game.SetGameSettingFloat("fJetpackDrainInital", fInitialValue)
Game.SetGameSettingFloat("fJetpackDrainSustained", fSustainedValue)
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
Game.SetGameSettingFloat("fJetpackDrainInital", 64.0)
Game.SetGameSettingFloat("fJetpackDrainSustained", 64.0)
EndEvent
0 comments