Guest User

SwordDrain.psc

a guest
Dec 20th, 2022
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. Scriptname SwordDrain extends ObjectReference
  2.  
  3. float playerMagicka
  4.  
  5. SPELL Property DrainMagickaEffect Auto
  6. WEAPON Property PhantomSword Auto
  7.  
  8. ; This function is called when the player equips the PhantomWeapon
  9. Event OnEquipped(Actor akActor)
  10. If akActor == Game.GetPlayer()
  11. ; Get the player's current and base magicka values
  12. playerMagicka = Game.GetPlayer().GetActorValue("Magicka")
  13.  
  14.  
  15. ; Check if the player has enough magicka to equip the weapon
  16. If (playerMagicka < 15)
  17. ; If not, show a notification and prevent the weapon from being equipped
  18. Debug.Notification("You don't have enough magicka to conjure the PhantomWeapon!")
  19. Game.GetPlayer().UnequipItem(PhantomSword)
  20. Else
  21. DrainMagickaEffect.Cast(akActor, akActor)
  22. EndIf
  23. EndIf
  24. EndEvent
  25.  
  26. ; When the player unequips the PhantomWeapon
  27. Event OnUnequipped(Actor akActor)
  28. If akActor == Game.GetPlayer()
  29. ; Remove the magicka drain effect
  30. akActor.DispelSpell(DrainMagickaEffect)
  31. EndIf
  32. EndEvent
Add Comment
Please, Sign In to add comment