Author Sticky: Post Working Scripts Here
sTuPiD fOoL Posted: Wednesday, 17 July 04:31AM
Script Name: Plot Item Respawner

What it does: placed in the OnOpen slot of a container, this script makes a check to see if an item is in the inventory of a player, and if not, creates it in the container that was opened. This would be a way to make sure plot items, keys, ph4t l3wtz, etc are always there for your players.

Notes: Replace oTag with the tag of the item you want to be in the container.

The Script:

NWScript:
//If item is not in the user's inventory, it creates the item in the container.

//Used basically for respawning plot items in containers.

void main()

{

  if(!GetIsObjectValid(GetItemPossessedBy(GetLastOpenedBy(), "oTag")))

   {

    CreateItemOnObject("oTag", OBJECT_SELF);

   }

}

* * * * *

I tried out my Plot Item RESpawner and it works... once. I can loot the ietm, but if i sell or drop the item (ie, it's no longer in my inventory) the container does not create me another one... I assume it's a problem with the game coding? it seem slike somehow it's setting a variable that i have indeed gotten that item before, adn not resseting that variable when i drop the item.

* * * * *

The plot item respawn works perfectly for me. Even if I sell or drop an item. (if i drop it, i can loot it again from the chest)

I went ahead and had it set a variable for each player that opens the chest so that they cant loot, drop, loot, drop, etc for unlimited items. Without the variable though, you can loot as many times as you want as long as the item isnt in your inventory.

* * * * *

ah, the plot item respawner - make the second instance of oTag be the item's blueprint, then it works for me.