136 lines
4.5 KiB
Plaintext
136 lines
4.5 KiB
Plaintext
////
|
|
// This script controls the various Portals in the Elemental Trial
|
|
|
|
void main()
|
|
{
|
|
object oPlayer = GetLastUsedBy();
|
|
object oNearestWayPoint = GetNearestObjectByTag("TrialWayPoint");
|
|
object oStore = GetObjectByTag("TrialStore");
|
|
string sNearestWayPointName = GetName(oNearestWayPoint);
|
|
|
|
if (sNearestWayPointName == "Fire1")
|
|
{
|
|
if (GetLocalInt(oStore, "fire") == 4)
|
|
{
|
|
SendMessageToPC(oPlayer, "You have to kill the Magma Demon first");
|
|
}
|
|
else if (GetItemPossessedBy(oPlayer, "stoneoffire") == OBJECT_INVALID)
|
|
{
|
|
SendMessageToPC(oPlayer, "You should take the Stone of Fire");
|
|
}
|
|
else
|
|
{
|
|
AssignCommand(oPlayer, ActionJumpToObject(GetObjectByTag("TrialFireD1")));
|
|
if (GetLocalInt(oStore, "ether") == 0)
|
|
{
|
|
SetLocalInt(oStore, "ether", 2);
|
|
CreateObject(OBJECT_TYPE_CREATURE, "etherealguard", GetLocation(GetObjectByTag("EtherSpawn")));
|
|
}
|
|
}
|
|
}
|
|
else if (sNearestWayPointName == "Air1")
|
|
{
|
|
if (GetLocalInt(oStore, "air") == 4)
|
|
{
|
|
SendMessageToPC(oPlayer, "You have to kill the Storm Demon first");
|
|
}
|
|
else if (GetItemPossessedBy(oPlayer, "stoneofair") == OBJECT_INVALID)
|
|
{
|
|
SendMessageToPC(oPlayer, "You should take the Stone of Air");
|
|
}
|
|
else
|
|
{
|
|
AssignCommand(oPlayer, ActionJumpToObject(GetObjectByTag("TrialAirD1")));
|
|
if (GetLocalInt(oStore, "ether") == 0)
|
|
{
|
|
SetLocalInt(oStore, "ether", 2);
|
|
CreateObject(OBJECT_TYPE_CREATURE, "etherealguard", GetLocation(GetObjectByTag("EtherSpawn")));
|
|
}
|
|
}
|
|
}
|
|
else if (sNearestWayPointName == "Water1")
|
|
{
|
|
AssignCommand(oPlayer, ActionJumpToObject(GetObjectByTag("TrialWaterD1")));
|
|
}
|
|
else if (sNearestWayPointName == "Earth1")
|
|
{
|
|
AssignCommand(oPlayer, ActionJumpToObject(GetObjectByTag("TrialEarthD1")));
|
|
}
|
|
else if (sNearestWayPointName == "Water3")
|
|
{
|
|
if (GetLocalInt(oStore, "water") == 4)
|
|
{
|
|
SendMessageToPC(oPlayer, "You have to kill the Wave Demon first");
|
|
}
|
|
else if (GetItemPossessedBy(oPlayer, "stoneofwater") == OBJECT_INVALID)
|
|
{
|
|
SendMessageToPC(oPlayer, "You should take the Stone of Water");
|
|
}
|
|
else
|
|
{
|
|
AssignCommand(oPlayer, ActionJumpToObject(GetObjectByTag("TrialWaterD2")));
|
|
if (GetLocalInt(oStore, "ether") == 0)
|
|
{
|
|
SetLocalInt(oStore, "ether", 2);
|
|
CreateObject(OBJECT_TYPE_CREATURE, "etherealguard", GetLocation(GetObjectByTag("EtherSpawn")));
|
|
}
|
|
}
|
|
}
|
|
else if (sNearestWayPointName == "Earth3")
|
|
{
|
|
if (GetLocalInt(oStore, "earth") == 4)
|
|
{
|
|
SendMessageToPC(oPlayer, "You have to kill the Rock Demon first");
|
|
}
|
|
else if (GetItemPossessedBy(oPlayer, "stoneofearth") == OBJECT_INVALID)
|
|
{
|
|
SendMessageToPC(oPlayer, "You should take the Stone of Earth");
|
|
}
|
|
else
|
|
{
|
|
AssignCommand(oPlayer, ActionJumpToObject(GetObjectByTag("TrialEarthD2")));
|
|
if (GetLocalInt(oStore, "ether") == 0)
|
|
{
|
|
SetLocalInt(oStore, "ether", 2);
|
|
CreateObject(OBJECT_TYPE_CREATURE, "etherealguard", GetLocation(GetObjectByTag("EtherSpawn")));
|
|
}
|
|
}
|
|
}
|
|
else if (sNearestWayPointName == "TrialExit")
|
|
{
|
|
if (GetLocalInt(oStore, "ether") != 1)
|
|
{
|
|
SendMessageToPC(oPlayer, "You have to kill the Ethereal Guardian first");
|
|
}
|
|
else
|
|
{
|
|
if (GetItemPossessedBy(oPlayer, "stoneofearth") != OBJECT_INVALID)
|
|
{
|
|
SetLocalInt(oStore, "earth", 3);
|
|
}
|
|
else if (GetItemPossessedBy(oPlayer, "stoneoffire") != OBJECT_INVALID)
|
|
{
|
|
SetLocalInt(oStore, "fire", 3);
|
|
}
|
|
else if (GetItemPossessedBy(oPlayer, "stoneofwater") != OBJECT_INVALID)
|
|
{
|
|
SetLocalInt(oStore, "water", 3);
|
|
}
|
|
else if (GetItemPossessedBy(oPlayer, "stoneofair") != OBJECT_INVALID)
|
|
{
|
|
SetLocalInt(oStore, "air", 3);
|
|
}
|
|
AssignCommand(oPlayer, ActionJumpToObject(GetLocalObject(oPlayer, "Exit")));
|
|
|
|
// mark the etherguard to respawn if all 4 elements have been taken out
|
|
if (GetLocalInt(oStore, "earth") == 3 &&
|
|
GetLocalInt(oStore, "fire") == 3 &&
|
|
GetLocalInt(oStore, "water") == 3 &&
|
|
GetLocalInt(oStore, "air") == 3)
|
|
{
|
|
SetLocalInt(oStore, "ether", 0);
|
|
}
|
|
}
|
|
}
|
|
}
|