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

51 lines
1.8 KiB
Plaintext

// mel_placement - Check for Mana elemental placement needs and elevation.
void main()
{
int nN=0;
object oMana;
object oElem;
int nR;
string sTag;
location lLoc;
oMana=GetObjectByTag("StrongManaPool",nN);
while(oMana!=OBJECT_INVALID)
{ // traverse strong mana pools
nR=d100();
if (GetStringLength(GetLocalString(GetArea(oMana),"sTeamID"))<3)
{ // okay to create
if (nR<11)
{ // create or upgrade
oElem=GetLocalObject(oMana,"oElemental");
if (oElem!=OBJECT_INVALID)
{ // elemental exists
sTag=GetTag(oElem);
lLoc=GetLocation(oElem);
if (sTag=="MinorManaElemental")
{ // upgrade to mana elemental
DestroyObject(oElem);
oElem=CreateObject(OBJECT_TYPE_CREATURE,"manaelemental",lLoc);
SetLocalObject(oMana,"oElemental",oElem);
SetLocalObject(oElem,"oManaPool",oMana);
} // upgrade to mana elemental
else if (sTag=="ManaElemental")
{ // upgrade to greater mana elemental
DestroyObject(oElem);
oElem=CreateObject(OBJECT_TYPE_CREATURE,"greatermanaeleme",lLoc);
SetLocalObject(oMana,"oElemental",oElem);
SetLocalObject(oElem,"oManaPool",oMana);
} // upgrade to greater mana elemental
} // elemental exists
else
{ // create elemental
oElem=CreateObject(OBJECT_TYPE_CREATURE,"minormanaelement",GetLocation(oMana));
SetLocalObject(oMana,"oElemental",oElem);
SetLocalObject(oElem,"oManaPool",oMana);
} // create elemental
} // create or upgrade
} // okay to create
nN++;
oMana=GetObjectByTag("StrongManaPool",nN);
} // traverse strong mana pools
}