99 lines
1.9 KiB
Plaintext
99 lines
1.9 KiB
Plaintext
#include "rd_spawnzones"
|
|
|
|
void SummonGood(object oPC);
|
|
|
|
void main()
|
|
{
|
|
object oPC;
|
|
|
|
oPC = GetEnteringObject();
|
|
|
|
if (GetIsPC(oPC) && GetLocalInt(OBJECT_SELF,"Spawned") == 0)
|
|
{
|
|
SetLocalInt(OBJECT_SELF,"Spawned",1);
|
|
SummonGood(oPC);
|
|
}
|
|
}
|
|
|
|
void SummonGood(object oPC)
|
|
{
|
|
vector vPC;
|
|
vector vNew;
|
|
location lLoc;
|
|
int iRndX;
|
|
int iRndY;
|
|
int iLevel;
|
|
int iRandom;
|
|
string sArea;
|
|
string sRace;
|
|
string sEvilRace;
|
|
|
|
vPC = GetPosition(oPC);
|
|
iRndX = Random(4) + 8;
|
|
iRndY = Random(4) + 8;
|
|
if (Random(2) == 1) iRndX=iRndX * -1;
|
|
if (Random(2) == 1) iRndY=iRndY * -1;
|
|
vNew = vPC + Vector( iRndX/1.0, iRndY/1.0, 0.0 );
|
|
lLoc = Location(GetArea(oPC), vNew, VectorToAngle( -1.0 * vNew ) );
|
|
iLevel = GetLevelByPosition(1,oPC) +
|
|
GetLevelByPosition(2,oPC) +
|
|
GetLevelByPosition(3,oPC);
|
|
sArea = GetZone(oPC);
|
|
|
|
sRace = "human";
|
|
iRandom = Random(3)+1;
|
|
switch (iRandom)
|
|
{
|
|
case 1: sRace == "elf"; break;
|
|
case 2: sRace == "dwarf"; break;
|
|
case 3: sRace == "human"; break;
|
|
}
|
|
|
|
if (iLevel < 5)
|
|
if (Random(3)==0)
|
|
sRace = "halfling";
|
|
|
|
if (iLevel>24)
|
|
if (Random(3)==0)
|
|
sRace = "angelic";
|
|
|
|
if (sArea == "NH1" || sArea == "MP1")
|
|
{
|
|
if (iLevel < 5 && Random(2)==0)
|
|
sRace = "halfling";
|
|
else
|
|
sRace = "human";
|
|
}
|
|
|
|
if (sArea == "SF1" || sArea == "EF1")
|
|
sRace = "elf";
|
|
|
|
if (sArea == "MH1" || sArea == "SP1")
|
|
sRace = "dwarf";
|
|
|
|
GetRaceCreatures(sRace,lLoc,iLevel);
|
|
|
|
iRandom=Random(2)+1;
|
|
|
|
if (iRandom == 1)
|
|
{
|
|
if (Random(2) == 0)
|
|
{
|
|
SummonAnything(oPC,lLoc,iLevel);
|
|
} else {
|
|
sEvilRace = "bandit";
|
|
if (iLevel > 9 && iLevel < 20)
|
|
sEvilRace = "mercenary";
|
|
if (iLevel>19)
|
|
sEvilRace = "shade";
|
|
if (sRace == "elf")
|
|
sEvilRace = "drow";
|
|
if (sRace == "dwarf")
|
|
sEvilRace = "duergar";
|
|
if (sRace == "angelic")
|
|
sEvilRace = "fiend";
|
|
GetRaceCreatures(sEvilRace,lLoc,iLevel);
|
|
}
|
|
}
|
|
}
|