Guest User

Untitled

a guest
Aug 26th, 2026
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.19 KB | None | 0 0
  1. local world = require("openmw.world")
  2. local core = require("openmw.core")
  3. local storage = require("openmw.storage")
  4.  
  5. local settings = storage.globalSection("SettingsPetTheScribs_settings")
  6. local l10n = core.l10n("PetTheScribs")
  7.  
  8. local function normalScrib(actor, scrib, options)
  9. local jellyCooldown = settings:get("jellyCooldown") * 60 * 60 -- in hours
  10. local lastJellyTime = options.lastJellyTimeList[scrib.id] or -jellyCooldown
  11. local currTime = world.getSimulationTime()
  12.  
  13. local minJelly = settings:get("minJelly")
  14. local maxJelly = settings:get("maxJelly")
  15. local jellyCount = math.random(minJelly, maxJelly)
  16.  
  17. if currTime > lastJellyTime + jellyCooldown and jellyCount > 0 then
  18. local jelly = world.createObject("ingred_scrib_jelly_01", jellyCount)
  19. local inv = actor.type.inventory(actor)
  20. ---@diagnostic disable-next-line: discard-returns
  21. jelly:moveInto(inv)
  22.  
  23. options.lastJellyTimeList[scrib.id] = currTime
  24. actor:sendEvent("ShowMessage", {
  25. message = l10n("msg_jellyGot", { jellyCount = jellyCount })
  26. })
  27. end
  28. end
  29.  
  30. local function diseasedScrib(actor, scrib, options)
  31. local activeEffects = actor.type.activeEffects(actor)
  32. local diseaseResist = options.resistEffect
  33. and activeEffects:getEffect(options.resistEffect).magnitude / 100
  34. or 0
  35. local proc = math.random() < options.diseaseChance - diseaseResist
  36.  
  37. local alreadyDiseased = actor.type.activeSpells(actor):isSpellActive(options.disease.id)
  38.  
  39. local telekinesisActive = activeEffects:getEffect(core.magic.EFFECT_TYPE.Telekinesis).magnitude > 0
  40.  
  41. if proc and not alreadyDiseased and not telekinesisActive then
  42. actor.type.spells(actor):add(options.disease.id)
  43. actor:sendEvent("ShowMessage", {
  44. message = l10n("msg_caughtDisease", { disease = options.disease.name })
  45. })
  46. end
  47. end
  48.  
  49. local function iceScrib(actor, scrib, options)
  50. local telekinesisActive = actor.type.activeEffects(actor):getEffect("telekinesis").magnitude > 0
  51. if not telekinesisActive then
  52. actor.type.activeSpells(actor):add({
  53. id = "frostbite",
  54. effects = { 0 }
  55. })
  56. end
  57. end
  58.  
  59. Scribs = {
  60. -- vanilla
  61. ["scrib"] = normalScrib,
  62. ["t_cyr_fau_tantha_01"] = normalScrib,
  63. ["aa_cr_rabbit_orange"] = normalScrib,
  64. ["t_cyr_fau_hrs_01"] = normalScrib,
  65. ["t_cyr_fau_hrs_02"] = normalScrib,
  66. ["t_cyr_fau_hrs_03"] = normalScrib,
  67. ["t_cyr_fau_hrsst_01"] = normalScrib,
  68. ["t_cyr_fau_hrsst_02"] = normalScrib,
  69. ["t_cyr_fau_hrsst_03"] = normalScrib,
  70. ["pc_m1_anv_fthorse"] = normalScrib,
  71. ["t_cyr_fau_hrssadl_03"] = normalScrib,
  72. ["t_cyr_fau_hrssadl_01"] = normalScrib,
  73. ["t_cyr_fau_hrssadl_02"] = normalScrib,
  74. ["t_cyr_fau_rvnewt_01"] = normalScrib,
  75. ["t_cyr_fau_rvnewt_02"] = normalScrib,
  76. ["t_cyr_fau_rvnewt_03"] = normalScrib,
  77. ["t_glb_fau_birdchirs_01"] = normalScrib,
  78. ["t_glb_fau_birdchirs_02"] = normalScrib,
  79. ["t_glb_fau_birdchirs_03"] = normalScrib,
  80. ["t_glb_fau_birdchirs_04"] = normalScrib,
  81. ["t_glb_fau_birdchirs_05"] = normalScrib,
  82. ["t_glb_fau_birdchi_01"] = normalScrib,
  83. ["t_glb_fau_birdchi_02"] = normalScrib,
  84. ["t_glb_fau_birdchi_03"] = normalScrib,
  85. ["t_glb_fau_birdchi_04"] = normalScrib,
  86. ["t_glb_fau_birdchi_05"] = normalScrib,
  87. ["t_glb_fau_birdchi_06"] = normalScrib,
  88. ["t_cyr_fau_frogbul_01"] = normalScrib,
  89. ["t_cyr_fau_frogbul_02"] = normalScrib,
  90. ["t_cyr_fau_frogbul_03"] = normalScrib,
  91. ["t_mw_fau_molec_01"] = normalScrib,
  92. ["t_mw_fau_molec_02"] = normalScrib,
  93. ["t_mw_fau_molec_03"] = normalScrib,
  94. ["tr_m4_q_tmm_bolsguar"] = normalScrib,
  95. ["t_glb_fau_squirrel_01"] = normalScrib,
  96. ["t_glb_fau_squirrel_02"] = normalScrib,
  97. ["t_glb_fau_squirrel_03"] = normalScrib,
  98. ["aa_cr_turtle01"] = normalScrib,
  99. ["aa_cr_turtle02"] = normalScrib,
  100. ["aa_cr_turtle03"] = normalScrib,
  101. ["guar"] = normalScrib,
  102. ["guar_feral"] = normalScrib,
  103. ["t_mw_fau_velk_01"] = normalScrib,
  104. ["t_mw_fau_velk_02"] = normalScrib,
  105. ["t_mw_fau_velk_03"] = normalScrib,
  106. ["tr_m3_oe_fg_cr_velk"] = normalScrib,
  107. ["tr_m4_rr_catcatchernix"] = normalScrib,
  108. ["tr_m3_giapackrat"] = normalScrib,
  109. ["t_mw_fau_guarhrn_01"] = normalScrib,
  110. ["t_mw_fau_guarhrn_02"] = normalScrib,
  111. ["t_mw_fau_guarhrn_03"] = normalScrib,
  112. ["tr_m7_cb_guar_farm"] = normalScrib,
  113. ["aa_cr_ant_giant_01b"] = normalScrib,
  114. ["aa_pack_guar_harness"] = normalScrib,
  115. ["netch_bull"] = normalScrib,
  116. ["pc_m1_sdk_fthorse"] = normalScrib,
  117. ["t_ham_fau_goat_01"] = normalScrib,
  118. ["t_ham_fau_goat_02"] = normalScrib,
  119. ["tr_m4_fg_ushuguar_01"] = normalScrib,
  120. ["t_ham_fau_goat_03"] = normalScrib,
  121. ["t_glb_fau_deer_01"] = normalScrib,
  122. ["t_glb_fau_deer_02"] = normalScrib,
  123. ["t_glb_fau_deer_03"] = normalScrib,
  124. ["t_glb_fau_deer_04"] = normalScrib,
  125. ["t_glb_fau_deer_05"] = normalScrib,
  126. ["t_cyr_fau_catlcow_01"] = normalScrib,
  127. ["t_cyr_fau_catlcow_02"] = normalScrib,
  128. ["t_cyr_fau_catlcow_03"] = normalScrib,
  129. ["t_cyr_fau_catlbull_01"] = normalScrib,
  130. ["t_cyr_fau_catlbull_02"] = normalScrib,
  131. ["aa_rat_pack01"] = normalScrib,
  132. ["aa_rat_pack02"] = normalScrib,
  133. ["aa_rat_pack03"] = normalScrib,
  134. ["aa_rat_pack04"] = normalScrib,
  135. ["aa_rat_pack05"] = normalScrib,
  136. ["aa_rat_pack06"] = normalScrib,
  137. ["t_cyr_fau_catlbull_03"] = normalScrib,
  138. ["t_cyr_fau_donk_01"] = normalScrib,
  139. ["t_cyr_fau_donk_02"] = normalScrib,
  140. ["t_cyr_fau_donk_03"] = normalScrib,
  141. ["sky_xre_horse_01_s"] = normalScrib,
  142. ["sky_xre_horse_02_s"] = normalScrib,
  143. ["sky_xre_horse_03_s"] = normalScrib,
  144. ["sky_xre_horse_04_s"] = normalScrib,
  145. ["sky_xre_horse_05_s"] = normalScrib,
  146. ["t_sky_fau_catlcow_01"] = normalScrib,
  147. ["t_sky_fau_catlcow_02"] = normalScrib,
  148. ["tr_m4_q_troupe_guar"]= normalScrib,
  149. ["t_sky_fau_catlcow_03"] = normalScrib,
  150. ["t_sky_fau_catlcow_04"] = normalScrib,
  151. ["t_mw_fau_ashfowl_01"] = normalScrib,
  152. ["t_mw_fau_ashfowl_02"] = normalScrib,
  153. ["t_mw_fau_ashfowl_03"] = normalScrib,
  154. ["tr_m4_cr_aa_llandesag"] = normalScrib,
  155. ["tr_m4_redhnd_uman"] = normalScrib,
  156. ["tr_m4_cr_nulenguar"] = normalScrib,
  157. ["t_mw_fau_hoom_01"] = normalScrib,
  158. ["t_mw_fau_hoom_02"] = normalScrib,
  159. ["t_mw_fau_hoom_03"] = normalScrib,
  160. ["t_mw_fau_hoom_04"] = normalScrib,
  161. ["t_mw_fau_hoom_05"] = normalScrib,
  162. ["t_mw_fau_kwoom_01"] = normalScrib,
  163. ["t_mw_fau_kwoom_02"] = normalScrib,
  164. ["t_mw_fau_kwoom_03"] = normalScrib,
  165. ["t_mw_fau_kwoom_04"] = normalScrib,
  166. ["t_mw_fau_kwoom_05"] = normalScrib,
  167. ["t_mw_fau_sharaihoppe_01"] = normalScrib,
  168. ["t_mw_fau_sharaihoppe_02"] = normalScrib,
  169. ["t_mw_fau_sharaihoppe_03"] = normalScrib,
  170. ["t_mw_fau_sharaihoppe_04"] = normalScrib,
  171. ["t_mw_fau_sharaihoppe_05"] = normalScrib,
  172. ["t_mw_fau_orn_01"] = normalScrib,
  173. ["t_mw_fau_orn_02"] = normalScrib,
  174. ["t_mw_fau_orn_03"] = normalScrib,
  175. ["t_cyr_fau_hrssadlst_01"] = normalScrib,
  176. ["t_cyr_fau_hrssadlst_02"] = normalScrib,
  177. ["t_cyr_fau_hrssadlst_03"] = normalScrib,
  178. ["netch_betty"] = normalScrib,
  179. ["kwama queen"] = normalScrib,
  180. ["aa_cr_w_newt"] = normalScrib,
  181. ["aa_cr_kriin_herd"] = normalScrib,
  182. ["a_siltstrider"] = normalScrib,
  183. ["rp_guar_domesticated"] = normalScrib,
  184. ["kwama worker entrance"] = normalScrib,
  185. ["kwama worker"] = normalScrib,
  186. ["tr_m1_q_lesa"] = normalScrib,
  187. ["aa_trader_guar_pack"] = normalScrib,
  188. ["guar_pack"] = normalScrib,
  189. ["scrib diseased"] = function(actor, scrib, options)
  190. options.diseaseChance = settings:get("diseaseChance")
  191. options.disease = core.magic.spells.records["droops"]
  192. options.resistEffect = core.magic.EFFECT_TYPE.ResistCommonDisease
  193. diseasedScrib(actor, scrib, options)
  194. end,
  195. ["scrib_vaba-amus"] = normalScrib,
  196. ["scrib blighted"] = function(actor, scrib, options)
  197. options.diseaseChance = settings:get("blightChance")
  198. options.disease = core.magic.spells.records["droops"]
  199. options.resistEffect = core.magic.EFFECT_TYPE.ResistBlightDisease
  200. diseasedScrib(actor, scrib, options)
  201. end,
  202. ["scrib_rerlas"] = normalScrib,
  203.  
  204. -- ice scrib
  205. -- https://www.nexusmods.com/morrowind/mods/51338
  206. ["icescrib"] = iceScrib,
  207.  
  208. -- Creatures and Critters
  209. -- https://www.nexusmods.com/morrowind/mods/54518
  210. ["aa_cr_horned_scrib"] = normalScrib,
  211.  
  212. -- Diverse Scribs
  213. -- https://www.nexusmods.com/morrowind/mods/56176
  214. ["scrib_2"] = normalScrib,
  215. ["scrib diseased_2"] = function(actor, scrib, options)
  216. options.diseaseChance = settings:get("diseaseChance")
  217. options.disease = core.magic.spells.records["droops"]
  218. options.resistEffect = core.magic.EFFECT_TYPE.ResistCommonDisease
  219. diseasedScrib(actor, scrib, options)
  220. end,
  221. ["ttooth_scrib_2"] = normalScrib,
  222.  
  223. -- TriangleTooth's Ecology Mod
  224. -- https://www.nexusmods.com/morrowind/mods/47061
  225. ["ttooth_scrib"] = normalScrib,
  226.  
  227. -- Utility Spells
  228. -- https://www.nexusmods.com/morrowind/mods/58288
  229. ["scrib_summon"] = normalScrib,
  230. }
  231.  
Advertisement
Add Comment
Please, Sign In to add comment