Setup onSpawn Evolved Undead template

Setup onSpawn Evolved Undead template.  Started baseitem work for new iprop forge system.  Full compile.  Updated release archive.
This commit is contained in:
Jaysyn904
2024-12-13 14:05:19 -05:00
parent 1c5cbbe7ea
commit 582b9dbb49
23 changed files with 1387 additions and 17 deletions

View File

@@ -43,7 +43,8 @@ const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
#include "ms_name_inc"
#include "x2_inc_switches"
#include "prc_inc_racial"
#include "sd_lootsystem"
void Embiggen(object oNPC, float fIncrease);
@@ -52,6 +53,44 @@ void Embiggen(object oNPC, float fIncrease)
SetObjectVisualTransform(OBJECT_SELF, OBJECT_VISUAL_TRANSFORM_SCALE, fIncrease);
}
void EvolvedUndeadCheck(object oUndead)
{
// Check if the creature is undead and intelligent
if (MyPRCGetRacialType(oUndead) != RACIAL_TYPE_UNDEAD || !GetAbilityModifier(ABILITY_INTELLIGENCE, oUndead) > -1)
{
return; // Exit if not an intelligent undead
}
// Get the undead's area and its age
object oArea = GetArea(oUndead);
int iUndeadAge = GetAge(oUndead);
// Base evolution chance: 1% for every 100 years
int iBaseChance = iUndeadAge / 100;
// Add chance modifiers: ancient energy and previous evolutions
int iAncientBoost = GetLocalInt(oArea, "EVO_UNDEAD_BOOST"); // Area-specific boost
int iEvolutionCount = GetLocalInt(oUndead, "UNDEAD_EVOLUTION"); // Previous evolutions
int iChance = iBaseChance + iAncientBoost + iEvolutionCount;
// Roll the dice (1-100)
int iRoll = Random(100) + 1;
// Debug message to monitor rolls and chances
if(DEBUG)
{
DoDebug("Evolution Check: Roll = " + IntToString(iRoll) + ", Chance = " + IntToString(iChance));
}
// Check if the undead evolves
if (iRoll <= iChance)
{
// Apply evolution template
ExecuteScript("make_evolved", oUndead); // Apply template script
}
}
void main()
{
@@ -66,6 +105,8 @@ void main()
//:: Declare major variables
object oNPC;
int iRace = MyPRCGetRacialType(OBJECT_SELF);
string sTag;
string sResRef = GetResRef(OBJECT_SELF);
@@ -577,9 +618,22 @@ void main()
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, OBJECT_SELF);
}
//:: Setup Evolved Undead
if(iRace == RACIAL_TYPE_UNDEAD)
{
SetAge(OBJECT_SELF, d20(6));
EvolvedUndeadCheck(OBJECT_SELF);
}
//:: Set or Randomize name
ms_Nomenclature(OBJECT_SELF);
//:: Set threatlevel name text
SetThreatLevel(OBJECT_SELF);
//:: Execute OnSpawn script.
int nSpider = GetStringLeft(GetTag(OBJECT_SELF), 12) == "MONST_SPIDER" ? TRUE : FALSE;
if(nSpider)