76 lines
1.8 KiB
Plaintext
76 lines
1.8 KiB
Plaintext
//Script Name: ac_itool
|
|
//////////////////////////////////////////
|
|
//Created by: Genisys / Guile
|
|
//ON: 7/29/08
|
|
/////////////////////////////////////////
|
|
/* **Notes**
|
|
|
|
This is a tagbased item activation script
|
|
this works on tagbased scripting as this
|
|
script is fired from the script "itool"
|
|
|
|
Whenever the item "Inventory Organizer"
|
|
tagnamed "itool" is used, the PC is
|
|
teleported to the Inventory Room to
|
|
sort their items out in their inventory.
|
|
|
|
*/
|
|
//////////////////////////////////////////
|
|
string sDeny;
|
|
|
|
//Required Include (Because it's a tagbased item!)
|
|
#include "x2_inc_switches"
|
|
|
|
|
|
//Main Script
|
|
void main()
|
|
{
|
|
|
|
// Check if we have the correct event firing the script
|
|
if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE)
|
|
{return;}
|
|
|
|
object oPC = GetItemActivator();
|
|
|
|
|
|
//If the system is in use, don't allow anyone to enter!
|
|
if (GetLocalInt(oPC, "INVUSE")== 1)
|
|
{
|
|
sDeny="Inventory Room In Use, Try again later.";
|
|
|
|
SendMessageToPC(oPC, sDeny);
|
|
|
|
return;
|
|
}
|
|
|
|
//Otherwise set that the room is in use!
|
|
//This allows the PC into the room!!
|
|
SetLocalInt(oPC, "INVROOMUSER", 1);
|
|
|
|
//Note this variable is removed when the PC leaves the area!
|
|
SetLocalInt(GetModule(), "INVUSE", 1);
|
|
|
|
object oTarget;
|
|
location lTarget;
|
|
oTarget = GetWaypointByTag("isystemway");
|
|
|
|
lTarget = GetLocation(oTarget);
|
|
|
|
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
|
|
|
|
SetLocalLocation(oPC, "inv_loc", GetLocation(oPC));
|
|
|
|
AssignCommand(oPC, ClearAllActions());
|
|
|
|
DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
|
|
|
|
oTarget = oPC;
|
|
|
|
int nInt;
|
|
nInt = GetObjectType(oTarget);
|
|
|
|
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), oTarget);
|
|
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget));
|
|
|
|
}
|