case EVENT_TYPE_UNIQUE_POWER:
{
//Teleport user depending on where he is.
object oItem = GetEventObject(ev, 0);
if (GetTag(oItem) == "tome_of_the_cheat")
{
object oArea = GetArea(oPC);
if (GetTag(oArea) != "tome_cheat_area")
{
if (FetchInteger(TOME_CHEAT_CACHE, "nReturned") == TRUE && GetTag(oArea) == FetchString(TOME_CHEAT_CACHE, "sArea"))
{
ReturnToLocation();
}
else
{
location lPC = GetLocation(oPC);
string sArea = GetTag(oArea);
object [] oWP = GetNearestObjectToLocation(lPC, OBJECT_TYPE_WAYPOINT);
string sWP = GetTag(oWP[0]);
StoreLocation(TOME_CHEAT_CACHE, "lPC", lPC);
StoreString(TOME_CHEAT_CACHE, "sArea", sArea);
StoreString(TOME_CHEAT_CACHE, "sWP", sWP);
DoAreaTransition("tome_cheat_area", "tome_cheat_target");
}
}
else
{
ReturnToArea();
/* Attempt at making this work more elegantly
// (avoiding the need for third use of the tome every cycle).
while (GetGameMode() == GM_LOADING) {}
ReturnToLocation();
*/
}
}
break;
}
Oh, and yes, I'm using Graff's variable storage, found it extremely useful after trying in vain to figure out other ways to store the location and area tag for transitions and jumping around.
Modifié par Valgreon, 07 février 2010 - 07:27 .





Retour en haut






