Files
Anphillia_PRC8/_module/nss/eye_altarelem.nss
Jaysyn904 28cdb617b3 Initial commit
Adding all of the current content for Anphillia Unlimited.
2024-01-04 07:49:38 -05:00

142 lines
6.3 KiB
Plaintext

///////
// This is the script for the altars of elements
//
// There are 4 states for each elemental test
// 1: elemental killed
// 2: elemental stone taken
// 3: finished test successfully (left area through portal)
// 4: trying to do the test
void DoAltar(object oStore, object oPlayer, object oExit, string sTrial, string sMonsterTag, string sEntranceWP, string sElementalSpawn, string sTrialMsg, int iDoOnce, effect eTeleport)
{
// Variable Declarations
effect eMind = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD);
string sEtherG = "etherealgfriend";
object sWPNW = GetObjectByTag("TrialEthFriNW");
object sWPSE = GetObjectByTag("TrialEthFriNW");
// REMOVE //
//SendMessageToPC(oPlayer, "Debug: Start of Script " + sTrialMsg);
// REMOVE //
if (iDoOnce == 1 && // do-Once
GetLocalInt(oStore, sTrial) == 3) // Quest finished
{
SendMessageToPC(oPlayer, "Someone already did the " + sTrialMsg);
}
if (GetLocalInt(oStore, sTrial) == 1 || // in progress, elem killed or stone taken
GetLocalInt(oStore, sTrial) == 2 ||
GetLocalInt(oStore, sTrial) == 4)
{
SendMessageToPC(oPlayer, "Someone is already doing the " + sTrialMsg);
}
else if (GetLocalInt(oStore, sTrial) == 0) // quest not started yet
{
// REMOVE //
//SendMessageToPC(oPlayer, "Debug: You are the first to start " + sTrialMsg);
// REMOVE //
SetLocalInt(oStore, sTrial, 4); // mark quest as started
SetLocalString(oPlayer, "Trial", sTrial); // store the trial on the player
SetLocalObject(oPlayer, "Exit", oExit); // store the entrance point of the player
if (GetNearestObjectByTag(sEtherG, sWPNW) != OBJECT_INVALID) // if the friendly ether is still here
{ // destroy both of them
ApplyEffectToObject(DURATION_TYPE_INSTANT, eMind, GetNearestObjectByTag((sEtherG), sWPNW));
DestroyObject(GetNearestObjectByTag(sEtherG, sWPNW));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eMind, GetNearestObjectByTag((sEtherG), sWPSE));
DestroyObject(GetNearestObjectByTag(sEtherG, sWPSE));
}
// Before Jumping the player, do some effects
DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport, oPlayer));
DelayCommand(1.8, AssignCommand(oPlayer, ClearAllActions()));
DelayCommand(2.0, AssignCommand(oPlayer, ActionJumpToObject(GetObjectByTag(sEntranceWP)))); // jump player to trial
// Shout that player does the trial
AssignCommand(GetObjectByTag("EtherealShouter"), ActionSpeakString(GetName(oPlayer) + " does the trial of " + sTrial, TALKVOLUME_SHOUT));
}
else if (GetLocalInt(oStore, sTrial) == 3 && // quest finished once
iDoOnce == 0) // but allowed to be done again
{
// REMOVE //
//SendMessageToPC(oPlayer, "Debug: Quest was finished once, now you do " + sTrialMsg);
// REMOVE //
CreateObject(OBJECT_TYPE_CREATURE, sMonsterTag, GetLocation(GetObjectByTag(sElementalSpawn))); // create the trial elemental
SetLocalInt(oStore, sTrial, 4); // mark trial as started
SetLocalString(oPlayer, "Trial", sTrial); // store trial on the player
SetLocalObject(oPlayer, "Exit", oExit); // store the entrance point of the player
if (GetObjectByTag(sEtherG) != OBJECT_INVALID) // if the friendly ethers are still here
{ // destroy both of them
ApplyEffectToObject(DURATION_TYPE_INSTANT, eMind, GetNearestObjectByTag((sEtherG), sWPNW));
DestroyObject(GetNearestObjectByTag(sEtherG, sWPNW));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eMind, GetNearestObjectByTag((sEtherG), sWPSE));
DestroyObject(GetNearestObjectByTag(sEtherG, sWPSE));
}
// Before Jumping the player, do some effects
DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport, oPlayer));
DelayCommand(1.8, AssignCommand(oPlayer, ClearAllActions()));
DelayCommand(2.0, AssignCommand(oPlayer, ActionJumpToObject(GetObjectByTag(sEntranceWP)))); // jump player to trial
// Shout that player does the trial
AssignCommand(GetObjectByTag("EtherealShouter"), ActionSpeakString(GetName(oPlayer) + " does the trial of " + sTrial, TALKVOLUME_SHOUT));
}
else if (GetLocalInt(oStore, sTrial) == 1 || // quest in progress, elem killed, or stone taken
GetLocalInt(oStore, sTrial) == 2 ||
GetLocalInt(oStore, sTrial) == 4)
{
SendMessageToPC(oPlayer, "Someone is already doing the " + sTrialMsg);
}
}
void Elemental_Altar(string sAltarType, object oPlayer)
{
// string sAltarType = GetName(OBJECT_SELF);
// object oPlayer = GetLastUsedBy();
object oStore = GetObjectByTag("TrialStore");
object oExit = GetNearestObjectByTag("TrialExitD");
effect eTeleport;
int sHasOne = 0;
int iOnlyOnce = 1; // set this to 0 if you want the tests to be available multiple times
if (GetItemPossessedBy(oPlayer, "stoneofearth") != OBJECT_INVALID ||
GetItemPossessedBy(oPlayer, "stoneoffire") != OBJECT_INVALID ||
GetItemPossessedBy(oPlayer, "stoneofwater") != OBJECT_INVALID ||
GetItemPossessedBy(oPlayer, "stoneofair") != OBJECT_INVALID)
{
sHasOne = 1;
}
if (sHasOne == 1)
{
SendMessageToPC(oPlayer, "You already did an Elemental Trial");
}
// Earth
else if (sAltarType == "Altar of Earth")
{
eTeleport = EffectVisualEffect(VFX_COM_HIT_ACID);
DoAltar(oStore, oPlayer, oExit, "earth", "rockdemon", "TrialEntranceEarth", "TrialEarthP2", "Trial of Earth", iOnlyOnce, eTeleport);
}
// Fire
else if (sAltarType == "Altar of Fire")
{
eTeleport = EffectVisualEffect(VFX_COM_HIT_FIRE);
DoAltar(oStore, oPlayer, oExit, "fire", "magmademon", "TrialEntranceFire", "TrialFireP1", "Trial of Fire", iOnlyOnce, eTeleport);
}
// Water
else if (sAltarType == "Altar of Water")
{
eTeleport = EffectVisualEffect(VFX_COM_HIT_SONIC);
DoAltar(oStore, oPlayer, oExit, "water", "wavedemon", "TrialEntranceWater", "TrialWaterP2", "Trial of Water", iOnlyOnce, eTeleport);
}
// Air
else if (sAltarType == "Altar of Air")
{
eTeleport = EffectVisualEffect(VFX_COM_HIT_FROST);
DoAltar(oStore, oPlayer, oExit, "air", "stormdemon", "TrialEntranceAir", "TrialAirP1", "Trial of Air", iOnlyOnce, eTeleport);
}
}