Page 1 of 1
Shield Recovering
Posted: Mon Nov 09, 2009 5:12 pm
by RED51
Before I even attempt and create annoying crashes and errors, which I have been dealing with with every other play through, is it possible to "heal" shields without putting in the addshield function in the odf? Also, if that can be done, can it be applied to buffs? Like a shield restoring buff? Thanks in advance.
Re: Shield Recovering
Posted: Tue Nov 10, 2009 11:22 am
by Fiodis
It is easily done through LUA. Using lua, you can have shield-increasing drops (like in, for example, Bakura) or buffs, whichever you like, or weapons.
If you want it to be a buff, create a buff that does 1 damage. Then use some code that would go roughly as follows:
Code: Select all
OnObjectDamage(
function(object, damager)
if damager == nil then return end
if GetObjectLastHitWeaponClass(object) == "odf_of_shield_recharge_buff" then
local unit = GetCharacterUnit(damager)
if unit == nil then return end
SetProperty(unit, "CurShield", GetObjectShield(unit) + #)
end
end
)
Where # is the amount of shield you want restored. Make sure the buff can hurt friends, if you want friends to have their shields restored.
Re: Shield Recovering
Posted: Tue Nov 10, 2009 4:03 pm
by RED51
Thanks, I'll try that. I actually was expecting to be told that it couldn't be done, but guess you can't just rush to conclusions.