44 lines
1.1 KiB
Plaintext
44 lines
1.1 KiB
Plaintext
#include "mw_teleport_inc"
|
|
|
|
void main()
|
|
{
|
|
float fEFFECT_DURATION = 15.0;
|
|
object oUser,
|
|
oOwner,
|
|
oWP;
|
|
string sTag;
|
|
int iCharges;
|
|
|
|
|
|
|
|
oUser = GetLastUsedBy();
|
|
oOwner = GetLocalObject(OBJECT_SELF, "mw_PortalOwner");
|
|
iCharges = GetLocalInt(OBJECT_SELF, "mw_PortalCharges");
|
|
|
|
if (GetIsObjectValid(oOwner))
|
|
{
|
|
if (! mw_BelongsToParty(oOwner, oUser))
|
|
return;
|
|
}
|
|
/* teleport to location */
|
|
|
|
sTag = "DST_" + GetTag(GetLocalObject(OBJECT_SELF, "mw_PortalLocation"));
|
|
oWP = GetWaypointByTag(sTag);
|
|
if (GetIsObjectValid(oWP))
|
|
{
|
|
mw_TeleportWithEffects(oUser, oWP, fEFFECT_DURATION);
|
|
if (--iCharges == 0)
|
|
{
|
|
object oLoc = GetLocalObject(OBJECT_SELF, "mw_PortalLocation");
|
|
DeleteLocalInt(oLoc, "mw_Taken");
|
|
DestroyObject(OBJECT_SELF, 2.0);
|
|
}
|
|
else
|
|
SetLocalInt(OBJECT_SELF, "mw_PortalCharges", iCharges);
|
|
}
|
|
else
|
|
{
|
|
PrintString("Couldn't teleport player " + GetName(oUser) + " to party portal waypoint " + sTag);
|
|
}
|
|
}
|