#include "x2_inc_switches"
void main()
{
if (!GetIsPC(GetItemActivatedTarget())|| GetIsInCombat(GetItemActivator()))
{
SendMessageToPC(GetItemActivator(), "To hard to read while in battle!");
return;}
int nEvent =GetUserDefinedItemEventNumber();
// Exit if not an activate event
if(nEvent != X2_ITEM_EVENT_ACTIVATE)return;
{
object oPC;
oPC = GetItemActivator();
string sArea = GetTag(GetArea(oPC));
if(sArea == "jail" || sArea == "jail2")
{
SendMessageToPC(oPC, "Not possible there");
return;
}
object oTarget;
location lTarget;
oTarget = GetWaypointByTag("NW_library");
lTarget = GetLocation(oTarget);//only do the jump if the location is valid.
//though not flawless, we just check if it is in a valid area.
//the script will stop if the location isn't valid - meaning that
//nothing put after the teleport will fire either.
//the current location won't be stored, either
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
SetLocalLocation(oPC, "ls_stored_loc", GetLocation(oPC));
AssignCommand(oPC, ClearAllActions());
DelayCommand(2.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
DelayCommand(0.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_GHOST_SMOKE), oPC, 4.0));
oTarget = oPC;
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_HOWL_ODD), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_HOWL_ODD), GetLocation(oTarget));
}}
Just change tags to match area you want to restrict.
Modifié par ShaDoOoW, 19 septembre 2010 - 11:42 .