Hammer custom triggers?

Hey facepunch, Renamon here.

So lately im doing stuff in hammer that I’ve never done before like lua_run and other things. What im trying now is to make a custom trigger. When the activator uses his ‘use’ command (Default E) on the brush with the trigger, the trigger is to send +5 something to the activator. Now I was thinking of just doing this with a lua_run but Im not sure how to check for this in my own lua files outside of the map.

Basically. The player walks up to an alter, presses E to recharge his/her prayer points and his prayer bar increases until is at %100.

On the external lua side I was thinking of


local prayer = 0 // Prayer starts at Zero unless increased by potion or alter
prayer_charging = false // Player is not charging all the time

local function prayer_recharge()
if prayer_charging = true then
if prayer == 100 then return end elseif prayer < 100 then
prayer = prayer + 5
end
end
end

And on the custom trigger I could have a lua_run send prayer_charging = true to the activator.

Would this work? Would this work in multiplayer? I there a limit on the number of lua_run entities per map?

Thanks in advance.

Use func_button to trigger lua_run?