Aschbourne_PRC8/_module/nss/vg_perloc_trig.nss

143 lines
8.2 KiB
Plaintext
Raw Normal View History

2024-06-14 10:48:20 -04:00
// onenter of trigger over the start location
#include "prc_inc_racial"
void main()
{
// This script pulls data for location and jumps PC to last save point
object oPC = GetEnteringObject();
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
{
if (GetCurrentHitPoints(oPC)<=0) // See if the PC has 0 or less HPs . . . added this for HCR death system
{
SendMessageToPC(oPC,"You are still dead...");
}
else // If the PC is above 0 HPs, send them to their last save location
{
SendMessageToPC(oPC,"Portaling to your Saved Location in 3 Seconds...");
DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTargetLoc)));
}
}
else if(GetLevelByClass(CLASS_TYPE_CLERIC,oPC)==0)// Run this if there is no saved location and the PC is not a cleric
// Create Waypoints in areas that you want certain races to jump to. The tag of the waypoint is "RACIAL TYPE"_Start where "RACIAL TYPE" is Human, Elf, etc
// If you prefer to not have Racial starting places and want only a single "Default" start then don't make any waypoint except the
// one with tag "Default_Start"
{
int iRace = MyPRCGetRacialType(oPC);
int iSubrace = GetRacialType(oPC);
if (iRace == RACIAL_TYPE_DWARF)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Dwarf_Start"),FALSE)));
}
if ((iRace == RACIAL_TYPE_ELF) && (iSubrace != RACIAL_TYPE_DROW_MALE) && (iSubrace != RACIAL_TYPE_DROW_FEMALE))
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Elf_Start"),FALSE)));
}
if ((iRace == RACIAL_TYPE_ELF) && (iSubrace == RACIAL_TYPE_DROW_MALE) || (iSubrace == RACIAL_TYPE_DROW_FEMALE))
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Drow_Start"),FALSE)));
}
if (iRace == RACIAL_TYPE_GNOME)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Gnome_Start"),FALSE)));
}
if ((iRace == RACIAL_TYPE_ELF) && (iSubrace != RACIAL_TYPE_HALFDROW))
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Halfelf_Start"),FALSE)));
}
if (iSubrace == RACIAL_TYPE_HALFDROW && GetAlignmentGoodEvil(oPC) != ALIGNMENT_EVIL)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Halfelf_Start"),FALSE)));
}
else if (iSubrace == RACIAL_TYPE_HALFDROW && GetAlignmentGoodEvil(oPC) == ALIGNMENT_EVIL)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Drow_Start"),FALSE)));
}
if (iRace == RACIAL_TYPE_HALFLING)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Halfling_Start"),FALSE)));
}
if (iRace == RACIAL_TYPE_HALFORC)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Halforc_Start"),FALSE)));
}
if (iRace == RACIAL_TYPE_HUMAN)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Human_Start"),FALSE)));
}
else
{
SendMessageToPC(oPC,"Portaling to the default start location in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Default_Start"),FALSE)));
}
}
else if(GetLevelByClass(CLASS_TYPE_CLERIC,oPC)>=1)// Run this if there is no saved location and the PC is a cleric
{
string sDeity = GetDeity(oPC);
object oSpawn=GetObjectByTag("Default_Start"); //set default respawn point
if (sDeity=="Bahamut") { oSpawn=GetObjectByTag("Bahamut_Start"); }
if (sDeity=="Boccob") { oSpawn=GetObjectByTag("Boccob_Start"); }
if (sDeity=="Corellon") { oSpawn=GetObjectByTag("Corellon_Start"); }
if (sDeity=="Ehlonna") { oSpawn=GetObjectByTag("Ehlonna_Start"); }
if (sDeity=="Erythnul") { oSpawn=GetObjectByTag("Erythnul_Start"); }
if (sDeity=="Fharlanghn") { oSpawn=GetObjectByTag("Fharlanghn_Start"); }
if (sDeity=="Garl Glittergold") { oSpawn=GetObjectByTag("Glittergold_Start"); }
if (sDeity=="Grummsh") { oSpawn=GetObjectByTag("Grummsh_Start"); }
if (sDeity=="Heironeous") { oSpawn=GetObjectByTag("Heironeous_Start"); }
if (sDeity=="Hextor") { oSpawn=GetObjectByTag("Hextor_Start"); }
if (sDeity=="Kord") { oSpawn=GetObjectByTag("Kord_Start"); }
if (sDeity=="Lloth") { oSpawn=GetObjectByTag("Lloth_Start"); }
if (sDeity=="Moradin") { oSpawn=GetObjectByTag("Moradin_Start"); }
if (sDeity=="Nerull") { oSpawn=GetObjectByTag("Nerull_Start"); }
if (sDeity=="Obad-Hai") { oSpawn=GetObjectByTag("ObadHai_Start"); }
if (sDeity=="Olidammara") { oSpawn=GetObjectByTag("Olidammara_Start"); }
if (sDeity=="Pelor") { oSpawn=GetObjectByTag("Pelor_Start"); }
if (sDeity=="St. Cuthbert") { oSpawn=GetObjectByTag("Cuthbert_Start"); }
if (sDeity=="Tiamat") { oSpawn=GetObjectByTag("Tiamat_Start"); }
if (sDeity=="Vecna") { oSpawn=GetObjectByTag("Vecna_Start"); }
if (sDeity=="Wee Jas") { oSpawn=GetObjectByTag("WeeJas_Start"); }
if (sDeity=="Yondalla") { oSpawn=GetObjectByTag("Yondalla_Start"); }
AssignCommand(oPC, DelayCommand(1.0, JumpToObject(oSpawn)));
}
}
}