64 lines
2.1 KiB
Plaintext
64 lines
2.1 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: FileName re_spawnerhb
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This script is used in the heartbeat of the
|
|
BESIE MMORPG Spawner tool, part of the BESIE Random
|
|
Encounter package by Ray Miller.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Ray Miller
|
|
//:: Created On: 9-2-02
|
|
//:://////////////////////////////////////////////
|
|
#include "re_rndenc"
|
|
void main()
|
|
{
|
|
///////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////
|
|
//Set this parameter to FALSE if you wish
|
|
//your encounter distances to be constant
|
|
//
|
|
int RandomDistance = TRUE
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
|
|
;
|
|
float fChanceOfEncounter = IntToFloat(GetMaxHitPoints(OBJECT_SELF)) / 100;
|
|
object oEncounterObject = GetArea(OBJECT_SELF);
|
|
string sTemplate = GetTag(OBJECT_SELF);
|
|
int iNumberOfParties;
|
|
int iOrientation = 0;
|
|
int iMinDistance = RandomDistance;
|
|
int iDifficulty = GetFortitudeSavingThrow(OBJECT_SELF);
|
|
int iChanceFromBehind = GetReflexSavingThrow(OBJECT_SELF);
|
|
int iMaxDistance = GetWillSavingThrow(OBJECT_SELF);
|
|
if(!iMaxDistance)
|
|
{
|
|
iMaxDistance = 1;
|
|
}
|
|
if(GetStringLeft(sTemplate, 3) != "re_")
|
|
sTemplate = "random";
|
|
object oObject = GetFirstObjectInArea(oEncounterObject);
|
|
while(GetIsObjectValid(oObject))
|
|
{
|
|
if(GetIsPC(oObject))
|
|
{
|
|
if(GetFactionLeader(oObject) == oObject)
|
|
{
|
|
iNumberOfParties++;
|
|
}
|
|
}
|
|
oObject = GetNextObjectInArea(oEncounterObject);
|
|
}
|
|
fChanceOfEncounter = IntToFloat(iNumberOfParties) * fChanceOfEncounter;
|
|
|
|
if((Random(99) + 1) < iChanceFromBehind)
|
|
{
|
|
iOrientation = 180;
|
|
iMaxDistance = 2;
|
|
}
|
|
RandomEncounter(fChanceOfEncounter, oEncounterObject, sTemplate, 0, 0, iMinDistance, iMaxDistance, iOrientation, 30, 0, iDifficulty);
|
|
CleanHouse();
|
|
}
|