In function GetReduction you have to null the unit before returning value or you will leak.
Also your typing is quite odd, why do you tab on every set in the second function, you should tab only after if, loop or function/method/library/scope/module header, also all calls should be in one line(same spaces), it should look like
function GetType takes nothing returns integer
local unit u = null
local real r = 0.
set r = GetUnitX(u)
call SetUnitY(u, r+r*r)
if r < 500. then
set r = 500+r
set u = null
- this is example, also the free lines are not needed but its nothing bad
This is optional but also instead of armor_amount you could name it armorAmount(camelCase), its standard here on the hive