79 lines
3.7 KiB
Plaintext
79 lines
3.7 KiB
Plaintext
////////
|
|
// What happens if the player leaves the trial
|
|
// either through death or clientexit?
|
|
|
|
void failtrial(object oStore, object oPlayer, string sTrial, string sInt, string sItem, string sMonster, string sSpawnPoint)
|
|
{
|
|
object oTrialGuy = GetObjectByTag(sMonster);
|
|
//effect eHeal = EffectHeal(GetMaxHitPoints(sMonster));
|
|
switch (GetLocalInt(oStore, sInt))
|
|
{
|
|
case 1: // player killed TrialGuy
|
|
DestroyObject(GetFirstItemInInventory(oTrialGuy)); // destroy the stone on killed monster
|
|
DestroyObject(oTrialGuy); // destroy the dead trial guy
|
|
CreateObject(OBJECT_TYPE_CREATURE, sMonster, GetLocation(GetObjectByTag(sSpawnPoint))); // create new trial guy
|
|
SetLocalInt(oStore, sInt, 0); // Reset the Quest
|
|
SendMessageToPC(oPlayer, "You have failed the test of " + sInt + ".");
|
|
SetLocalLocation(oPlayer, "DeathLocation", GetLocation(GetLocalObject(oPlayer, "Exit")));
|
|
break;
|
|
case 2: // player killed TrialGuy and took stone
|
|
DestroyObject(GetItemPossessedBy(oPlayer, sItem)); // destroy the trial stone on the player
|
|
CreateObject(OBJECT_TYPE_CREATURE, sMonster, GetLocation(GetObjectByTag(sSpawnPoint))); // create new trial guy
|
|
SetLocalInt(oStore, sInt, 0); // Reset the Quest
|
|
SendMessageToPC(oPlayer, "You have failed the test of " + sInt + ".");
|
|
SetLocalLocation(oPlayer, "DeathLocation", GetLocation(GetLocalObject(oPlayer, "Exit")));
|
|
break;
|
|
case 3: // player exits through last portal
|
|
SendMessageToPC(oPlayer, "You passed the Test of " + sInt + "!");
|
|
|
|
// Shout that player won the trial
|
|
AssignCommand(GetObjectByTag("EtherealShouter"), ActionSpeakString(GetName(oPlayer) + " has finished the trial of " + sTrial, TALKVOLUME_SHOUT));
|
|
break;
|
|
case 4: // player did not kill anything
|
|
// Jump the trial guy back to his starting position and heal him
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oTrialGuy)), oTrialGuy);
|
|
AssignCommand(oTrialGuy, ActionJumpToObject(GetObjectByTag(sSpawnPoint)));
|
|
SetLocalInt(oStore, sInt, 0); // Reset the Quest
|
|
SendMessageToPC(oPlayer, "You have failed the test of " + sInt + ".");
|
|
SetLocalLocation(oPlayer, "DeathLocation", GetLocation(GetLocalObject(oPlayer, "Exit")));
|
|
break;
|
|
}
|
|
}
|
|
|
|
void main()
|
|
{
|
|
object oStore = GetObjectByTag("TrialStore");
|
|
//object oPlayer = GetLocalObject(oStore, "oPCFailed");
|
|
object oPlayer = GetExitingObject();
|
|
string sTrial = GetLocalString(oPlayer, "Trial");
|
|
if (sTrial == "earth")
|
|
{
|
|
string sInt = "earth";
|
|
string sItem = "stoneofearth";
|
|
string sMonsterTag = "rockdemon";
|
|
failtrial(oStore, oPlayer, sTrial, sInt, sItem, sMonsterTag, "TrialEarthP2");
|
|
}
|
|
if (sTrial == "fire")
|
|
{
|
|
string sInt = "fire";
|
|
string sItem = "stoneoffire";
|
|
string sMonsterTag = "magmademon";
|
|
failtrial(oStore, oPlayer, sTrial, sInt, sItem, sMonsterTag, "TrialFireP1");
|
|
}
|
|
if (sTrial == "water")
|
|
{
|
|
string sInt = "water";
|
|
string sItem = "stoneofwater";
|
|
string sMonsterTag = "wavedemon";
|
|
failtrial(oStore, oPlayer, sTrial, sInt, sItem, sMonsterTag, "TrialWaterP2");
|
|
}
|
|
if (sTrial == "air")
|
|
{
|
|
string sInt = "air";
|
|
string sItem = "stoneofair";
|
|
string sMonsterTag = "stormdemon";
|
|
failtrial(oStore, oPlayer, sTrial, sInt, sItem, sMonsterTag, "TrialAirP1");
|
|
}
|
|
SetLocalString(oPlayer, "Trial", "no trial");
|
|
}
|