UW2_PRC8/_module/nss/spawnmortanna.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

85 lines
2.3 KiB
Plaintext

//Script Name:
//////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 8/13/08
/////////////////////////////////////////
/*
This script goes in the OnEnter Event
for an Area or a Tracks Trigger.
(Preferrably an Area's OnEnter Event)
(The PC will not notice the NPC's being spawned in)
This script will spawn in an NPC
at the proper way point and destroy it
after an amount of time set by you.
You MUST create the first walk waypoint for the NPC
(put the npc in the module right click on it)
(select create way point, then delete the NPC)
If you wish for the NPC to walk around create more
walk waypoint by moving the NPC and creating more way points
as instructed above.
*/
////////////////////////////////////////
//PROTOTYPE DECLARED
void SpawnNPC(string sTag, string sResref, float fSeconds);
//Main Script
void main()
{
//Define the PC
object oPC = GetEnteringObject();
//Stop here if it's not a PC entering!
if(!GetIsPC(oPC)) {return;}
//Enter the tagname and resref name of the NPC below
//600.0 = How many seconds before the NPC is destroyed
//Default = 10 Minutes (600.0 seconds)
SpawnNPC("mortanna", "mortanna", 600.0);
//If you wish to spawn multiple NPCs simply delete the // before SpawnNPC
//For each additional NPC you wish to spawn in.(follow instructions above)
//SpawnNPC("tagname", "resrefname", 600.0);
//SpawnNPC("tagname", "resrefname", 600.0);
//SpawnNPC("tagname", "resrefname", 600.0);
//SpawnNPC("tagname", "resrefname", 600.0);
//SpawnNPC("tagname", "resrefname", 600.0);
//NOTE: This options is NOT for spawning in multiple NPCs with the same tagname!
//I recommend that you create copies of the NPCs and spawn them in seperately.
//(each copied NPC needs thier own tagname / resref name & walk waypoints!)
//Enter any additional code here if your merging this script..
//Main Script End
}
/////////////////////DO NOT TOUCH ANYTHING BELOW!/////////////////////
//PROTOTYPE DEFINED
void SpawnNPC(string sTag, string sResref, float fSeconds)
{
object oTarget;
object oObject = GetWaypointByTag("WP_"+sTag+"_01");
if (!GetIsObjectValid(GetNearestObjectByTag(sTag, oObject)))
{
CreateObject(OBJECT_TYPE_CREATURE, sResref, GetLocation(oObject));
}
oTarget = GetObjectByTag(sTag);
DelayCommand(fSeconds, DestroyObject(oTarget, 0.0));
//PROTOTYPE END
}