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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user