Guest User

magicka of third age spellmaker edit

a guest
Jul 22nd, 2022
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. -- block spellmaking if you don't have enough gold, thanks to SpellMaker mod for this
  2. local function spellmaking_block(eventData)
  3.   local menu = tes3ui.findMenu("MenuSpellmaking")
  4.   if menu then
  5.     local npcID = tes3ui.getServiceActor(e)
  6.     if npcID then isSelfSpellmaking = 0 else isSelfSpellmaking = 1 end
  7.     if isSelfSpellmaking == 0 then
  8.         local buyButton = menu:findChild("MenuSpellmaking_Buybutton")
  9.         local gold_amount = tes3.getPlayerGold()
  10.         buyButton:registerBefore(tes3.uiEvent.mouseClick,
  11.                     function(mouseClickEventData)
  12.                         if gold_amount < math.floor(spellmaker_cost * cost_gold_mult) then
  13.                             tes3.messageBox("You don't have enough gold to create this spell")
  14.                             return false -- this will prevent the regular mouseclick event from being run
  15.                         end
  16.                     end
  17.                 )
  18.     end
  19.   end
  20. end
  21.  
  22. local function spellmaking_payment(e)
  23.   if isSelfSpellmaking == 0 then
  24.     tes3.removeItem({reference = tes3.player, item = "gold_001", count = math.floor(spellmaker_cost * cost_gold_mult)})
  25.   end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment