104 lines
3.8 KiB
Plaintext
104 lines
3.8 KiB
Plaintext
//::////////////////////////////////////////////////////////////////////////////
|
|
//::
|
|
//:: Script Name: kill_matron_door
|
|
//::
|
|
//:: Use: This script is use in the onEnter event of a trigger to check for
|
|
//:: an item in the players possesion, then do some visual effects, destroy
|
|
//:: a placeable blocking the players path, destroy the item in the
|
|
//:: players inventory, and finally respawn the placeable in a set amount
|
|
//:: of time
|
|
//::
|
|
//:: Created By: Birdman076
|
|
//::
|
|
//:: Created On: July 27, 2009
|
|
//::
|
|
//:: Note: See comments in the code for details
|
|
//::
|
|
//::
|
|
//::////////////////////////////////////////////////////////////////////////////
|
|
location lTarget;
|
|
object oItem;
|
|
effect eEffect;
|
|
int nInt;
|
|
object oTarget;
|
|
|
|
#include "nw_i0_2q4luskan"
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetEnteringObject();
|
|
|
|
if (!GetIsPC(oPC)) return;
|
|
// Check for the item on the player
|
|
if (GetItemPossessedBy(oPC, "SHA_ZOLAD_MROCKS")== OBJECT_INVALID)
|
|
return;
|
|
// set an variable on the trigger to "active"
|
|
if (GetLocalInt(OBJECT_SELF, "ISACTIVE")== 100)
|
|
{
|
|
oTarget = oPC;
|
|
|
|
//Visual effects can't be applied to waypoints, so if it is a WP
|
|
//the VFX will be applied to the WP's location instead
|
|
|
|
nInt = GetObjectType(oTarget);
|
|
|
|
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), oTarget);
|
|
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), GetLocation(oTarget));
|
|
|
|
oTarget = GetNearestObjectByTag("WP_Visual_Effect");
|
|
|
|
//Visual effects can't be applied to waypoints, so if it is a WP
|
|
//the VFX will be applied to the WP's location instead
|
|
|
|
nInt = GetObjectType(oTarget);
|
|
|
|
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_MYSTICAL_EXPLOSION), oTarget);
|
|
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_MYSTICAL_EXPLOSION), GetLocation(oTarget));
|
|
|
|
oTarget = oPC;
|
|
// temporarily knock the player down for more effective explosions :)
|
|
eEffect = EffectKnockdown();
|
|
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 3.0f);
|
|
// Send then the obligatory message.
|
|
SendMessageToPC(oPC, "One of Zolad's Magic Rocks suddenly reacts to the magical ward in front of you... and bursts! The energies contained within Zolad's Magic Rock dispel the ward, go through quick!");
|
|
|
|
//Visual effects can't be applied to waypoints, so if it is a WP
|
|
//the VFX will be applied to the WP's location instead
|
|
|
|
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));
|
|
|
|
// here we get the item by tag and destroy it if valid
|
|
oItem = GetItemPossessedBy(oPC, "SHA_ZOLAD_MROCKS");
|
|
if (GetIsObjectValid(oItem))
|
|
DestroyObject(oItem);
|
|
|
|
// This int actually "turns off" the trigger so players don't have items take
|
|
// upon re-entering the trigger
|
|
SetLocalInt(OBJECT_SELF, "ISACTIVE", 200);
|
|
|
|
// We destroy the placeable with no delay hence the "0.0"
|
|
oTarget = GetNearestObjectByTag("Matron_Door");
|
|
SetPlotFlag(oTarget, FALSE);
|
|
DestroyObject(oTarget, 0.0);
|
|
|
|
// We get a waypoint that we designated and placed in the area where we want
|
|
// the placeable to respawn to
|
|
oTarget = GetNearestObjectByTag("WP_MATRON_DOOR");
|
|
|
|
// Get the location of the waypoint
|
|
lTarget = GetLocation(oTarget);
|
|
|
|
// Create the placeable from the palette and place it at the waypoint location
|
|
DelayCommand(300.0, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "matron_door", lTarget));
|
|
|
|
// Set the int back to default so the trigger is "active" again
|
|
DelayCommand(301.0, SetLocalInt(OBJECT_SELF, "ISACTIVE", 100));
|
|
|
|
}
|
|
}
|
|
|