PROXiCiDE

Follower Magic Managment

Mar 31st, 2013
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.34 KB | None | 0 0
  1. ScriptName PDC1FollowerMagic Extends ReferenceAlias
  2.  
  3. ;=================================================================================
  4. ;PROXiCide aka Taewon
  5. ;Steam: http://steamcommunity.com/id/PROXiCiDE
  6. ;Nexus: http://skyrim.nexusmods.com/users/3018315
  7. ;Bethesda: http://forums.bethsoft.com/user/425376-taewon/
  8. ;=================================================================================
  9.  
  10. ;=================================================================================
  11. ; Properties
  12. ;=================================================================================
  13.  
  14. FormList Property PDC1HealingSpells Auto
  15. {List of Healing Spells to be enabled}
  16.  
  17. FormList Property PDC1SpellEffectKeywordDamage Auto
  18. {Contains Keywords for Damage Spells, such As MagicDamageFire, ....}
  19.  
  20. ReferenceAlias[] Property pActorRefs Auto
  21.  
  22. ReferenceAlias Property pSpellTargetRef Auto
  23. {Used by Packages, via Quest Alias Target for Spells}
  24.  
  25. Float Property fSpellDistanceInterior = 750.0 Auto
  26. {Distance must match the AI Package}
  27. Float Property fSpellDistanceExterior = 1500.0 Auto
  28. {Distance must match the AI Package}
  29.  
  30. GlobalVariable Property PDC1SpellTarget Auto
  31. {
  32. 1 : Self
  33. 2 : Player
  34. 3 : Follower
  35.  
  36. 4+ : Array Refs
  37. }
  38.  
  39. GlobalVariable Property PDC1SpellDaulCast Auto
  40. {
  41. 0 : Normal Cast
  42. 1 : Dual Cast
  43. }
  44.  
  45. GlobalVariable Property PDC1SpellCastingType Auto
  46. {
  47. 0 : Concentration
  48. 1 : Constant
  49. 2 : Fire and Forget
  50. }
  51.  
  52. GlobalVariable Property PDC1SpellTargetType Auto
  53. {
  54. 1 : Aimed
  55. 2 : Contact
  56. 3 : Self
  57. 4 : Target Actor
  58. 5 : Target Location
  59. 6 : Target Party Members
  60. }
  61.  
  62. GlobalVariable Property PDC1SpellIsHeal Auto
  63. {Spell Type is a Heal}
  64. GlobalVariable Property PDC1SpellIsBuff Auto
  65. {Spell Type is a Buff}
  66. GlobalVariable Property PDC1SpellIsDebuff Auto
  67. {Spell Type is a Debuff}
  68.  
  69. Bool bRangeCheckingEnabled = True
  70.  
  71. ;=================================================================================
  72. ; Get/SetSpellRangeChecking
  73. ;=================================================================================
  74. Bool Function GetSpellRangeChecking()
  75. Return bRangeCheckingEnabled
  76. EndFunction
  77.  
  78. Function SetSpellRangeChecking(Bool bEnabled = True)
  79. bRangeCheckingEnabled = True
  80. If !bEnabled
  81. bRangeCheckingEnabled = False
  82. EndIf
  83. EndFunction
  84.  
  85. ;=================================================================================
  86. ; ResetSpellCasting
  87. ;=================================================================================
  88. Function ResetSpellCasting()
  89. PDC1SpellTarget.SetValue(0)
  90. PDC1SpellDaulCast.SetValue(0)
  91. PDC1SpellCastingType.SetValue(0)
  92. PDC1SpellTargetType.SetValue(0)
  93. PDC1SpellIsHeal.SetValue(0)
  94. PDC1SpellIsBuff.SetValue(0)
  95. PDC1SpellIsDebuff.SetValue(0)
  96. EndFunction
  97.  
  98. ;=================================================================================
  99. ; GetSpellByID
  100. ;=================================================================================
  101. Spell Function GetSpellById(Int iSpellId)
  102. Spell pSpell = None
  103.  
  104. Return pSpell
  105. EndFunction
  106.  
  107. ;=================================================================================
  108. ; IsSpellCasting
  109. ;=================================================================================
  110. Bool Function IsCastingSpell()
  111. If PDC1SpellTarget.GetValue() >= 1
  112. Return True
  113. EndIf
  114. Return False
  115. EndFunction
  116.  
  117. ;=================================================================================
  118. ; IsCastingSpellHeal
  119. ;=================================================================================
  120. Bool Function IsCastingSpellHeal()
  121. If IsCastingSpell() && PDC1SpellIsHeal.GetValue() >= 1
  122. Return True
  123. EndIf
  124. Return False
  125. EndFunction
  126.  
  127. ;=================================================================================
  128. ; IsCastingSpellBuff
  129. ;=================================================================================
  130. Bool Function IsCastingSpellBuff()
  131. If IsCastingSpell() && PDC1SpellIsBuff.GetValue() >= 1
  132. Return True
  133. EndIf
  134. Return False
  135. EndFunction
  136.  
  137. ;=================================================================================
  138. ; IsCastingSpellDebuff
  139. ;=================================================================================
  140. Bool Function IsCastingSpellDebuff()
  141. If IsCastingSpell() && PDC1SpellIsDebuff.GetValue() >= 1
  142. Return True
  143. EndIf
  144. Return False
  145. EndFunction
  146.  
  147. ;=================================================================================
  148. ; CastSpellByType
  149. ; Cast a Spell
  150. ; Types
  151. ; Conc
  152. ; FF
  153. ; Actor
  154. ;=================================================================================
  155. Bool Function CastSpellByType(Actor akTarget, String sSpellName, String sType, Bool bDualCast)
  156. If !IsValidSpellTarget(akTarget,sSpellName)
  157. Return False
  158. EndIf
  159.  
  160. Return True
  161. EndFunction
  162.  
  163. ;=================================================================================
  164. ; CastSpellByName
  165. ; Cast a Spell
  166. ;=================================================================================
  167. Bool Function CastSpellByName(Actor akTarget, String sSpellName, Bool bDualCast)
  168. If !IsValidSpellTarget(akTarget,sSpellName)
  169. Return False
  170. EndIf
  171.  
  172. Return True
  173. EndFunction
  174.  
  175. ;=================================================================================
  176. ; IsHealthValidForHealing
  177. ;=================================================================================
  178. Float Property fHealthPercent75 = 0.75 Auto
  179. Float Property fHealthPercent50 = 0.5 Auto
  180. Float Property fHealthPercent25 = 0.25 Auto
  181.  
  182. Bool Function IsHealthValidForHealing(Actor akTarget)
  183. If akTarget && !akTarget.IsDead()
  184. Float fCurHealthPercent = akTarget.GetActorValuePercentage("Health")
  185. If fCurHealthPercent <= fHealthPercent75
  186. Return True
  187. EndIf
  188. EndIf
  189. Return False
  190. EndFunction
  191.  
  192. ;=================================================================================
  193. ; IsValidSpellTarget
  194. ;=================================================================================
  195. Bool Function IsValidSpellTarget(Actor akTarget, string sSpellName)
  196. If !akTarget || IsCastingSpell()
  197. Return False
  198. EndIf
  199.  
  200. If !pSpellTargetRef
  201. Return False
  202. EndIf
  203.  
  204. If !IsSpellInRange(akTarget, sSpellName) && GetSpellRangeChecking() == True
  205. Return False
  206. EndIf
  207.  
  208. Return True
  209. EndFunction
  210.  
  211. ;=================================================================================
  212. ; IsSpellInRange
  213. ; Checks if in range of target
  214. ;=================================================================================
  215. Bool Function IsSpellInRange(Actor akTarget, String sSpellName)
  216. Actor pSelf = Self.GetActorRef()
  217. If !pSelf
  218. Return False
  219. EndIf
  220.  
  221. If akTarget.GetDistance(pSelf) <= fSpellDistanceInterior && pSelf.IsInInterior()
  222. Return True
  223. EndIf
  224.  
  225. If akTarget.GetDistance(pSelf) <= fSpellDistanceExterior && !pSelf.IsInInterior()
  226. Return True
  227. EndIf
  228.  
  229. Return False
  230. EndFunction
  231.  
  232. ;=================================================================================
  233. ; Get/Set CritChance
  234. ; Crit Chances
  235. ;=================================================================================
  236. Float Function GetSpellCritChance(String sSpellName)
  237.  
  238. EndFunction
  239.  
  240. Function SetSpellCritChance(String sSpellName, Float fCritChance)
  241.  
  242. EndFunction
  243.  
  244. ;=================================================================================
  245. ; GetNumSpells
  246. ; Number of Spells
  247. ;=================================================================================
  248. Int Function GetNumSpells()
  249.  
  250. EndFunction
  251.  
  252. ;=================================================================================
  253. ; IsAttackSpell
  254. ; Does Spell do harm?
  255. ;=================================================================================
  256. Bool Function IsAttackSpell(String sSpellName)
  257.  
  258. EndFunction
  259.  
  260. ;=================================================================================
  261. ; IsPassiveSpell
  262. ; Is Spell a Ability
  263. ; This will probably not be possible
  264. ;=================================================================================
  265. Bool Function IsPassiveSpell(String sSpellName)
  266. ;PDC1SpellCastingType == 1
  267. EndFunction
  268.  
  269. ;=================================================================================
  270. ; Utilities
  271. ;=================================================================================
  272. Float Function MinFloat(Float x,Float y)
  273. If x < y
  274. Return x
  275. Else
  276. Return y
  277. EndIf
  278. EndFunction
  279.  
  280. Float Function MaxFloat(Float x,Float y)
  281. If x > y
  282. Return x
  283. Else
  284. Return y
  285. EndIf
  286. EndFunction
Advertisement
Add Comment
Please, Sign In to add comment