| Author: | Molerium |
| Author Website/Email: | jj_hyland@hotmail.com |
| Script Name: | Destroy Treasure Script |
| Description: | This small script can be placed in the OnDestroy event of any container. If a player bashes the container open there is a 1 in 4 chance that breakable items will be destroyed. |
| Instructions on Use: | Place this script in the onDestroy event of a container. |
Script 1 (OnDestroy):
| //:://///////////////////////////////////////////// //:: Destroy Treasure script ns_destroy_treasure //::////////////////////////////////////////////// /* This script destroys breakable items stored in containers if the PC breaks open the container */ //::////////////////////////////////////////////// //:: Created By: Molerium jj_hyland@hotmail.com //:: Created On: July 01 2002 //:: Version : 1.0 //:: if you come up with any improvents to this //:: script please let me know. //::////////////////////////////////////////////// #include "NW_O2_CONINCLUDE" void main() { int random = d4(); int iItemType; object oTreasure; oTreasure = GetNextItemInInventory(); while(GetIsObjectValid(oTreasure)) { iItemType = GetBaseItemType(oTreasure); if(random == 1) { switch(iItemType) { case BASE_ITEM_POTIONS: DestroyObject(oTreasure); //eventually replace with destroyed versions break; case BASE_ITEM_SPELLSCROLL: DestroyObject(oTreasure); //eventually replace with destroyed versions break; case BASE_ITEM_MAGICWAND: DestroyObject(oTreasure); //eventually replace with destroyed versions break; } } oTreasure = GetNextItemInInventory(); } } |