Files
HeroesStone_PRC8/_module/nss/mgtower_teleport.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

201 lines
7.8 KiB
Plaintext

void main()
{
int iListen = GetListenPatternNumber();
string sPasswordtower;
if(iListen == 777) // listen pattern set in s_listener
{
sPasswordtower = GetMatchedSubstring(0);
if(sPasswordtower == "level1" || sPasswordtower == "level 1" || sPasswordtower == "Level1" || sPasswordtower == "Level 1") // change these words for the level 1 password
{
SpeakString("With a powerful blast of air, the elemental hurls you to the tower's first level.");
object oPC = GetLastSpeaker();
object oTarget;
location lTarget;
oTarget = GetWaypointByTag("magetower_level1");
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, ClearAllActions());
DelayCommand(2.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
oTarget = oPC;
//Visual effects can't be applied to waypoints, so if it is a WP
//apply to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), GetLocation(oTarget));
}
if(sPasswordtower == "level2" || sPasswordtower == "level 2" || sPasswordtower == "Level2" || sPasswordtower == "Level 2") // change these words for the level 2 password
{
SpeakString("With a powerful blast of air, the elemental hurls you to the tower's second level.");
object oPC = GetLastSpeaker();
object oTarget;
location lTarget;
oTarget = GetWaypointByTag("magetower_level2");
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, ClearAllActions());
DelayCommand(2.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
oTarget = oPC;
//Visual effects can't be applied to waypoints, so if it is a WP
//apply to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), GetLocation(oTarget));
}
if(sPasswordtower == "level3" || sPasswordtower == "level 3" || sPasswordtower == "Level3" || sPasswordtower == "Level 3") // change these words for the level 3 password
{
SpeakString("With a powerful blast of air, the elemental hurls you to the tower's third level.");
object oPC = GetLastSpeaker();
object oTarget;
location lTarget;
oTarget = GetWaypointByTag("magetower_level3");
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, ClearAllActions());
DelayCommand(2.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
oTarget = oPC;
//Visual effects can't be applied to waypoints, so if it is a WP
//apply to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), GetLocation(oTarget));
}
if(sPasswordtower == "level4" || sPasswordtower == "level 4" || sPasswordtower == "Level4" || sPasswordtower == "Level 4") // change these words for the level 4 password
{
SpeakString("With a powerful blast of air, the elemental hurls you to the tower's fourth level.");
object oPC = GetLastSpeaker();
object oTarget;
location lTarget;
oTarget = GetWaypointByTag("magetower_level4");
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, ClearAllActions());
DelayCommand(2.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
oTarget = oPC;
//Visual effects can't be applied to waypoints, so if it is a WP
//apply to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), GetLocation(oTarget));
}
if(sPasswordtower == "level5" || sPasswordtower == "level 5" || sPasswordtower == "Level5" || sPasswordtower == "Level 5") // change these words for the level 5 password
{
SpeakString("With a powerful blast of air, the elemental hurls you to the tower's fifth level.");
object oPC = GetLastSpeaker();
object oTarget;
location lTarget;
oTarget = GetWaypointByTag("magetower_level5");
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, ClearAllActions());
DelayCommand(2.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
oTarget = oPC;
//Visual effects can't be applied to waypoints, so if it is a WP
//apply to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SOUND_BURST), GetLocation(oTarget));
}
}
}