This is an generic, flexible foraging system that is backwards compatible with wyrin's foraging system (http://nwvault.ign.com/View.php?view=NWN2Scripts.Detail&id=225). It uses the same script name, so it can be retrofit to any module that uses his system with no additional work, or used as an override by a player. I haven't tested PW use, as I don't develop for one.
Differences:
Allows customization of rewards (stack size supported), skills to check, skill dc, animations/sounds/messages to play. These are stored as local variables on the placeable. Partial success is allowed, with separate rewards and player messages. Skill checks are party-wide, not just the user of the placeable (not fully tested that bit yet).
Usage: In addition to the normal foraging of plants, you could "forage" a painting by checking appraise and or lore, discover a sword is heirloom quality with craft weapon, make the pc dance a jig on success, etc.
Support for wyrin's system:
Wyrin's system includes placeables, and these are treated as a special case, checked for by their tag. Wyrin's items all start their tag "forage_", so that's what's checked for (so don't tag your new forage-able placeable that way). Script includes both wyrin's original skill checks (item user's skills only), and party-wide skills checked, so you can pick what you prefer.
1/16/2013: put CreateItemOnObject into a while loop so it would correctly create more than one of a non-stackable object.
10 - A Masterpiece, Genuinely Groundbreaking 9 - Outstanding, a Must Have 8 - Excellent, Recommended to Anyone 7 - Very Good, Deserves a Look 6 - Good, Qualified Recommendation 5 - Fair, Solid yet Unremarkable 4 - Some Merit, Requires Improvements 3 - Poor Execution, Potential Unrealized 2 - Very Little Appeal 1 - Not Recommended to Anyone