NAME: Name these yourself
WHAT IT DOES: This is my version of a recall stone.
NOTES: As these notes refer to things in the script that are too long
for the "too long of a word error, they must also be placed in a script
window, though they are notes, not scripts. BTW the too long of a word
error filter thingy is stupid and you could never convince me that there
is any good reason for having that limitation on a forum that talks
about scripting.
NWScript: I just scripted my own recall item. It is a tent. The item must be magical so that you can assignt the attribute CAST SPELL: UNIQUE ITEM SELF ONLY. My implementation was for a "tent" item. When The person right clicks on that item and chooses special ability unique item self only, it teleports them to the tent area. When they exit the tent door, it teleports them back to where the used the item. There are two scripts here, one in the module script event "OnItemActivated" and the other on the tent exit door script event "OnAreaTransitionClick". In the tent is a bedroll tagged "BedRollTentEntry". If you modify this script to tp you elsewhere, then just change the tag in the script to match the tag in the object to which your character will teleport. The two scripts follow------
void main()
{
object oActivatedObject = GetItemActivated();
string sActivatedItemTag = GetTag(oActivatedObject);
if(sActivatedItemTag == "Tent")
{
object oDestination = GetObjectByTag("BedRollTentEntry");
if(GetIsObjectValid(oDestination)==TRUE)
{
SetLocalLocation(GetItemActivator(),"MY_L_LOC_TENT",GetLocation(GetItemActivator()));
object oClicker = GetItemActivator();
AssignCommand(oClicker, ClearAllActions());
AssignCommand(oClicker, JumpToObject(oDestination));
AssignCommand(oClicker, ActionDoCommand(ClearAllActions()));
}
}
}
void main()
{
object oEnterer=GetEnteringObject();
location lLoc=GetLocalLocation(oEnterer,"MY_L_LOC_TENT");
AssignCommand(oEnterer,ActionJumpToLocation(lLoc));
}
P.S. (hehe pardon that pun) By the way, this works perfectly.
|