UW2_PRC8/_module/nss/invroom_teleport.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

69 lines
1.6 KiB
Plaintext

//Script Name: invroom_teleport
//////////////////////////////////////////
//Created by: Genisys / Guile
//ON: 7/29/08
/////////////////////////////////////////
/* **Notes**
This goes in the Action Taken, on the
conversation line which allow PC's to
organize thier inventory. This script
teleports them to the inventory room,
where they can quickly sort thier
inventory.
*/
//////////////////////////////////////////
string sDeny;
//Main Script
void main()
{
object oPC = GetPCSpeaker();
//If the system is in use, don't allow anyone to enter!
if (GetLocalInt(GetModule(), "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!!
//Note this variable is removed when the PC leaves the area!
SetLocalInt(GetModule(), "INVUSE", 1);
//This allows the PC into the room!
//If the PC does not have this variable, they are automatically teleported out!
SetLocalInt(oPC, "INVROOMUSER", 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));
}