generated from Jaysyn/ModuleTemplate
43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: 07_caveinscr
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This is a random firing script that causes the
|
|
cave-in effect. The percentage of firing is equal
|
|
to the trigger's KEYTAG
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: ruelk
|
|
//:: Created On: 2/21/04
|
|
//:://////////////////////////////////////////////
|
|
void main()
|
|
{
|
|
//Get the percentage chance this will fire from the
|
|
//trigger's key tag
|
|
int nChance = StringToInt(GetLockKeyTag(OBJECT_SELF));
|
|
//there is a chance this doesnt happen. After all,
|
|
//it should look random. It's just unlucky for the PC
|
|
//who is at the wrong place at the wrong time
|
|
if (d100() > nChance)return;
|
|
|
|
|
|
object oPC = GetEnteringObject();
|
|
//Although we are saying PC it can be caused by any valid object.
|
|
if (!GetIsObjectValid(oPC)) return;
|
|
|
|
//since triggers cant cast we have an invisible object do it
|
|
object oCaster;
|
|
oCaster = GetObjectByTag("07_CAVEINSOURCE");
|
|
|
|
//The collapse should happen at an area, not the PC
|
|
//so we tell it to do so at the Wcasting object.
|
|
object oTarget= oCaster;
|
|
|
|
//this is just the spell Bombardment
|
|
//its the closest visual I could come up with to simulate a cave in
|
|
AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_BOMBARDMENT, GetLocation(oTarget), METAMAGIC_ANY, TRUE, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
|
|
|
|
}
|
|
|