Author Topic: No using portal scroll while in jail  (Read 473 times)

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
No using portal scroll while in jail
« on: September 20, 2010, 12:38:03 am »


               I dont want players to be using their portal scroll or book while in jail.. not sure how to limit this .Here is my  script .If you could tell me what to add?


#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();
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));
}}
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
No using portal scroll while in jail
« Reply #1 on: September 20, 2010, 12:41:29 am »


               

#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 .
                     
                  


            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
No using portal scroll while in jail
« Reply #2 on: September 20, 2010, 12:48:49 am »


               '<img'> Thanks so much

I tried so many times 

I guess I had the du hiky in the spot where the thinga magigy went .':wizard:'