Aschbourne_PRC8/_module/nss/vg_perloc_portal.nss

80 lines
3.9 KiB
Plaintext
Raw Permalink Normal View History

2024-06-14 10:48:20 -04:00
// Persistent start location portal . . . make a portal with this script onused in your area containing your start location
void main()
{
// This script pulls data for location and jumps PC to last save point
object oPC = GetLastUsedBy();
if(GetIsPC(oPC)||(GetIsDM(oPC) && !GetIsDMPossessed(oPC))) // Script will fire for PCs and DMs
{
string sPCName = GetName(oPC); // Gets the name of the PC
string CDKey = GetPCPublicCDKey(oPC); // Gets the public CD Key of the player . . . adds to quality of check
string sID = GetStringLeft(sPCName,10); // Indivudual Character Used
string sHID = sID+CDKey; // HCR Style user check
// Read Persistent Location Data
int nPlayerBeenHere = GetCampaignInt("PlayerStartLoc", "StartLocSet_" + sHID, oPC); // The check to see if PC has a saved location
int nAreaX = GetCampaignInt("PlayerStartLoc", "AreaX_" + sHID, oPC);
int nAreaY = GetCampaignInt("PlayerStartLoc", "AreaY_" + sHID, oPC);
int nAreaZ = GetCampaignInt("PlayerStartLoc", "AreaZ_" + sHID, oPC);
string sAreaName = GetCampaignString("PlayerStartLoc", "AreaName_" + sHID, oPC);
string sAreaTag = GetCampaignString("PlayerStartLoc", "AreaTag_"+ sHID, oPC);
// Set up the location from Database info
float y = IntToFloat(nAreaY);
float x = IntToFloat(nAreaX);
float z = IntToFloat(nAreaZ);
vector vTargetLoc = Vector(x, y, z);
location lTargetLoc = Location(GetArea(GetObjectByTag(sAreaTag)), vTargetLoc, 0.0);
if(nPlayerBeenHere == 1) // if the player has a saved location lets run this scripts
{
SendMessageToPC(oPC,"Portaling to your Saved Location in 3 Seconds...");
DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTargetLoc)));
}
else // Run this if there is no saved location . . .
// Create Waypoints in areas that you want certain races to jump to
// using the tags I indicated below.
{
if (GetRacialType(oPC)==RACIAL_TYPE_DWARF)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Dwarf"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_ELF)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Elf"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_GNOME)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Gnome"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HALFELF)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Halfelf"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HALFLING)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Halfling"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HALFORC)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Halforc"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HUMAN)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Human"),FALSE)));
}
}
}
}