[00:02:44] <wjp> you're overcomplicating things :-)
[00:03:14] <wjp> items_in_hand is the number of items the NPC is already holding
[00:03:22] <wjp> nearby is the number of items nearby
[00:03:44] <wjp> (7 + rand()%5) is how many items it (thinks it) wants
[00:03:54] <wjp> so nitems is the number of new items to create
[00:04:26] <wjp> if nitems is positive, it increments items_in_hand by that amount, and adds nitems new items in that loop
[00:05:01] <wjp> so if you want at most one item to be created, you can just do nitems = 1 - items_in_hand - nearby; (instead of the current line)
[00:09:47] <wjp> does that explain things? It's about bedtime for me, so I'll be leaving soon
[00:15:49] <wjp> (oh, and to answer your actual question: adding that check to the first if, just makes it add items when it has none. But it will still create 7 to 12 of them)
[02:43:02] --- DominusExult is now known as Dominus
[07:38:01] <Dominus> thanks wjp, understand now
[07:38:21] <Dominus> http://pastie.org/9724546 <- too much comment?+
[09:35:40] <wjp> nah, is fine
[10:56:16] <Dominus> ok, done for now
[10:58:00] <Dominus> thanks for the much needed help :=
[10:58:02] <Dominus> :)
[11:01:36] <wjp> no problem; thanks for investigating
[18:36:21] --- amatecha_ is now known as amatecha