becomes
Another way of fixing this is having a local variable of return type then in the if/then/else instead of returning, you can set the local to the value to be returned then returning that after all your stuff.
return 0.
call DoNothing()
return 1.
function act takes nothing returns nothing
local unit c = GetAttacker()
local unit t = GetAttackedUnit()
if GetWidgetLife(t) < 500 then
call KillUnit(t)
else
call UnitDamageTarget(c,t,200,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
endif
so only for if statements with returns? then how about this?:"If you use return in an if, follow it immediately with an endif. Anything after endif is else anyhow."
becomes
if (u == null) then
return false
else
call KillUnit(u)
return true
endif
if (u == null) then
return false
endif
call KillUnit(u)
return true
if (u == null) then
return false
endif
call KillUnit(u)
return true
if (u == null) then
set b = false
else
call KillUnit(u)
set b = true
endif
return b