DMH-Online

Dungeon Masters Helper · Est. 2005

Placeables Scripts

NWN Script: destroy_spawned_items_002.htm

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();
    }
}
⌂ All Scripts ← PreviousNext → 👁 Category List

All Placeables Scripts

📄 cast_haste 📄 check_fire 📄 chest_puzzle 📄 close_door 📄 close_door_002 📄 close_door_003 📄 close_door_004 📄 create_item_with_delay 📄 darklamp 📄 darklamp_002 📄 day_night_lights 📄 day_night_lights_002 📄 destroy_spawned_items 📄 destroy_spawned_items_002 📄 door_guard 📄 door_lock_item 📄 dragging_placeables 📄 encounter_on_open 📄 encounter_on_open_002 📄 fair_loot 📄 fire_burns 📄 guarded_chest 📄 kill_attacker 📄 kill_nearby 📄 lights_on_off 📄 linked_doors 📄 moveable_placeables 📄 multi_door 📄 open_doors 📄 poly_attacker 📄 polymorph_pc 📄 polymorph_pc_002 📄 random_teleport 📄 refil_chest 📄 refil_chest_002 📄 refil_chest_003 📄 refil_chest_004 📄 refil_chest_005 📄 refil_chest_006 📄 refil_chest_007 📄 remove_with_item 📄 respawner 📄 smart_doors 📄 spit_treasure 📄 talkable_placeables 📄 talking_door 📄 talking_sign 📄 talking_sign_002 📄 talking_sign_003 📄 talking_sign_004 📄 teleporting_chairs 📄 useable_bedroll 📄 useable_birdcage 📄 useable_cannon 📄 useable_catapult 📄 useable_chair 📄 useable_chair_002 📄 useable_chair_003 📄 useable_chair_004 📄 useable_couch 📄 useable_divining_pool 📄 useable_gong 📄 useable_kegs 📄 useable_kegs_002 📄 useable_placeables_002 📄 useable_sign 📄 useable_sign_002 📄 useable_sundial 📄 useable_sundial_002 📄 useable_sundial_003 📄 useable_sundial_004 📄 useable_sundial_005 📄 useable_sundial_006 📄 useable_training_dummy 📄 useable_training_dummy_002 📄 useable_training_dummy_003 📄 useable_training_dummy_004 📄 useable_trapdoor 📄 useable_trapdoor_002 📄 useable_trapdoor_003 📄 useable_trapdoor_004 📄 weapon_spawn_per_class 📄 worth