Shield Recovering
Moderator: Moderators
- RED51
- Jedi

- Posts: 1024
- Joined: Sun Sep 07, 2008 6:25 pm
Shield Recovering
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.
- Fiodis
- Master of the Force

- Posts: 4145
- Joined: Wed Nov 12, 2008 9:27 pm
- Projects :: Rannoch + Tientia + Tools Programming
Re: Shield Recovering
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:
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.
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
)- RED51
- Jedi

- Posts: 1024
- Joined: Sun Sep 07, 2008 6:25 pm
Re: Shield Recovering
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.
