#include "inc_system_const" #include "colors_inc" // Increases the infection level of oPC by iIncreaseBy // If bDisplayMessage is TRUE, a message with the PC's new infection level will be displayed void DISEASE_IncreaseDiseaseLevel(object oPC, int iIncreaseBy, int bDisplayMessage = TRUE); // Removes iDecreaseBy amount of infection from oPC. If the PC's infection level would fall below // 0, it is set to 0. // If bDisplayMessage is TRUE, a message with the PC's new infection level will be displayed void DISEASE_ReduceDiseaseLevel(object oPC, int iDecreaseBy, int bDisplayMessage = TRUE); // Returns the current disease level of oPC int DISEASE_GetDiseaseLevel(object oPC); // Sets the current disease level of oPC to iDiseaseLevel void DISEASE_SetDiseaseLevel(object oPC, int iDiseaseLevel); // Returns the disease cap of oPC int DISEASE_GetDiseaseCap(object oPC); // Sets oPC's disease cap. If their infection level reaches this cap, // they will die instantly and turn into a zombie. void DISEASE_SetDiseaseCap(object oPC, int iDiseaseCap); // Call this on the module OnHeartbeat event. // It will attempt to reduce the disease rate of a player by a set amount. // oPC = The PC object // bShowMessage = If set TRUE, it will display the infection rating after some is removed. If FALSE, the message won't display void DISEASE_RunDiseaseRemovalProcess(object oPC, int bShowMessage = TRUE); int DISEASE_GetDiseaseLevel(object oPC) { object oDatabase = GetItemPossessedBy(oPC, PC_DATABASE); return GetLocalInt(oDatabase, DISEASE_PC_DISEASE_LEVEL); } void DISEASE_SetDiseaseLevel(object oPC, int iDiseaseLevel) { object oDatabase = GetItemPossessedBy(oPC, PC_DATABASE); SetLocalInt(oDatabase, DISEASE_PC_DISEASE_LEVEL, iDiseaseLevel); } int DISEASE_GetDiseaseCap(object oPC) { object oDatabase = GetItemPossessedBy(oPC, PC_DATABASE); return GetLocalInt(oDatabase, DISEASE_PC_DISEASE_CAP); } void DISEASE_SetDiseaseCap(object oPC, int iDiseaseCap) { object oDatabase = GetItemPossessedBy(oPC, PC_DATABASE); SetLocalInt(oDatabase, DISEASE_PC_DISEASE_CAP, iDiseaseCap); } void DISEASE_IncreaseDiseaseLevel(object oPC, int iIncreaseBy, int bDisplayMessage = TRUE) { object oDatabase = GetItemPossessedBy(oPC, PC_DATABASE); int iInfectionLevel = DISEASE_GetDiseaseLevel(oPC) + iIncreaseBy; SetLocalInt(oDatabase, DISEASE_PC_DISEASE_LEVEL, iInfectionLevel); int iInfectionCap = DISEASE_GetDiseaseCap(oPC); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DISEASE_S), oPC); // Display infection level if bDisplayMessage is TRUE if(bDisplayMessage) { SendMessageToPC(oPC, ColorTokenRed() + "Infection Level: " + IntToString(iInfectionLevel) + "%"); } // If disease level goes beyond oPC's cap, they are instantly killed if(iInfectionLevel >= iInfectionCap) { ExecuteScript("zombie_clone", oPC); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oPC)), oPC); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutsceneImmobilize(), oPC, 6.0); DelayCommand(1.0, AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("DEATH_REALM_LOST_SOULS"))))); SetLocalInt(oDatabase, "DEAD", 0); SetLocalInt(oDatabase, "PC_ZOMBIE", TRUE); FloatingTextStringOnCreature("The infection has taken over your body.", oPC); } } void DISEASE_ReduceDiseaseLevel(object oPC, int iDecreaseBy, int bDisplayMessage = TRUE) { object oDatabase = GetItemPossessedBy(oPC, PC_DATABASE); int iInfectionLevel = DISEASE_GetDiseaseLevel(oPC) - iDecreaseBy; if(iInfectionLevel < 0) iInfectionLevel = 0; SetLocalInt(oDatabase, DISEASE_PC_DISEASE_LEVEL, iInfectionLevel); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_REMOVE_CONDITION), oPC); // Display infection level if bDisplayMessage is TRUE if(bDisplayMessage) { SendMessageToPC(oPC, ColorTokenRed() + "Infection Level: " + IntToString(iInfectionLevel) + "%"); } } void DISEASE_RunDiseaseRemovalProcess(object oPC, int bShowMessage = TRUE) { object oDatabase = GetItemPossessedBy(oPC, PC_DATABASE); int iDiseaseCountDown = GetLocalInt(oDatabase, "DISEASE_COUNT_DOWN"); iDiseaseCountDown = iDiseaseCountDown - 1; if (iDiseaseCountDown <= 0) { int iDecreaseBy = (d10(1) + 5); SendMessageToPC(oPC, "Your body fights off some of the infection..."); DISEASE_ReduceDiseaseLevel(oPC, iDecreaseBy, bShowMessage); iDiseaseCountDown = 600; } SetLocalInt(oDatabase, "DISEASE_COUNT_DOWN", iDiseaseCountDown); } // Error checking //void main(){}