85 lines
2.2 KiB
Plaintext
85 lines
2.2 KiB
Plaintext
////////////////////////////////////
|
|
//Created by Genisys / Guile 6/27/08
|
|
////////////////////////////////////
|
|
/*
|
|
script name: "ac_stoneofrecall"
|
|
|
|
This is a tagbased item script which
|
|
works off the tagnamed item
|
|
"stoneofrecall" this script allows
|
|
the user to teleport to a waypoint
|
|
tagnamed "home" storing thier location
|
|
till they use the stone again, which
|
|
will teleport them back to where
|
|
they original used the stone.
|
|
|
|
*/
|
|
////////////////////////////////////
|
|
|
|
///Main Script///
|
|
void main()
|
|
{
|
|
//Declare Major Variables
|
|
object oPC = GetItemActivator();
|
|
object oTarget;
|
|
location lTarget;
|
|
location lLocation;
|
|
location lStored = GetLocalLocation(oPC, "recall_loc");
|
|
effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_CELESTIAL);
|
|
|
|
//Note Useable in Combat..
|
|
if (GetIsInCombat(oPC))
|
|
{
|
|
FloatingTextStringOnCreature("This item is not useable in combat!", oPC, FALSE);
|
|
return;
|
|
}
|
|
|
|
//If the stored location is valid..
|
|
if (GetIsObjectValid(GetAreaFromLocation(lStored))==TRUE)
|
|
{
|
|
|
|
//Apply a fancy visual effect :)
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC, 0.0f);
|
|
|
|
AssignCommand(oPC, ClearAllActions());
|
|
|
|
//Allow for the visual effect to finish.
|
|
DelayCommand(4.0, AssignCommand(oPC, ActionJumpToLocation(lStored)));
|
|
|
|
//Remove the stored location..
|
|
DelayCommand(7.0, DeleteLocalLocation(oPC, "recall_loc"));
|
|
}
|
|
|
|
//If the PC doesn't have a stored location...
|
|
else if(GetIsObjectValid(GetAreaFromLocation(lStored))==FALSE)
|
|
{
|
|
oPC = GetItemActivator();
|
|
|
|
oTarget = GetWaypointByTag("home");
|
|
|
|
lTarget = GetLocation(oTarget);
|
|
|
|
//Store the PC's current location first..
|
|
SetLocalLocation(oPC, "recall_loc", GetLocation(oPC));
|
|
|
|
//Apply a fancy visual effect :)
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC, 0.0f);
|
|
|
|
DelayCommand(0.1, AssignCommand(oPC, ClearAllActions()));
|
|
|
|
//Teleport them to the waypoint tagnamed "home"
|
|
DelayCommand(4.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
|
|
|
|
}
|
|
|
|
//Otherwise if both above fail..
|
|
else
|
|
{
|
|
//Tell the PC there is a bug and ask them to report it.
|
|
FloatingTextStringOnCreature("There is an error with the Recall Stone" +
|
|
", please report this to the DMs.", GetItemActivator(), FALSE);
|
|
}
|
|
|
|
//Script End
|
|
}
|