Battledale_PRC8/_module/nss/stonerecallspc.nss
Jaysyn904 4dba880acb Added ACP v4.1
Added ACP v4.1. Full compile.  Updated module name.  Updated release archive.
2024-09-08 18:23:43 -04:00

89 lines
2.3 KiB
Plaintext

/////////////////////////////////////////////////
// Ultimate Teleport Script 2.0
/////////////////////////////////////////////////
// by Genisys (galefer003@hotmail.com)
//
// based on SirLestat's Secret Trapdoorscripts
/////////////////////////////////////////////////
/*
This script is for the recallconv (conversation)
to recall the player and associates only back to
the location where the player used the stone of
recall
*/
/////////////////////////////////////////////////
void main()
{
// uncomment one of the next 3 lines depending where you use the script:
object oPC = GetPCSpeaker(); // for conversations
// object oPC = GetEnteringObject; // for triggers
//object oPC = GetLastUsedBy(); // for items/objects
object oToken = oPC;
string sName = GetName(oToken);
object oArea = GetArea(oPC);
location lSaved = GetLocation(oPC);
location lStored = GetLocalLocation(oToken, "RECALL_LOC");
object oSaved = GetAreaFromLocation(lStored);
object oSavedArea = GetAreaFromLocation(lStored);
object oWay;
int nMulti = GetLocalInt(GetModule(), "multi");
int i;
//First loop through the object in the area's stored location..
for(i=0; i<5;i++)
{
oWay = GetNearestObjectToLocation(OBJECT_TYPE_WAYPOINT, lStored, i);
if(oWay != OBJECT_INVALID && GetTag(oWay)=="no_recall")
{
FloatingTextStringOnCreature("Location Invalid.", oPC);
return;
}
}
//--DEBUGGING-----------------------
if(oSaved==OBJECT_INVALID)
{
FloatingTextStringOnCreature("No Destination Found.", oPC);
return;
}
else
{
//Don't store information if the location is invalid!
if(oArea!=OBJECT_INVALID)
{
DelayCommand(2.4, SetLocalLocation(oToken, "RECALL_LOC", lSaved));
FloatingTextStringOnCreature("Location Saved!", oPC, FALSE);
if(nMulti) //If Multiplayer, Save Their Toon!
{
ExportSingleCharacter(oPC);
}
}
effect eVis = EffectVisualEffect(472);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC, 0.0f);
eVis = EffectDisappear(1);
DelayCommand(1.1, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC, 0.0f));
DelayCommand(2.5, AssignCommand(oPC, ClearAllActions()));
//Allow for the visual effect to finish.
DelayCommand(2.6, AssignCommand(oPC, ActionJumpToLocation(lStored)));
}
}