Yeah, that script won't be good for what you want. It will continue trying to heal the player until they leave the game. You also don't want to have an arbitrary wait of '12' that only starts counting down AFTER the player has healed because this will make the trigger unresponsive for other players during that period.
What you want is something like this:
square1:
local.player = parm.other
local.trigger = self
// if player is already healing or he's already at full health, don't do anything and end here
if (local.player.healing || local.player.health == local.player.max_health) end
// player is healing
local.player.healing = 1
local.player loopsound square1sound
// start on these values
local.healvalue = 0.01 // amount of health given each time
local.healtime = 0 // time taken healing (starts at 0)
local.healwait = 0.25 // amount of time to wait between heals
local.healinc = 2.5 // seconds to wait before increasing healing rate (this is for exponential healing)
local.healmult = 2 // amount to multiply the previous healing rate (this is for exponential healing)
// begin the heal
while(1)
{
local.player heal local.healvalue
wait local.healwait
// stop healing if player is dead, or left game, or not touching trigger, or at full health
if !(isAlive local.player) break
if !(local.player isTouching local.trigger) break
if !(local.player.health < local.player.max_health) break
// increment the time spent healing
local.healtime += local.healwait
if (local.healtime >= local.healinc)
{
// player was healing long enough to increase healing amount
local.healvalue = local.healvalue * local.healmult
local.healtime = 0
}
}
// healing has completed, if the player still exists then stop the sound and reset healing value
if (local.player)
{
local.player stoploopsound
local.player.healing = 0
}
end
I went with example 1 (exponential healing). Needs a trigger_multiple. Bear in mind that you don't need this function copied for each square. Just point all your healing triggers to 'square1' (though 'healingsquare' would be a better name) and it will work fine. You can play around with the 5 values till you get something you're happy with.