generated from Jaysyn/ModuleTemplate
143 lines
3.8 KiB
Plaintext
143 lines
3.8 KiB
Plaintext
//************************************************
|
|
//** ss_treas_chest **
|
|
//** **
|
|
//** This script is used in the on spawn for any**
|
|
//** respawning chests you would like in your **
|
|
//** module. **
|
|
//************************************************
|
|
//**Created By: Jason Hunter (SiliconScout) **
|
|
//** **
|
|
//**Version: 1.7 **
|
|
//** **
|
|
//**Last Changed Date: November 27, 2004 **
|
|
//************************************************
|
|
|
|
void Refill_Chest(object oChest);
|
|
|
|
void main()
|
|
{
|
|
int iItemcnt =0;
|
|
object oItem = GetFirstItemInInventory(OBJECT_SELF);
|
|
|
|
/*
|
|
As is, this script will simply add to the esisting contents of the chest.
|
|
If you wish to have different behaviour please uncomment one of the lines
|
|
below.
|
|
*/
|
|
|
|
// uncomment the line below if you want the chest to only spawn if empty
|
|
// if (oItem != OBJECT_INVALID) return; //kick out if the chest is not empty
|
|
|
|
|
|
//uncomment the next 8 lines below to empty chests before re-spawning
|
|
if (GetLocalInt(OBJECT_SELF,"ss_t_chest_opened") == 0)
|
|
{
|
|
while (oItem != OBJECT_INVALID)
|
|
{
|
|
DestroyObject(oItem, 0.0);
|
|
oItem = GetNextItemInInventory(OBJECT_SELF);
|
|
}
|
|
}
|
|
|
|
|
|
if (GetLocalInt(OBJECT_SELF,"ss_t_chest_opened") == 0)
|
|
{
|
|
DelayCommand(0.2, ExecuteScript("ss_treasure",OBJECT_SELF));
|
|
DelayCommand(0.2, SetLocalInt(OBJECT_SELF,"ss_t_chest_opened",1));
|
|
}
|
|
|
|
//comment the line below out to stop chest refills
|
|
DelayCommand(0.3,Refill_Chest(OBJECT_SELF));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//scatter on open if set to scatter script below here.
|
|
|
|
//kick out if DM or DM possessed or an NPC
|
|
object oOpen = GetLastOpenedBy();
|
|
if (GetIsDM(oOpen) == TRUE) return;
|
|
if (GetIsDMPossessed(oOpen) == TRUE) return;
|
|
if (GetIsPC(oOpen) == FALSE) return;
|
|
|
|
//Not A DM so
|
|
if (GetLocalInt(OBJECT_SELF,"ss_t_toss") > 0) DelayCommand(0.5,ExecuteScript("ss_treas_toss",OBJECT_SELF));
|
|
|
|
}
|
|
|
|
void Refill_Chest(object oChest)
|
|
{
|
|
/* I would recomend changing the time for the loot spawn it is currently set to
|
|
5.0 seconds for testing purposes. You will have to determine the amount of
|
|
time that you want in your module.
|
|
|
|
NOTE: If the chest is destroyed my scripts will not recreate it at this time.
|
|
I may add that feature in the future, but at this time I do not plan to.
|
|
If you need to be there then i suggest making it a Plot item.*/
|
|
if (GetLocalInt(oChest,"ss_t_chest_opened")==1)
|
|
{
|
|
// by setting this variable to 2 it stops being able to restack a
|
|
// variable reset and kills the unlimited chest click cheat.
|
|
|
|
// everything below is my bs added = remove if bugged...
|
|
// Master Loop thru all objects in zone
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetLocalInt(oChest,"ss_t_chest_opened",2);
|
|
DelayCommand(1500.0, SetLocalInt(oChest,"ss_t_chest_opened",0));
|
|
|
|
|
|
//::///////////////////////////////////////////////
|
|
//:: Name Door Auto-Close and Lock System
|
|
//:: FileName drcls
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: David Poole
|
|
//:: Created On: 8-3-04
|
|
//:://////////////////////////////////////////////
|
|
|
|
|
|
{
|
|
object oPC = GetLastUsedBy();
|
|
|
|
// remove the // in the line below if you want your doors to relock/
|
|
//ActionLockObject(OBJECT_SELF);
|
|
|
|
int iStealth = GetStealthMode(oPC);
|
|
if (iStealth == STEALTH_MODE_ACTIVATED)
|
|
{
|
|
SetActionMode(oPC,ACTION_MODE_STEALTH, FALSE) ;
|
|
}
|
|
|
|
{
|
|
//sets the target to me
|
|
object oDoor=OBJECT_SELF;
|
|
//closes me after 10 seconds
|
|
DelayCommand(1500.0, ActionCloseDoor(oDoor));
|
|
//locks me after 10.1 seconds
|
|
DelayCommand(1500.1, SetLocked(oDoor, TRUE));
|
|
}
|
|
|
|
|
|
|
|
} }}
|