I would like to know are you guys concerned about encounters or NPC's.
I was wondering myself if I had gone thru the trouble of spawning all my NPC for no good reason because I see other downloadable mods that do not spawn their NPC.
Here is the NPC spawn script I copied from some where .// An area's OnEnter script.
// Area OnEnter script.
//::////////////////////////////////////////////////////////////////
#include "_quest_npc_inc"
void main()
{ if( !GetIsPC( GetEnteringObject())) return;
DelayCommand(1.0,SpawnQuestNPCsIntoArea( OBJECT_SELF));
ExecuteScript("_cleanupenter",OBJECT_SELF);
ExecuteScript("map",OBJECT_SELF);
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------
This one is called in the onenter script above.
_cleanupenter
// An area's OnEnter script.
//
// Partner script for the area cleaning script (OnExit).
void main()
{
// Only fire for PCs.
if ( !GetIsPC(GetEnteringObject()) )
return;
// Cancel any scheduled cleanup.
SetLocalInt(OBJECT_SELF, "AREA_CLEANUP_CONTROL",
GetLocalInt(OBJECT_SELF, "AREA_CLEANUP_CONTROL") + 1);
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------
// An area's OnExit script.
//
// Clears all spawns and resets encounters if no living PC is in the area in the
// next 30 seconds.
// Requires a partner OnEnter event to detect PCs entering the area in the
// 30-second timeframe.
// Returns a living PC in oArea, if any.
// Returns OBJECT_INVALID otherwise.
object GetLivingPCInArea(object oArea);
// Handles the actual cleanup of oArea.
void CleanupArea(object oArea, int nControl);
void main()
{
object oArea = OBJECT_SELF;
// Only fire for PCs (for efficiency).
if ( !GetIsPC(GetExitingObject()) )
return;
// Check for a lack of living PCs in the area.
if ( GetLivingPCInArea(oArea) == OBJECT_INVALID )
// Schedule a cleanup.
DelayCommand(30.0, CleanupArea(oArea, GetLocalInt(oArea, "AREA_CLEANUP_CONTROL")));
}
// -----------------------------------------------------------------------------
// Handles the actual cleanup of oArea.
void CleanupArea(object oArea, int nControl)
{
if ( nControl != GetLocalInt(oArea, "AREA_CLEANUP_CONTROL") )
// Someone entered the area. Abort.
return;
// Double-check that there are no living PCs in the area.
// (Should not be necessary, but just in case...)
if ( GetLivingPCInArea(oArea) == OBJECT_INVALID )
{
// Loop through objects in the area.
object oObject = GetFirstObjectInArea(oArea);
while ( oObject != OBJECT_INVALID )
{
switch ( GetObjectType(oObject) )
{
case OBJECT_TYPE_CREATURE:
// Eliminate spawns.
DestroyObject(oObject);
break;
case OBJECT_TYPE_ENCOUNTER:
// Reset encounters.
DelayCommand(0.1, SetEncounterActive(TRUE, oObject));
break;
case OBJECT_TYPE_ITEM:
DestroyObject(oObject);
break;
}
// Update the loop.
oObject = GetNextObjectInArea(oArea);
}
}
// Cancel any remaining scheduled cleanups.
SetLocalInt(OBJECT_SELF, "AREA_CLEANUP_CONTROL", nControl + 1);
}
// Returns a living PC in oArea, if any.
// Returns OBJECT_INVALID otherwise.
object GetLivingPCInArea(object oArea)
{
return GetNearestCreatureToLocation(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC,
Location(oArea, Vector(), 0.0), 1,
CREATURE_TYPE_IS_ALIVE, TRUE);
}
------------------------------------------------------------------------------------------------------------------------------------------------------------
// Quest NPC Spawning System Library
//:://////////////////////////////////////////////////////////
// _quest_npc_inc
//:://////////////////////////////////////////////////////////
struct NPCinfo
{ string resref;
string waypoint;
};
struct NPCinfo GetQuestNPCInfo( string sNPCTag)
{ struct NPCinfo stQuestNPC;
stQuestNPC.resref = "";
stQuestNPC.waypoint = "";
if( sNPCTag == "") return stQuestNPC;
// Fill in this part for all quest NPCs in your module.
if( sNPCTag == "bing")
{ stQuestNPC.resref = "bing";
stQuestNPC.waypoint = "POST_bing";
}
else if( sNPCTag == "ancientlibrarian")
{ stQuestNPC.resref = "ancientlibrarian";
stQuestNPC.waypoint = "WP_ancientlibrarian_01";
}
else if( sNPCTag == "bingsdog")
{ stQuestNPC.resref = "bingsdog";
stQuestNPC.waypoint = "POST_bingsdog";
}
else if( sNPCTag == "towncrier")
{ stQuestNPC.resref = "towncrier";
stQuestNPC.waypoint = "WP_towncrier_01";
}
else if( sNPCTag == "BBS_SCRIBE")
{ stQuestNPC.resref = "bbs_scribe_bp";
stQuestNPC.waypoint = "WP_BBS_SCRIBE_01";
}
else if( sNPCTag == "crystalport003")
{ stQuestNPC.resref = "crystalport003";
stQuestNPC.waypoint = "crystalport003";
}
else if( sNPCTag == "winterkeepgua002")
{ stQuestNPC.resref = "winterkeepgua002";
stQuestNPC.waypoint = "winterkeepgua002";
}
else if( sNPCTag == "winter001")
{ stQuestNPC.resref = "winter001";
stQuestNPC.waypoint = "winter001";
}
else if( sNPCTag == "doorguard")
{ stQuestNPC.resref = "doorguard";
stQuestNPC.waypoint = "doorguard";
}
else if( sNPCTag == "CUSTOMER")
{ stQuestNPC.resref = "humsailor001";
stQuestNPC.waypoint = "WP_02";
}
else if( sNPCTag == "piratewomen")
{ stQuestNPC.resref = "piratewomen";
stQuestNPC.waypoint = "WP_01";
}
else if( sNPCTag == "guard003")
{ stQuestNPC.resref = "guard003";
stQuestNPC.waypoint = "WP_03";
}
else if( sNPCTag == "guard004")
{ stQuestNPC.resref = "guard004";
stQuestNPC.waypoint = "WP_04";
}
else if( sNPCTag == "Drunk")
{ stQuestNPC.resref = "drunk";
stQuestNPC.waypoint = "Drunk_Post";
}
else if( sNPCTag == "marina")
{ stQuestNPC.resref = "marina";
stQuestNPC.waypoint = "WP_05";
}
else if( sNPCTag == "LANCE")
{ stQuestNPC.resref = "lance";
stQuestNPC.waypoint = "WP_06";
}
else if( sNPCTag == "COOK")
{ stQuestNPC.resref = "vastin";
stQuestNPC.waypoint = "WP_COOK_01";
}
else if( sNPCTag == "BARMAID_STATE")
{ stQuestNPC.resref = "kacy";
stQuestNPC.waypoint = "WP_BAR";
}
else if( sNPCTag == "BARTEND")
{ stQuestNPC.resref = "kati";
stQuestNPC.waypoint = "WP_BARTEND_01";
}
else if( sNPCTag == "don")
{ stQuestNPC.resref = "don";
stQuestNPC.waypoint = "WP_don_01";
}
else if( sNPCTag == "DOCKMASTER")
{ stQuestNPC.resref = "dockmaster";
stQuestNPC.waypoint = "POST_DOCKMASTER";
}
else if( sNPCTag == "Mayor")
{ stQuestNPC.resref = "mayor";
stQuestNPC.waypoint = "WP_Mayor_01";
}
else if( sNPCTag == "claire")
{ stQuestNPC.resref = "claire";
stQuestNPC.waypoint = "WP_claire_01";
}
else if( sNPCTag == "Sasha")
{ stQuestNPC.resref = "sasha";
stQuestNPC.waypoint = "POST_Sasha";
}
else if( sNPCTag == "Guard")
{ stQuestNPC.resref = "guard005";
stQuestNPC.waypoint = "WP_Guard_01";
}
else if( sNPCTag == "Norio")
{ stQuestNPC.resref = "norio";
stQuestNPC.waypoint = "WP_Norio_01";
}
else if( sNPCTag == "TheNamer")
{ stQuestNPC.resref = "thenamer";
stQuestNPC.waypoint = "WP_TheNamer_01";
}
else if( sNPCTag == "leena")
{ stQuestNPC.resref = "leena";
stQuestNPC.waypoint = "POST_leena";
}
else if( sNPCTag == "omegasmith02")
{ stQuestNPC.resref = "omegasmith02";
stQuestNPC.waypoint = "WP_omegasmith02_01";
}
else if( sNPCTag == "Holly")
{ stQuestNPC.resref = "holly";
stQuestNPC.waypoint = "POST_Holly";
}
else if( sNPCTag == "TailoringModel")
{ stQuestNPC.resref = "tailoringmodel01";
stQuestNPC.waypoint = "WP007";
}
else if( sNPCTag == "TailoringModel2")
{ stQuestNPC.resref = "tailoringmode001";
stQuestNPC.waypoint = "WP009";
}
else if( sNPCTag == "TailoringModel3")
{ stQuestNPC.resref = "tailoringmode003";
stQuestNPC.waypoint = "WP0010";
}
else if( sNPCTag == "TailoringModel4")
{ stQuestNPC.resref = "tailoringmode004";
stQuestNPC.waypoint = "WP0011";
}
else if( sNPCTag == "Kate")
{ stQuestNPC.resref = "kate";
stQuestNPC.waypoint = "WP_Kate_01";
}
else if( sNPCTag == "omegasmith01")
{ stQuestNPC.resref = "omegasmith01";
stQuestNPC.waypoint = "WP_omegasmith01_01";
}
else if( sNPCTag == "omegasmith5")
{ stQuestNPC.resref = "omegasmith5";
stQuestNPC.waypoint = "WP_omegasmith5_01";
}
else if( sNPCTag == "omegasmith4")
{ stQuestNPC.resref = "ilridentifier";
stQuestNPC.waypoint = "WP_omegasmith4_01";
}
else if( sNPCTag == "omegasmith03")
{ stQuestNPC.resref = "omegasmith03";
stQuestNPC.waypoint = "WP_omegasmith03_01";
}
else if( sNPCTag == "Guard4")
{ stQuestNPC.resref = "guard4";
stQuestNPC.waypoint = "POST_Guard4";
}
else if( sNPCTag == "Guard3")
{ stQuestNPC.resref = "guard3";
stQuestNPC.waypoint = "POST_Guard3";
}
else if( sNPCTag == "sb")
{ stQuestNPC.resref = "sb";
stQuestNPC.waypoint = "WP_sb_01";
}
else if( sNPCTag == "Guard10")
{ stQuestNPC.resref = "guard10";
stQuestNPC.waypoint = "POST_Guard10";
}
else if( sNPCTag == "Guard2")
{ stQuestNPC.resref = "guard2";
stQuestNPC.waypoint = "POST_Guard2";
}
else if( sNPCTag == "manus")
{ stQuestNPC.resref = "manus";
stQuestNPC.waypoint = "WP_manus_01";
}
else if( sNPCTag == "frostkeepgateguard1")
{ stQuestNPC.resref = "frostkeepgate1";
stQuestNPC.waypoint = "WP_frostkeepgateguard1_01";
}
else if( sNPCTag == "frostkeepgateguard2")
{ stQuestNPC.resref = "frostkeepgate2";
stQuestNPC.waypoint = "WP_frostkeepgateguard2_01";
}
else if( sNPCTag == "CaptainSamantha")
{ stQuestNPC.resref = "captainsamantha";
stQuestNPC.waypoint = "POST_CaptainSamantha";
}
else if( sNPCTag == "tikis")
{ stQuestNPC.resref = "tikis";
stQuestNPC.waypoint = "WP_tikis_01";
}
else if( sNPCTag == "Halaster")
{ stQuestNPC.resref = "halaster001";
stQuestNPC.waypoint = "WP_Halaster_01";
}
else if( sNPCTag == "Rolo")
{ stQuestNPC.resref = "rolo";
stQuestNPC.waypoint = "WP_Rolo_01";
}
else if( sNPCTag == "Lucky")
{ stQuestNPC.resref = "captainsamant005";
stQuestNPC.waypoint = "WP_Lucky_01";
}
else if( sNPCTag == "links")
{ stQuestNPC.resref = "links";
stQuestNPC.waypoint = "WP_links_01";
}
else if( sNPCTag == "guss")
{ stQuestNPC.resref = "guss";
stQuestNPC.waypoint = "WP_guss_01";
}
else if( sNPCTag == "NW_BARTENDER")
{ stQuestNPC.resref = "bartender001";
stQuestNPC.waypoint = "WP_NW_BARTENDER_01";
}
else if( sNPCTag == "helga")
{ stQuestNPC.resref = "helga";
stQuestNPC.waypoint = "helga";
}
else if( sNPCTag == "elring")
{ stQuestNPC.resref = "elring";
stQuestNPC.waypoint = "elring";
}
else if( sNPCTag == "Guard11")
{ stQuestNPC.resref = "guard001";
stQuestNPC.waypoint = "WP_Guard11_01";
}
else if( sNPCTag == "OutPostGuard")
{ stQuestNPC.resref = "outpostguard";
stQuestNPC.waypoint = "WP_OutPostGuard_01";
}
else if( sNPCTag == "General")
{ stQuestNPC.resref = "general002";
stQuestNPC.waypoint = "WP_General_01";
}
else if( sNPCTag == "Legan")
{ stQuestNPC.resref = "general";
stQuestNPC.waypoint = "WP_Legan_01";
}
else if( sNPCTag == "fing")
{ stQuestNPC.resref = "feng";
stQuestNPC.waypoint = "WP_fing_01";
}
else if( sNPCTag == "Oberon")
{ stQuestNPC.resref = "oberon";
stQuestNPC.waypoint = "WP_Oberon_01";
}
else if( sNPCTag == "Lolir")
{ stQuestNPC.resref = "lolir";
stQuestNPC.waypoint = "WP_Lolir_01";
}
else if( sNPCTag == "CaptainoftheGuard")
{ stQuestNPC.resref = "captainoftheguar";
stQuestNPC.waypoint = "WP_CaptainoftheGuard_01";
}
else if( sNPCTag == "Moigan")
{ stQuestNPC.resref = "moigan";
stQuestNPC.waypoint = "WP_Moigan_01";
}
else if( sNPCTag == "KingVidor")
{ stQuestNPC.resref = "kingvidor001";
stQuestNPC.waypoint = "WP_KingVidor_01";
}
else if( sNPCTag == "Father_Richo")
{ stQuestNPC.resref = "father001";
stQuestNPC.waypoint = "WP_Father_Richo_01";
}
else if( sNPCTag == "duefight002")
{ stQuestNPC.resref = "duefight002";
stQuestNPC.waypoint = "WP_duefight002_01";
}
else if( sNPCTag == "Morris")
{ stQuestNPC.resref = "morris001";
stQuestNPC.waypoint = "WP_Morris_01";
}
else if( sNPCTag == "MrsBingle")
{ stQuestNPC.resref = "dona001";
stQuestNPC.waypoint = "WP_MrsBingle_01";
}
else if( sNPCTag == "Toman")
{ stQuestNPC.resref = "toman001";
stQuestNPC.waypoint = "WP_Toman_01";
}
else if( sNPCTag == "Lagnar")
{ stQuestNPC.resref = "lagnar001";
stQuestNPC.waypoint = "WP_Lagnar_01";
}
else if( sNPCTag == "captcliff")
{ stQuestNPC.resref = "captcliff";
stQuestNPC.waypoint = "WP_captcliff_01";
}
else if( sNPCTag == "captcliff2")
{ stQuestNPC.resref = "captcliff2";
stQuestNPC.waypoint = "WP_captcliff2_01";
}
else if( sNPCTag == "InnKeeper")
{ stQuestNPC.resref = "innkeeper";
stQuestNPC.waypoint = "WP_InnKeeper_01";
}
else if( sNPCTag == "CaptainKorin")
{ stQuestNPC.resref = "captainkorin";
stQuestNPC.waypoint = "WP_CaptainKorin_01";
}
else if( sNPCTag == "CaptainKorin2")
{ stQuestNPC.resref = "captainkorin001";
stQuestNPC.waypoint = "WP_CaptainKorin2_01";
}
else if( sNPCTag == "Potion_11")
{ stQuestNPC.resref = "gypmale001";
stQuestNPC.waypoint = "WP_NW_GYPMALE_01";
}
else if( sNPCTag == "Vens")
{ stQuestNPC.resref = "vens";
stQuestNPC.waypoint = "WP_Vens_01";
}
else if( sNPCTag == "servant")
{ stQuestNPC.resref = "guard006";
stQuestNPC.waypoint = "WP_servant_01";
}
else if( sNPCTag == "notes_postman")
{ stQuestNPC.resref = "notes_postman001";
stQuestNPC.waypoint = "WP_notes_postman_01";
}
else if( sNPCTag == "NW_IMP")
{ stQuestNPC.resref = "imp003";
stQuestNPC.waypoint = "WP_NW_IMP_01";
}
else if( sNPCTag == "Gormak")
{ stQuestNPC.resref = "bandit007";
stQuestNPC.waypoint = "WP_Gormak_01";
}
else if( sNPCTag == "Merise")
{ stQuestNPC.resref = "merise";
stQuestNPC.waypoint = "WP_Merise_01";
}
else if( sNPCTag == "JailPermanentResident")
{ stQuestNPC.resref = "convict001";
stQuestNPC.waypoint = "WP_JailPermanentResident_01";
}
else if( sNPCTag == "BrinToris")
{ stQuestNPC.resref = "brintoris";
stQuestNPC.waypoint = "WP_BrinToris_01";
}
// ... etc for all quest NPCs
return stQuestNPC;
}
void AddQuestNPCToArea( object oArea, string sNPCTag)
{ if( !GetIsObjectValid( oArea) || (GetArea( oArea) != oArea) || (sNPCTag == "")) return;
int iNPCNum = GetLocalInt( oArea, "QuestNPCCount") +1;
SetLocalInt( oArea, "QuestNPCCount", iNPCNum);
SetLocalString( oArea, "QuestNPC_" +IntToString( iNPCNum), sNPCTag);
}
void InitializeQuestNPCsInArea( object oArea)
{ if( !GetIsObjectValid( oArea) || (GetArea( oArea) != oArea) || (GetLocalInt( oArea, "QuestNPCCount") > 0)) return;
DeleteLocalInt( oArea, "QuestNPCCount");
string sAreaTag = GetTag( oArea);
// Fill in this part according to your module's layout.
if( sAreaTag == "bingspawn")
{ AddQuestNPCToArea( oArea, "bing");
}
else if( sAreaTag == "ancientlibrary")
{ AddQuestNPCToArea( oArea, "ancientlibrarian");
}
else if( sAreaTag == "winterkeep")
{ AddQuestNPCToArea( oArea, "BBS_SCRIBE");
AddQuestNPCToArea( oArea, "towncrier");
AddQuestNPCToArea( oArea, "bingsdog");
AddQuestNPCToArea( oArea, "crystalport003");
AddQuestNPCToArea( oArea, "winterkeepgua002");
AddQuestNPCToArea( oArea, "winter001");
AddQuestNPCToArea( oArea, "doorguard");
}
else if( sAreaTag == "ElfsongTavern")
{ AddQuestNPCToArea( oArea, "CUSTOMER");
AddQuestNPCToArea( oArea, "piratewomen");
AddQuestNPCToArea( oArea, "guard003");
AddQuestNPCToArea( oArea, "guard004");
AddQuestNPCToArea( oArea, "Drunk");
AddQuestNPCToArea( oArea, "marina");
AddQuestNPCToArea( oArea, "LANCE");
AddQuestNPCToArea( oArea, "COOK");
AddQuestNPCToArea( oArea, "BARMAID_STATE");
AddQuestNPCToArea( oArea, "BARTEND");
}
else if( sAreaTag == "RusIsleHavenSmithy")
{ AddQuestNPCToArea( oArea, "duefight002");
AddQuestNPCToArea( oArea, "duefight002");
}
else if( sAreaTag == "winterkeepdocks")
{ AddQuestNPCToArea( oArea, "don");
AddQuestNPCToArea( oArea, "DOCKMASTER");
}
else if( sAreaTag == "TagnarsForge")
{ AddQuestNPCToArea( oArea, "manus");
AddQuestNPCToArea( oArea, "manus");
}
else if( sAreaTag == "jail2")
{ AddQuestNPCToArea( oArea, "Mayor");
}
else if( sAreaTag == "clairesbooks")
{ AddQuestNPCToArea( oArea, "claire");
}
else if( sAreaTag == "SashasScrollShop")
{ AddQuestNPCToArea( oArea, "Sasha");
}
else if( sAreaTag == "jail")
{ AddQuestNPCToArea( oArea, "Guard");
AddQuestNPCToArea( oArea, "JailPermanentResident");
}
else if( sAreaTag == "NoriosBrews")
{ AddQuestNPCToArea( oArea, "Norio");
}
else if( sAreaTag == "customarmorshop")
{ AddQuestNPCToArea( oArea, "TheNamer");
}
else if( sAreaTag == "Temple")
{ AddQuestNPCToArea( oArea, "leena");
}
else if( sAreaTag == "KusilsForge")
{ AddQuestNPCToArea( oArea, "omegasmith02");
}
else if( sAreaTag == "HorseFarmHouseBoutique")
{ AddQuestNPCToArea( oArea, "Holly");
AddQuestNPCToArea( oArea, "TailoringModel");
AddQuestNPCToArea( oArea, "TailoringModel2");
AddQuestNPCToArea( oArea, "TailoringModel3");
AddQuestNPCToArea( oArea, "TailoringModel4");
}
else if( sAreaTag == "_module")
{ AddQuestNPCToArea( oArea, "Kate");
}
else if( sAreaTag == "DM_Forge")
{ AddQuestNPCToArea( oArea, "omegasmith01");
AddQuestNPCToArea( oArea, "omegasmith5");
AddQuestNPCToArea( oArea, "omegasmith4");
}
else if( sAreaTag == "ODCforgebarracks")
{ AddQuestNPCToArea( oArea, "omegasmith03");
}
else if( sAreaTag == "FrostKeep")
{ AddQuestNPCToArea( oArea, "Guard4");
AddQuestNPCToArea( oArea, "Guard3");
AddQuestNPCToArea( oArea, "sb");
AddQuestNPCToArea( oArea, "Guard10");
AddQuestNPCToArea( oArea, "Guard2");
AddQuestNPCToArea( oArea, "frostkeepgateguard1");
AddQuestNPCToArea( oArea, "frostkeepgateguard2");
AddQuestNPCToArea( oArea, "CaptainSamantha");
AddQuestNPCToArea( oArea, "CaptainKorin");
}
else if( sAreaTag == "TikisTailor")
{ AddQuestNPCToArea( oArea, "tikis");
}
else if( sAreaTag == "OldHalsHut")
{ AddQuestNPCToArea( oArea, "Halaster");
}
else if( sAreaTag == "OldBlackStoneInn")
{ AddQuestNPCToArea( oArea, "Rolo");
}
else if( sAreaTag == "PawnShop")
{ AddQuestNPCToArea( oArea, "Lucky");
}
else if( sAreaTag == "LinksTrinkets")
{ AddQuestNPCToArea( oArea, "links");
}
else if( sAreaTag == "temple")
{ AddQuestNPCToArea( oArea, "guss");
}
else if( sAreaTag == "drunkenbarbarian")
{ AddQuestNPCToArea( oArea, "NW_BARTENDER");
AddQuestNPCToArea( oArea, "helga");
AddQuestNPCToArea( oArea, "elring");
}
else if( sAreaTag == "FrostKeepOutPost")
{ AddQuestNPCToArea( oArea, "Guard11");
AddQuestNPCToArea( oArea, "OutPostGuard");
AddQuestNPCToArea( oArea, "General");
}
else if( sAreaTag == "OutPostStorage")
{ AddQuestNPCToArea( oArea, "Legan");
}
else if( sAreaTag == "chateau")
{ AddQuestNPCToArea( oArea, "fing");
}
else if( sAreaTag == "WolfShire")
{ AddQuestNPCToArea( oArea, "Oberon");
}
else if( sAreaTag == "WinterAlePub")
{ AddQuestNPCToArea( oArea, "Lolir");
}
else if( sAreaTag == "winterkeepbarracks")
{ AddQuestNPCToArea( oArea, "CaptainoftheGuard");
}
else if( sAreaTag == "OutPostBarracks")
{ AddQuestNPCToArea( oArea, "Moigan");
}
else if( sAreaTag == "RusIslandHavenKeep")
{ AddQuestNPCToArea( oArea, "CaptainoftheGuard");
}
else if( sAreaTag == "RusIslandTemple")
{ AddQuestNPCToArea( oArea, "Father_Richo");
}
else if( sAreaTag == "RusIsleInn1stFloor")
{ AddQuestNPCToArea( oArea, "Morris");
AddQuestNPCToArea( oArea, "MrsBingle");
}
else if( sAreaTag == "RusIsleBuildingInteriors")
{ AddQuestNPCToArea( oArea, "Toma");
}
else if( sAreaTag == "RusIsleHavenSmithy")
{ AddQuestNPCToArea( oArea, "Lagnar");
}
else if( sAreaTag == "WatersEdge")
{ AddQuestNPCToArea( oArea, "captcliff");
}
else if( sAreaTag == "RusIslePirateHaven")
{ AddQuestNPCToArea( oArea, "captcliff2");
}
else if( sAreaTag == "Caravan")
{ AddQuestNPCToArea( oArea, "InnKeeper");
}
else if( sAreaTag == "cityofmadness")
{ AddQuestNPCToArea( oArea, "CaptainKorin2");
}
else if( sAreaTag == "hunterslodge")
{ AddQuestNPCToArea( oArea, "Potion_11");
}
else if( sAreaTag == "RusIsleGeneralStore")
{ AddQuestNPCToArea( oArea, "Vens");
}
else if( sAreaTag == "los")
{ AddQuestNPCToArea( oArea, "servant");
}
else if( sAreaTag == "postoffice")
{ AddQuestNPCToArea( oArea, "notes_postman");
}
else if( sAreaTag == "thegrandhall")
{ AddQuestNPCToArea( oArea, "NW_IMP");
}
else if( sAreaTag == "frostmug")
{ AddQuestNPCToArea( oArea, "Gormak");
AddQuestNPCToArea( oArea, "Merise");
}
else if( sAreaTag == "WinterKeepBank")
{ AddQuestNPCToArea( oArea, "BrinToris");
}
// ... etc for all areas containing quest NPCs
}
int GetIsNPCInArea( string sNPCTag, object oArea)
{ if( (sNPCTag == "") || !GetIsObjectValid( oArea) || (GetArea( oArea) != oArea)) return FALSE;
object oFirst = GetFirstObjectInArea( oArea);
if( (GetObjectType( oFirst) == OBJECT_TYPE_CREATURE) && (GetTag( oFirst) == sNPCTag)) return TRUE;
int iNth = 1;
object oNPC = GetNearestObjectByTag( sNPCTag, oFirst);
while( GetIsObjectValid( oNPC))
{ if( GetObjectType( oNPC) == OBJECT_TYPE_CREATURE) return TRUE;
oNPC = GetNearestObjectByTag( sNPCTag, oFirst, ++iNth);
}
return FALSE;
}
object GetWaypointInArea( string sWaypointTag, object oArea)
{ if( (sWaypointTag == "") || !GetIsObjectValid( oArea) || (GetArea( oArea) != oArea)) return OBJECT_INVALID;
object oFirst = GetFirstObjectInArea( oArea);
if( GetTag( oFirst) == sWaypointTag) return oFirst;
return GetNearestObjectByTag( sWaypointTag, oFirst);
}
void SpawnQuestNPCsIntoArea( object oArea)
{ if( !GetIsObjectValid( oArea) || (GetArea( oArea) != oArea)) return;
InitializeQuestNPCsInArea( oArea);
int iNPC = GetLocalInt( oArea, "QuestNPCCount") +1;
while( --iNPC > 0)
{ string sNPCTag = GetLocalString( oArea, "QuestNPC_" +IntToString( iNPC));
if( (sNPCTag != "") && !GetIsNPCInArea( sNPCTag, oArea))
{ struct NPCinfo stQuestNPC = GetQuestNPCInfo( sNPCTag);
if( (stQuestNPC.resref != "") && (stQuestNPC.waypoint != ""))
{ object oWaypoint = GetWaypointInArea( stQuestNPC.waypoint, oArea);
if( GetIsObjectValid( oWaypoint)) CreateObject( OBJECT_TYPE_CREATURE, stQuestNPC.resref, GetLocation( oWaypoint), FALSE, sNPCTag);
}
}
}
}
Modifié par Knight_Shield, 22 février 2012 - 09:47 .