Ancordia_PRC8/_module/nss/exit_house.nss
Jaysyn904 102ba7dab6 Initial Commit
Initial Commit
2023-09-21 19:51:32 -04:00

28 lines
1.1 KiB
Plaintext

#include "x4_inc_functions"
void main()
{
object oPC = GetExitingObject();
if (!GetIsPC(oPC)) return;
//compare the time of entering the estate with the time of leaving to determine if buffs are applicable
int nEnterTime = GetLocalInt(oPC, "TimeEntered");
int nTimeResting = CurrentDateTime() - nEnterTime;
effect eBuff;
if (nTimeResting >= 2) //2 hours required for buffs
{
//remove the earlier instance of this buff and reapply it
effect eEffect = GetFirstEffect(oPC);
while (GetIsEffectValid(eEffect))
{
if (GetLocalString(GetEffectCreator(eEffect), "House") != "") RemoveEffect(oPC, eEffect);
eEffect = GetNextEffect(oPC);
}
eBuff = EffectSavingThrowIncrease(SAVING_THROW_ALL, 1);
eBuff = EffectLinkEffects(eBuff, EffectTemporaryHitpoints(GetMaxHitPoints(oPC)/10));
eBuff = EffectLinkEffects(eBuff, EffectACIncrease(1));
eBuff = SupernaturalEffect(eBuff);
AssignCommand(OBJECT_SELF, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oPC, 3600.0)); //1 real-time hour buff
}
}