I am testing a “cycle system” to update a party’s temporary hitpoint status display after being first applied. These functions appear to work … and are the bare bones, not taking into account anything else you may do …
I just thought others may like to try them, as it gets around an age-old issue of temporary hitpoints not updating on the portrait when first applied.
/////////////////////////////////////////////////////////////////////////////////////////
// QUICKLY CYCLE THROUGH PC GROUP TO UPDATE TEMPORARY HITPOINT DISPLAY ON PORTRAITS
// CycleUpdate is called 0.2 seconds after applying any temporary hitpoints.
/////////////////////////////////////////////////////////////////////////////////////////
void DoPossess(object oPC, object oFM);
void DoPossess(object oPC, object oFM)
{
oFM = SetOwnersControlledCompanion(oPC, oFM);
SetOwnersControlledCompanion(oFM, oPC);
}
void CycleUpdate(object oPC);
void CycleUpdate(object oPC)
{
object oFM = GetFirstFactionMember(oPC, FALSE);
while(oFM != OBJECT_INVALID)
{
if(GetAssociateType(oFM) == 0)
{
DelayCommand(0.2, DoPossess(oPC, oFM));
}
oFM = GetNextFactionMember(oPC, FALSE);
}
}
I did try applying a heal effect immediately after the application, and also with a delay, but it did not appear to work. However, I have been messing around with the script quite a bit, and so it’s always worth another test in case I did it wrong. i.e. I was messing around with current and maximum HPs and that gets a little flaky when temp HPs are involved.
EDIT: I tried simply adding an EffectHeal(100) a second after in another test, but it did not work for me.
UPDATE: Unfortunately, while this does give a correctly updated amount on application, it looks like the values need to be updated in other situations too, such as after an area change or reload.
It may be a case of applying the cycle code on an area change or module load to reapply the figures correctly. I’ll work on an update to this for my own modules, and see how that goes.
UPDATE: Confirmed that adding this to area enter resets the HPs correctly again.
UPDATE: Just spotted that they can also be “reset” (visually only) when taunted. I am going to keep an eye on these figures and try to apply the visual fix if an when required, as long as it can be done so without compromising other code.
I think I am going to try to work on a separate display for temporary HPs to show instead of the normal version (make hidden) when present. I’ll see how that pans out. Yeh, not so easy after all …
OK, I’m going to try to completely rework temporary hitpoints using the EffectBonusHitpoints property effect, as I don’t see that used anywhere else. I’ll report back if I manage anything useful. (*)
(*) Temporary hitpoints appear broken in many ways, including how they display on character sheet and inventory (which I have now fixed). However, I will try to rework this anyway.
As far as I can tell, I believe I have now solved this using a version of EffectBonusHitpoints. At the moment, I have the extra HPs applied and they show on the portraits, and stay present on area transition and a reload. and they drop correctly during combat.
Currently, there is no associated effect icon, but I’ll see what I can do. I’ll update with any more news.
I think this could be it … I’m just going to put it through some testing, and will post code if it works. EDIT: The code works without the additional effect icon (*), but if you want it like I wanted, you may need to edit your own “removal” of said icon when the PC drops below their maximum hitpoints.
(*) Now showing my new icon for “Divine Protection”.