View Full Version : Harvestable Grapes don't properly Harvest

7th Oct 2008, 8:40 AM
Hello, I've been working on a small addition to Echo's harvestable crops, adding the option to harvest for produce that would go to the harvesting sim's inventory. I've been talking with Echo about my progress (problems!) and she asked me to post the object and error log. I added the harvest basket too, just in case.

If anyone else want's to help, here's the problem: I have two BHAVs, one that is my own written from scratch, and the other based on Echo's original 'interaction - harvest'. 'Harvest one for produce - old' is mine. It harvests, adds grapes to the sim's inventory and resets the plant, but it leaves the plant 'in use', making any future harvesting unavailable. 'Harvest for produce' is the the one I based on Echo's BHAV. (This is what the pie menu points to right now.) It was doing the same thing as mine until I took out what I thought might be an un-needed line (0x7). Then it stoped being 'in use' after harvest, but it didn't lose the option to harvest like it's supposed to. But when I added a line near the end that tells the object to not be harvestable anymore (0xF) the interaction errors out. I think this is happening because the StackObject in the all the lines involved with creating a new object instance and adding to the using sim's inventory is different than the StackObject that is suppose to become not-harvestable, and there's nothing in there saying the StackObject ID has changed, but I don't know how to fix it.
If this one can get fixed, then I'm not concerned about my first BHAV, although it would be interesting to know why it's causing the object to be perpetually in use.

Thanks in advance for any help. :)

9th Oct 2008, 11:31 AM
Okay, I'm looking at the "Interaction - Harvest One forProduce - old", since that's smaller. ;) Your line 3 looks wrong - you're doing a test (==), not an assignment (:=), so this line either does nothing (if the plant has no water reserves) or exits (if the plant has been watered). What were you intending for that line to do?

As for how to take the plant out of "in use", that's a bit odd, since you're never actually setting the tree as in use in the first place. What you need to do is find a point where the Stack Object is the tree (eg, directly after the call to "Event - Harvest") and put in the following:
Expression (Stack Object's attribute 0x0002 ("Ready to Harvest?") := Literal 0x0000)
(the opcodes for that are 02000000000501070000000000000000 if you want to copy/paste). :)

Let me know how that goes?

10th Oct 2008, 11:57 AM
Awesome, that did it! Thanks for looking at it. :) I actually tried that before, but I was leaving in that rogue attribute assignment line and it just caused an error. This time I just ditched that line straight away and it works like a charm. :D

The tutorial I followed is Here (http://home.comcast.net/~lemora/sims2/tutorial1.html), by Carrigon. (It's quite old, and I never managed to get the updated-for-Pets/Seasons version since Dinnerbell is no more, but it's the only one I've found dealing with summoning objects, and it has been sufficient for the things I've wanted to do so far.) That line is meant to be deciding whether to put the item on the floor or in the sim's inventory. I only used it because I've always been using it--with return true and false both pointing to the same next line--and I had forgotten what it was actually there for. :rolleyes:

Now, when I add 'sub - find next plant' at the end of that string, is that object id going to carry over into the next BHAV and cause that not to work? It doesn't work, and I'm wondering if that's why. I will continue hashing it out on my own though, and thank you so much for the help. :)

11th Oct 2008, 11:00 AM
By the end of your BHAV, your Stack Object ID will have changed to the object you have created (because Create New Object Instance creates it then sets the Stack Object to point to the new object). If you call "find next plant" at that point, it will start searching from the SO of the new object, rather than the original plant. (Which will probably confuse it)...