67 lines
1.8 KiB
Plaintext
67 lines
1.8 KiB
Plaintext
/*--------------------------------------------------------
|
|
|
|
Script Name: securedoorscript
|
|
----------------------------------------------------------
|
|
Created By: Genisys(Guile)
|
|
Created On: 2/09/09
|
|
----------------------------------------------------------
|
|
|
|
This script goes in the OnUsed even of ALL Treasure Chest
|
|
bags or whatever will be opened by a PC that has treasure
|
|
in it!
|
|
|
|
----------------------------------------------------------*/
|
|
|
|
//PROTOTYPE
|
|
void DestroyTreasure(object oMe)
|
|
{
|
|
object o = GetFirstItemInInventory(oMe);
|
|
while(GetIsObjectValid(o))
|
|
{
|
|
SetPlotFlag(o, FALSE);
|
|
DestroyObject(o, 0.0f);
|
|
o =GetNextItemInInventory(oMe);
|
|
}
|
|
}
|
|
|
|
|
|
void main()
|
|
{
|
|
|
|
//Prevent Cheating!!
|
|
effect eEffect = EffectDamage(6666, DAMAGE_TYPE_POSITIVE, DAMAGE_POWER_NORMAL);
|
|
effect eVis = EffectVisualEffect(VFX_FNF_GREATER_RUIN);
|
|
object oPC = GetLastUsedBy();
|
|
string sMsg;
|
|
|
|
if(GetHasSpellEffect(SPELL_ETHEREALNESS, oPC) ||
|
|
GetHasSpellEffect(SPELL_IMPROVED_INVISIBILITY, oPC) ||
|
|
GetHasSpellEffect(SPELL_INVISIBILITY, oPC) ||
|
|
GetHasSpellEffect(SPELL_INVISIBILITY_SPHERE, oPC) ||
|
|
GetHasSpellEffect(SPELL_SANCTUARY, oPC))
|
|
{
|
|
if(GetLocalInt(oPC, "GS_LOOTER")==2)
|
|
{
|
|
CreateItemOnObject("gslootlib", oPC, 1);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC, 0.0f);
|
|
DelayCommand(4.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC, 0.0f));
|
|
sMsg = "You cannot be invisible while looting for treasure, YOU WILL RECIEVE NO MORE WARNINGS!";
|
|
FloatingTextStringOnCreature(sMsg, oPC, TRUE);
|
|
DelayCommand(0.3, DestroyTreasure(OBJECT_SELF));
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
CreateItemOnObject("gslootlib", oPC, 1);
|
|
SetLocalInt(oPC, "GS_LOOTER", 2);
|
|
sMsg = "You cannot be invisible while looting for treasure, YOU HAVE BEEN WARNED!";
|
|
FloatingTextStringOnCreature(sMsg, oPC, TRUE);
|
|
DelayCommand(0.3, DestroyTreasure(OBJECT_SELF));
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|