HoS_PRC8/_mod/_module/nss/firemother_cre.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

54 lines
2.0 KiB
Plaintext

// firemother_cre - Fire Mother Combat round end
void main()
{
object oMe=OBJECT_SELF;
object oChild1=GetLocalObject(oMe,"oChild1");
object oChild2=GetLocalObject(oMe,"oChild2");
effect eFX;
int nMaxHP=GetMaxHitPoints(oMe);
int nHP=GetCurrentHitPoints(oMe);
int nDamage=nMaxHP-nHP;
object oEat;
string sRes;
object oEnemy=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oMe,1,CREATURE_TYPE_REPUTATION,REPUTATION_TYPE_ENEMY);
if (nDamage>0)
{ // eat children
oEat=OBJECT_INVALID;
if (oChild1!=OBJECT_INVALID) oEat=oChild1;
else if (oChild2!=OBJECT_INVALID) oEat=oChild2;
if (oEat!=OBJECT_INVALID)
{ // eat them
eFX=EffectBeam(VFX_BEAM_FIRE,oMe,BODY_NODE_HAND,FALSE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eFX,oEat,5.0);
sRes=GetResRef(oEat);
DelayCommand(5.01,DestroyObject(oEat));
nHP=8;
if (sRes=="firespawn") nHP=20;
eFX=EffectHeal(nHP);
DelayCommand(3.02,ApplyEffectToObject(DURATION_TYPE_INSTANT,eFX,oMe,1.0));
} // eat them
} // eat children
else
{ // maybe spawn children
if (oEnemy!=OBJECT_INVALID&&GetDistanceBetween(oMe,oEnemy)<40.0)
{ // safe to spawn
if (oChild1==OBJECT_INVALID||GetIsDead(oChild1))
{ // spawn first child
oChild1=CreateObject(OBJECT_TYPE_CREATURE,"fireseed",GetLocation(oMe));
SetLocalObject(oMe,"oChild1",oChild1);
SetLocalObject(oChild1,"oMother",oMe);
SetLocalInt(oChild1,"nNum",1);
} // spawn first child
else if (oChild2==OBJECT_INVALID||GetIsDead(oChild2))
{ // spawn second child
oChild2=CreateObject(OBJECT_TYPE_CREATURE,"fireseed",GetLocation(oMe));
SetLocalObject(oMe,"oChild2",oChild2);
SetLocalObject(oChild2,"oMother",oMe);
SetLocalInt(oChild2,"nNum",2);
} // spawn second child
} // safe to spawn
} // maybe spawn children
ExecuteScript("nw_c2_default3", OBJECT_SELF);
}