Regeneration work

Regeneration work.  Full compile.
This commit is contained in:
Jaysyn904 2023-01-24 21:20:53 -05:00
parent 300e3252fb
commit edb3ec4afe
39 changed files with 135 additions and 16 deletions

View File

@ -2118,7 +2118,7 @@
}, },
"Mod_ID": { "Mod_ID": {
"type": "void", "type": "void",
"value": "<22><><EFBFBD><EFBFBD>\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000玕u0000\u0000\u0000" "value": "<22><><EFBFBD><EFBFBD>\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0020\u0001\u0000\u0000"
}, },
"Mod_IsSaveGame": { "Mod_IsSaveGame": {
"type": "byte", "type": "byte",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -15,7 +15,34 @@ void main()
{ {
object oNPC = OBJECT_SELF; object oNPC = OBJECT_SELF;
object oAttacker; object oAttacker;
string sResRef = GetResRef(oNPC); string sResRef = GetResRef(oNPC);
effect eSleep = EffectSleep();
//:: Handles troll regen
if(sResRef == "ra_troll001" || sResRef == "TROLL_FEDORLA")
{
if(GetLocalInt(oNPC, "nSubDual") > 0)
{
SetLocalInt(oNPC, "nSubDual", GetLocalInt(oNPC, "nSubDual") - 5);
if(GetLocalInt(oNPC, "nSubDual") < GetCurrentHitPoints(oNPC))
{
RemoveEffect(oNPC, eSleep);
}
if(GetLocalInt(oNPC, "nSubDual") > GetCurrentHitPoints(oNPC))
{
SpeakString("I am still unconscious!");
SetIsDestroyable(FALSE, TRUE, TRUE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSleep, OBJECT_SELF, 6.5f);
}
SpeakString("My Subdual is now " + IntToString(GetLocalInt(oNPC, "nSubDual")));
}
}
//:: Equips best armor //:: Equips best armor
if ((!GetIsInCombat(oNPC) && (GetItemInSlot(INVENTORY_SLOT_CHEST) == OBJECT_INVALID))) if ((!GetIsInCombat(oNPC) && (GetItemInSlot(INVENTORY_SLOT_CHEST) == OBJECT_INVALID)))

View File

@ -13,6 +13,16 @@
void main() void main()
{ {
int nTotalDamage = GetTotalDamageDealt();
int nFireDamage = 0;
int nAcidDamage = 0;
int nTotalHP = GetMaxHitPoints(OBJECT_SELF);
string sResRef = GetResRef(OBJECT_SELF);
effect eSleep = EffectSleep();
effect eSlow = EffectSlow();
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// GZ: 2003-10-16 // GZ: 2003-10-16
// Make Plot Creatures Ignore Attacks // Make Plot Creatures Ignore Attacks
@ -22,6 +32,73 @@ void main()
return; return;
} }
//:: Handles troll regen
if(sResRef == "ra_troll001" || sResRef == "TROLL_FEDORLA")
{
DelayCommand(0.0f, SpeakString("Max/Total HP: " + IntToString(nTotalHP)));
if(GetDamageDealtByType(DAMAGE_TYPE_FIRE) != -1)
{
nFireDamage = GetDamageDealtByType(DAMAGE_TYPE_FIRE);
//DelayCommand(0.0f, SpeakString("Fire Damage: " + IntToString(nFireDamage)));
}
if(GetDamageDealtByType(DAMAGE_TYPE_ACID) != -1)
{
nAcidDamage = GetDamageDealtByType(DAMAGE_TYPE_ACID);
//DelayCommand(0.0f, SpeakString("Acid Damage: " + IntToString(nAcidDamage)));
}
int nNoRegen = nFireDamage + nAcidDamage;
int nSubDmg = nTotalDamage - nNoRegen;
//DelayCommand(0.0f, SpeakString("Real damage this attack: " + IntToString(nNoRegen)));
SetLocalInt(OBJECT_SELF, "NoRegen", nNoRegen + GetLocalInt(OBJECT_SELF, "NoRegen"));
nNoRegen = GetLocalInt(OBJECT_SELF, "NoRegen");
//DelayCommand(0.0f, SpeakString("Actual Damage Stored: " + IntToString(nNoRegen)));
effect eHeal = EffectHeal(nSubDmg);
//DelayCommand(0.0f, SpeakString("Subdual damage healed: " + IntToString(nSubDmg)));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF, 0.0f);
int nCurrentHP = GetCurrentHitPoints(OBJECT_SELF);
DelayCommand(0.0f, SpeakString("Current HP: " + IntToString(nCurrentHP)));
if ((nTotalHP - nNoRegen) < nCurrentHP)
{
nCurrentHP = nTotalHP - nNoRegen;
//DelayCommand(0.0f, SpeakString("Setting HP to: " + IntToString(nCurrentHP)));
SetCurrentHitPoints(OBJECT_SELF, nCurrentHP);
}
if(GetLocalInt(OBJECT_SELF, "nSubDual") <= GetCurrentHitPoints(OBJECT_SELF))
{
SetLocalInt(OBJECT_SELF, "nSubDual", nSubDmg + GetLocalInt(OBJECT_SELF, "nSubDual"));
}
int nSD = GetLocalInt(OBJECT_SELF, "nSubDual");
//DelayCommand(0.0f, SpeakString("SD: " + IntToString(nSD)));
//DelayCommand(0.0f, SpeakString("CH: " + IntToString(nCurrentHP)));
//DelayCommand(0.0f, SpeakString("NoRegen: " + IntToString(nNoRegen)));
if(nSD > GetCurrentHitPoints(OBJECT_SELF))
{
//SpeakString("I am unconscious!");
SetIsDestroyable(FALSE, TRUE, TRUE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSleep, OBJECT_SELF, 6.0f);
}
else if(nSD == GetCurrentHitPoints(OBJECT_SELF))
{
//SpeakString("I am staggered!");
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSlow, OBJECT_SELF, 6.0f);
}
}
//:: Execute the CODI AI NPC OnDamaged script //:: Execute the CODI AI NPC OnDamaged script
ExecuteScript("no_ai_dam", OBJECT_SELF); ExecuteScript("no_ai_dam", OBJECT_SELF);

View File

@ -24,6 +24,7 @@ void main()
int nUser = GetUserDefinedEventNumber(); int nUser = GetUserDefinedEventNumber();
int nFireDamage = 0; int nFireDamage = 0;
int nAcidDamage = 0; int nAcidDamage = 0;
int nTotalHP = GetMaxHitPoints(OBJECT_SELF);
string sResRef = GetResRef(OBJECT_SELF); string sResRef = GetResRef(OBJECT_SELF);
@ -32,7 +33,7 @@ void main()
if(nUser == EVENT_HEARTBEAT ) //HEARTBEAT if(nUser == EVENT_HEARTBEAT ) //HEARTBEAT
{ {
if(sResRef == "ra_troll001" || sResRef == "TROLL_FEDORLA") /* if(sResRef == "ra_troll001" || sResRef == "TROLL_FEDORLA")
{ {
if(GetLocalInt(OBJECT_SELF, "nSubDual") > 0) if(GetLocalInt(OBJECT_SELF, "nSubDual") > 0)
{ {
@ -42,9 +43,10 @@ void main()
{ {
RemoveEffect(OBJECT_SELF, eSleep); RemoveEffect(OBJECT_SELF, eSleep);
} }
//SpeakString("My Subdual is now " + IntToString(GetLocalInt(OBJECT_SELF, "nSubDual"))); SpeakString("My Subdual is now " + IntToString(GetLocalInt(OBJECT_SELF, "nSubDual")));
} }
} } */
} }
else if(nUser == EVENT_PERCEIVE) // PERCEIVE else if(nUser == EVENT_PERCEIVE) // PERCEIVE
{ {
@ -64,23 +66,28 @@ void main()
} }
else if(nUser == EVENT_DAMAGED) // DAMAGED else if(nUser == EVENT_DAMAGED) // DAMAGED
{ {
if(sResRef == "ra_troll001" || sResRef == "TROLL_FEDORLA") /* if(sResRef == "ra_troll001" || sResRef == "TROLL_FEDORLA")
{ {
int nTotalDamage = GetTotalDamageDealt(); int nTotalDamage = GetTotalDamageDealt();
if(GetDamageDealtByType(DAMAGE_TYPE_FIRE) > 0) if(GetDamageDealtByType(DAMAGE_TYPE_FIRE) >= 1)
{ {
nFireDamage = GetDamageDealtByType(DAMAGE_TYPE_FIRE); nFireDamage = GetDamageDealtByType(DAMAGE_TYPE_FIRE);
SpeakString("Fire Damage: " + IntToString(nFireDamage));
} }
if(GetDamageDealtByType(DAMAGE_TYPE_ACID) > 0) if(GetDamageDealtByType(DAMAGE_TYPE_ACID) >= 1)
{ {
nAcidDamage = GetDamageDealtByType(DAMAGE_TYPE_ACID); nAcidDamage = GetDamageDealtByType(DAMAGE_TYPE_ACID);
SpeakString("Acid Damage: " + IntToString(nAcidDamage));
} }
int nSubDmg = nTotalDamage - (nFireDamage + nAcidDamage); int nSubDmg = nTotalDamage - (nFireDamage + nAcidDamage);
int nActDmg = nFireDamage + nAcidDamage; int nActDmg = nFireDamage + nAcidDamage;
SpeakString("Real damage this attack: " + IntToString(nActDmg));
SetLocalInt(OBJECT_SELF, "nActDmg", nActDmg + GetLocalInt(OBJECT_SELF, "nActDmg"));
effect eHeal = EffectHeal(nSubDmg); effect eHeal = EffectHeal(nSubDmg);
@ -93,23 +100,31 @@ void main()
} }
int nSD = GetLocalInt(OBJECT_SELF, "nSubDual"); int nSD = GetLocalInt(OBJECT_SELF, "nSubDual");
int nCH = GetCurrentHitPoints(OBJECT_SELF); int nCurrentHP = GetCurrentHitPoints(OBJECT_SELF);
SpeakString("SD: " + IntToString(nSD));
SpeakString("CH: " + IntToString(nCurrentHP));
SpeakString("ActDmg: " + IntToString(nActDmg));
/*SpeakString("SD: " + IntToString(nSD)); if(nSD > nCurrentHP)
SpeakString("CH: " + IntToString(nCH));*/
if(nSD > nCH)
{ {
//SpeakString("I am unconscious!"); SpeakString("I am unconscious!");
SetIsDestroyable(FALSE, TRUE, TRUE); SetIsDestroyable(FALSE, TRUE, TRUE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSleep, OBJECT_SELF, 6.0f); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSleep, OBJECT_SELF, 6.0f);
} }
else if(nSD == nCH) else if(nSD == nCurrentHP)
{ {
//SpeakString("I am staggered!"); SpeakString("I am staggered!");
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSlow, OBJECT_SELF, 6.0f); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSlow, OBJECT_SELF, 6.0f);
} }
}
if ((nTotalHP - nActDmg) < nCurrentHP)
{
nCurrentHP = nTotalHP - nActDmg;
SpeakString("Setting HP to: " + IntToString(nCurrentHP));
SetCurrentHitPoints(OBJECT_SELF, nCurrentHP);
}
} */
} }
else if(nUser == 1007) // DEATH - do not use for critical code, does not fire reliably all the time else if(nUser == 1007) // DEATH - do not use for critical code, does not fire reliably all the time
{ {

Binary file not shown.