-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagickaRegen.lua
More file actions
27 lines (22 loc) · 1.09 KB
/
Copy pathmagickaRegen.lua
File metadata and controls
27 lines (22 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--[[
Written by 'Rolf' for TES3MP 0.8.0/0.8.1.
Description: Adds constant magicka regeneration to players. Adjust the amount of regeneration and its timing.
Steps:
1. Place this file inside 'server\scripts\custom' folder, located in your TES3MP directory.
2. Open 'customScripts.lua' file ('server\scripts') and write in it the next line: require('custom/magickaRegen')
3. Save the changes and close it.
--]]
local mult = 0.05 -- Magicka regeneration formula multiplier.
local delay = 1.0625 -- Timer in seconds.
function regenMagicka(pid)
local p = Players[pid]
if p then
local currMagicka, baseMagicka = tes3mp.GetMagickaCurrent(pid), p.data.stats.magickaBase
if currMagicka < baseMagicka then
tes3mp.SetMagickaCurrent(pid, currMagicka + (baseMagicka * (1 - (currMagicka/baseMagicka)) * mult))
tes3mp.SendStatsDynamic(pid)
tes3mp.StartTimer(tes3mp.CreateTimerEx('regenMagicka', delay * 1000, 'i', pid))
end
end
end
customEventHooks.registerHandler('OnPlayerConnect', function(_, pid) regenMagicka(pid) end)