HiddenTradition_PRC8/_module/nss/at_lance_portal.nss
2024-06-20 15:47:42 -04:00

64 lines
1.4 KiB
Plaintext

#include "nw_i0_plot"
string sDeny;
string sOpen;
void main()
{
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
int nInt;
nInt=GetLocalInt(oPC, "BaptiseLaw");
if (nInt == 1)
{
sDeny="Those who have been baptised by the power of Christ cannot open this pagan portal!";
SendMessageToPC(oPC, sDeny);
return;
}
SetPLocalInt(oPC, "BaptiseLaw", 0);
sOpen = "You have opened this ancient portal to the True King. Your party may now use it." ;
SendMessageToPC(oPC, sOpen);
//SetLocalInt(oPC, "LanceQuest", 3);
object oTarget;
oTarget = OBJECT_SELF;
//Visual effects can't be applied to waypoints, so if it is a WP
//apply to the WP's location instead
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUNBEAM), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUNBEAM), GetLocation(oTarget));
AssignCommand(oPC, ClearAllActions());
location lTarget;
oTarget = GetWaypointByTag("DST_lance_portal");
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;
AssignCommand(oPC, ActionJumpToLocation(lTarget));
}