Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname WeaponsMasterScriptMCM extends MCM_ConfigBase
- SPELL Property ArenaTeleportSpell Auto
- Quest Property WeaponsMasterQuest Auto
- GlobalVariable Property HandlingRequirementSlider Auto
- GlobalVariable Property ScriptUpdateInterval Auto
- ; Returns version of this script.
- Int Function GetVersion()
- return 1 ;MCM Helper
- EndFunction
- Event OnUpdate()
- parent.OnUpdate()
- MigrateToMCMHelperCheck("OnUpdate")
- Actor PlayerActor = Game.GetPlayer()
- Int iWeaponHandling = PlayerActor.GetActorValue("OneHanded") + PlayerActor.GetActorValue("TwoHanded")
- If iWeaponHandling > iRequiredHandling
- ArenaSpell()
- Else
- RegisterForSingleUpdate(ScriptUpdateInterval)
- PlayerActor.RemoveSpell(ArenaTeleportSpell)
- EndIf
- EndEvent
- ; Called when game is reloaded.
- Event OnGameReload()
- parent.OnGameReload()
- MigrateToMCMHelperCheck("OnGameReload")
- If GetModSettingBool("bLoadSettingsonReload:Maintenance")
- LoadSettings()
- VerboseMessage("OnGameReload: Settings autoloaded!")
- EndIf
- EndEvent
- Event OnConfigOpen()
- parent.OnConfigOpen()
- MigrateToMCMHelperCheck("OnConfigOpen")
- EndEvent
- ; Called when this config menu is initialized.
- Event OnConfigInit()
- parent.OnConfigInit()
- migrated = True
- LoadSettings()
- EndEvent
- Event OnSettingChange(String a_ID)
- parent.OnSettingChange(a_ID)
- If a_ID == "iRequiredHandling:General"
- HandlingRequirementSlider.SetValue(GetModSettingInt("iRequiredHandling:General") as Float)
- ElseIf a_ID == "iScriptUpdateInterval:General"
- ScriptUpdateInterval.SetValue(GetModSettingInt("iScriptUpdateInterval:General") as Float)
- EndIf
- EndEvent
- Event OnPageSelect(String a_page)
- parent.OnPageSelect(a_page)
- If a_page == "$General_Page"
- RefreshMenu()
- EndIf
- EndEvent
- Function Default()
- SetModSettingInt("iRequiredHandling:General", 99)
- SetModSettingInt("iScriptUpdateInterval:General", 3)
- VerboseMessage("Settings reset!")
- Load()
- EndFunction
- Function Load()
- HandlingRequirementSlider.SetValue(GetModSettingInt("iRequiredHandling:General") as Float)
- ScriptUpdateInterval.SetValue(GetModSettingInt("iScriptUpdateInterval:General") as Float)
- VerboseMessage("Settings applied!")
- EndFunction
- Function LoadSettings()
- If GetModSettingBool("bEnabled:Maintenance") == false
- return
- EndIf
- Utility.Wait(GetModSettingInt("iLoadingDelay:Maintenance"))
- VerboseMessage("Settings autoloaded!")
- Load()
- EndFunction
- Function MigrateToMCMHelperCheck(String EventName)
- If !migrated
- migrated = True
- If MiscUtil.FileExists("Data/MCM/Settings/Unnamed Arena - My Version.ini")
- VerboseMessage(EventName + ": Settings file found, importing aborted!")
- Return
- EndIf
- MigrateToMCMHelper()
- VerboseMessage(EventName + ": Settings imported!")
- EndIf
- EndFunction
- Function MigrateToMCMHelper()
- SetModSettingInt("iRequiredHandling:General", HandlingRequirementSlider.GetValue() as Int)
- SetModSettingInt("iScriptUpdateInterval:General", ScriptUpdateInterval.GetValue() as Int)
- EndFunction
- Event OnInit()
- RegisterForSingleUpdate(ScriptUpdateInterval)
- EndEvent
- Function ArenaSpell()
- Actor PlayerActor = Game.GetPlayer()
- PlayerActor.AddSpell(ArenaTeleportSpell, True)
- WeaponsMasterQuest.CompleteQuest()
- UnregisterForUpdate()
- EndFunction
Advertisement
Add Comment
Please, Sign In to add comment