Guest User

My Script

a guest
Dec 3rd, 2024
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. Scriptname WeaponsMasterScriptMCM extends MCM_ConfigBase
  2.  
  3. SPELL Property ArenaTeleportSpell Auto
  4. Quest Property WeaponsMasterQuest Auto
  5. GlobalVariable Property HandlingRequirementSlider Auto
  6. GlobalVariable Property ScriptUpdateInterval Auto
  7.  
  8. ; Returns version of this script.
  9. Int Function GetVersion()
  10. return 1 ;MCM Helper
  11. EndFunction
  12.  
  13. Event OnUpdate()
  14. parent.OnUpdate()
  15. MigrateToMCMHelperCheck("OnUpdate")
  16. Actor PlayerActor = Game.GetPlayer()
  17. Int iWeaponHandling = PlayerActor.GetActorValue("OneHanded") + PlayerActor.GetActorValue("TwoHanded")
  18. If iWeaponHandling > iRequiredHandling
  19. ArenaSpell()
  20. Else
  21. RegisterForSingleUpdate(ScriptUpdateInterval)
  22. PlayerActor.RemoveSpell(ArenaTeleportSpell)
  23. EndIf
  24. EndEvent
  25.  
  26. ; Called when game is reloaded.
  27. Event OnGameReload()
  28. parent.OnGameReload()
  29. MigrateToMCMHelperCheck("OnGameReload")
  30. If GetModSettingBool("bLoadSettingsonReload:Maintenance")
  31. LoadSettings()
  32. VerboseMessage("OnGameReload: Settings autoloaded!")
  33. EndIf
  34. EndEvent
  35.  
  36. Event OnConfigOpen()
  37. parent.OnConfigOpen()
  38. MigrateToMCMHelperCheck("OnConfigOpen")
  39. EndEvent
  40.  
  41. ; Called when this config menu is initialized.
  42. Event OnConfigInit()
  43. parent.OnConfigInit()
  44. migrated = True
  45. LoadSettings()
  46. EndEvent
  47.  
  48. Event OnSettingChange(String a_ID)
  49. parent.OnSettingChange(a_ID)
  50. If a_ID == "iRequiredHandling:General"
  51. HandlingRequirementSlider.SetValue(GetModSettingInt("iRequiredHandling:General") as Float)
  52. ElseIf a_ID == "iScriptUpdateInterval:General"
  53. ScriptUpdateInterval.SetValue(GetModSettingInt("iScriptUpdateInterval:General") as Float)
  54. EndIf
  55. EndEvent
  56.  
  57. Event OnPageSelect(String a_page)
  58. parent.OnPageSelect(a_page)
  59. If a_page == "$General_Page"
  60. RefreshMenu()
  61. EndIf
  62. EndEvent
  63.  
  64. Function Default()
  65. SetModSettingInt("iRequiredHandling:General", 99)
  66. SetModSettingInt("iScriptUpdateInterval:General", 3)
  67. VerboseMessage("Settings reset!")
  68. Load()
  69. EndFunction
  70.  
  71. Function Load()
  72. HandlingRequirementSlider.SetValue(GetModSettingInt("iRequiredHandling:General") as Float)
  73. ScriptUpdateInterval.SetValue(GetModSettingInt("iScriptUpdateInterval:General") as Float)
  74. VerboseMessage("Settings applied!")
  75. EndFunction
  76.  
  77. Function LoadSettings()
  78. If GetModSettingBool("bEnabled:Maintenance") == false
  79. return
  80. EndIf
  81. Utility.Wait(GetModSettingInt("iLoadingDelay:Maintenance"))
  82. VerboseMessage("Settings autoloaded!")
  83. Load()
  84. EndFunction
  85.  
  86. Function MigrateToMCMHelperCheck(String EventName)
  87. If !migrated
  88. migrated = True
  89. If MiscUtil.FileExists("Data/MCM/Settings/Unnamed Arena - My Version.ini")
  90. VerboseMessage(EventName + ": Settings file found, importing aborted!")
  91. Return
  92. EndIf
  93. MigrateToMCMHelper()
  94. VerboseMessage(EventName + ": Settings imported!")
  95. EndIf
  96. EndFunction
  97.  
  98. Function MigrateToMCMHelper()
  99. SetModSettingInt("iRequiredHandling:General", HandlingRequirementSlider.GetValue() as Int)
  100. SetModSettingInt("iScriptUpdateInterval:General", ScriptUpdateInterval.GetValue() as Int)
  101. EndFunction
  102.  
  103. Event OnInit()
  104. RegisterForSingleUpdate(ScriptUpdateInterval)
  105. EndEvent
  106.  
  107.  
  108.  
  109. Function ArenaSpell()
  110. Actor PlayerActor = Game.GetPlayer()
  111. PlayerActor.AddSpell(ArenaTeleportSpell, True)
  112. WeaponsMasterQuest.CompleteQuest()
  113. UnregisterForUpdate()
  114. EndFunction
Advertisement
Add Comment
Please, Sign In to add comment