Aller au contenu

Photo

No using portal scroll while in jail


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
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));
}}

#2
Shadooow

Shadooow
  • Members
  • 4 470 messages

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


#3
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
:) Thanks so much

I tried so many times 

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