LoD_PRC8/_module/nss/useportal.nss
Jaysyn904 94990edc60 Initial Upload
Initial Upload
2023-09-21 21:20:34 -04:00

44 lines
1.7 KiB
Plaintext

//:: Script for the town portal scroll
//:: Created by: Helge "DarkFame" Ingvoldstad
//::
//:: Purpose: Teleports the PC back to town when town portal is used
void main()
{
object oPC = GetPCSpeaker();
location lLoc = GetLocalLocation(oPC,"Backportal"); // Finds the location the player is bound to.
if (GetLocalInt(oPC,"Bound") == 1) {
if(GetIsPC(oPC) == 1)
{
// Effects start
object oTarget = oPC;
effect eVis = EffectVisualEffect(VFX_IMP_DISPEL, FALSE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oTarget, 6.0);
// Effects stop
AssignCommand(oPC, ActionJumpToLocation(lLoc)); // Teleports the PC
if (GetLocalLocation(oPC,"Owner") == GetLocation(OBJECT_SELF))
{
DestroyObject(OBJECT_SELF); // Destroys the portal when the OWNER enters it, remove this line if you want a permanent portal
DeleteLocalLocation(oPC,"Owner"); // Deletes the owner variable as it's not need anymore
}
SetLocalLocation(oPC,"Portal",GetLocation(OBJECT_SELF));
}
} else
{
if(GetIsPC(oPC) == 1)
{
object Destination = GetWaypointByTag("DefualtBind");
object oTarget = oPC;
effect eVis = EffectVisualEffect(VFX_IMP_DISPEL, FALSE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oTarget, 6.0);
AssignCommand(oPC, JumpToObject(Destination));
if (GetLocalLocation(oPC,"Owner") == GetLocation(OBJECT_SELF))
{
DestroyObject(OBJECT_SELF); // Destroys the portal when the OWNER enters it, remove this line if you want a permanent portal
DeleteLocalLocation(oPC,"Owner"); // Deletes the owner variable as it's not need anymore
}
SetLocalLocation(oPC,"Portal",GetLocation(OBJECT_SELF));
}
}
}