Stratics - The Massively Multiplayer Network
Stratics Network   Stratics Community   Stratics Central     
 
 
Spawning Treasure Chests

Created by Palor and is referred to in the NWN Spawn System documentation.

For additional information refer to the "UO Style Spawn System v2.1 - Spawning Treasure Chests" thread on the Builders - NWN Scripting forum.

Ok, this is a bit tricky if you never done it before, but has nothing to do with my code.

Create a new custom placeable and name it something like:

	treasure_low_01

That way its Tag and Blueprint will be "treasure_low_01".

Change the Name after it is created to something like "a treasure chest". Change the appearance of it to a chest You should now have the following:

	Name: a treasure chest
	Tag: treasure_low_01
	Blueprint: treasure_low_01

Edit it and set it to Useable and Has Inventory. Also set it to Plot if you don't want anyone to destroy it.

Change the OnOpen script to:

	#include "NW_O2_CONINCLUDE"
	void main()
	{
	if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)
    	{
       	     return;
    	}
    	object oLastOpener = GetLastOpener();
    	GenerateLowTreasure(oLastOpener, OBJECT_SELF);
    	SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
    	ShoutDisturbed();
	}

Now change its OnClose script to:

	void main()
	{
    		DestroyObject(OBJECT_SELF,0.0);
	}

Place a Waypoint and change its info to:

	Name: SP_TR_TM10
	Tag: treasure_low_01

Log in and check. You should have a treasure chest at the spawn point you specified. Open it and close it and it should go away and spawn a new one in 10 seconds.

It uses all of the same switches as a normal creature spawn point, just make sure to put TR in the name, otherwise you will have badgers. :)




This site best viewed in Internet Explorer.
 
©2002, Stratics. All rights reserved.
Maintained by: Neverwinter Nights Stratics Staff
Last modified: June 22 2002