Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 16th Jun 2023 at 8:50 PM
Default How to add memory to object
I was wondering if there's a way to create a memory for when a Sim gets scared by the scarecrow.

I'm not sure how things like this are done. I have used DiLight's tutorial and made lots of custom memories before that are attached to the gold star (which is downloadable with the tutorial), but how can I add memories to an object and have them spontaneously appear after a certain interaction? Like being scared by the scarecrow.
Advertisement
Alchemist
#2 Old 18th Jun 2023 at 1:09 AM
Have you ever made a BHAV override? I want to get an idea of how much detail to go into in order to explain this.
Test Subject
Original Poster
#3 Old 18th Jun 2023 at 10:14 PM
I know about it and have read tutorials but I've never done it before. I'm new to this so all I've ever done is recoloured things and made custom memories.
Alchemist
#4 Old 19th Jun 2023 at 6:04 PM
To make things simpler, we're just going to use the files from DiLight's tutorial instead of writing code from scratch. Use DiLight's memory template to make a memory, the way you have in the past, but don't do the steps where you assign it to the star.

1. Open the Objects.package for your highest EP. Mansions and Gardens is considered an EP, so if you own it, use the objects.package for that pack.

2. In SimPE, go to the Filter Resources tab and paste "7FBEC4CD" into the "group" box, without the quotes. Click the first blue "set" button.That pulls up all the resources for the scarecrow.

3. In the Resource Tree, Click Behavior Functions (BHAV)

4. In the Resource List, Right click the BHAV called "Sub - Scare" then choose "extract" from the pop up menu. Leave the name alone and save it somewhere on your computer.

5. Take a look at the Instances in the Resource List. You can see that the scarecrow is using instances 1000 - 1008. That will be important later.

6. You're finished with the objects.package. Click on "file > new" to get a new empty SimPE window.

7. Right click somewhere in the Resource List, then click Add. Find the file you extracted in Step 4 and choose it, then save your new package.

8. Open DiLight's Object Picked Memory manager and extract the BHAV called "Add Memory Template" using the same process from Step 4. Then close that package.

9. Go back to the package you created in Step 7. Add the BHAV you extracted in Step 8 to this package. Save the package. The new BHAV might not show up immediately, but if you close the package and reopen it, it should be there.

10. We're still working with the new package made in Step 7. Click on "Add Memory Template." At the bottom of SimPe, click the "Resource" Tab. Change the group from 0xFFFFFFFF to 0x7FBEC4CD, which is the same group as the other Scarecrow resources.

11. In Step 5, we saw that the Scarecrow currently used BHAV instances 1000 - 1008. We need an unused instance for the new BHAV. So we'll change the "Add Memory Template" to the next free instance, which is 1009. Commit the changes.

Note that these are hex values, so if we were to add an additional new BHAV after using instance 1009, it would get instance 100A, not 1010.

12. Look for Plugin View at the bottom of SimPE and click it. Go to Line 1 in the code. Put the GUID from the new memory you created using the template into the operand box, the same way you did when using DiLight's tutorial.

13. Click on the Sub - Scare BHAV. Look for line 8, which is the end of the code, and click it.

14. Make sure the "special buttons" box is clicked on the right hand side of the screen. Click the ins/true button. Now line 9 will be highlighted. Go back up to line 8. Click the button in the Operands Section that looks like an X.

15. Delete the numbers in the OpCode box and put in the Instance of the "Add Memory Template" BHAV, which is 1009.

16. Change the "False Target" to 9, just like the True target, so that even if the code to add a memory fails for some reason, the scarecrow will still get properly reset. Commit.

I've attached a file that makes the scarecrow scare the Sim 100% of the time. You can use it to check your work and make sure they get the memory when they're scared, instead of having to make a Sim view the scarecrow over and over again until you trigger the scare interaction. Once you know your code works, then you can delete my file.
Attached files:
File Type: zip  scarecrow-always-scary.zip (409 Bytes, 2 downloads)
Test Subject
Original Poster
#5 Old 19th Jun 2023 at 7:48 PM
Wow thank you so much for such a detailed explanation. I will try it tonight. I have read through what you've said and you've explained it so well, I think I can do it. Thanks for the scarecrow too, that will be a lot quicker than clicking 'view scarecrow' over and over 🙂
Alchemist
#6 Old 19th Jun 2023 at 9:40 PM
Good luck with your project. Let me know how it goes.
Test Subject
Original Poster
#7 Old 19th Jun 2023 at 9:51 PM
I tried it and followed all the steps, but sadly it's not generating the memory. I can't see what I've done wrong but I'll keep looking through everything as I'm sure I'll have done something wrong and haven't realised.

The only thing I can think of is the part where I was a little unsure, the bit at the end where you talked about the 'false target' the only options I could see was 'return false' , 'error' and 'return true' so I went with 'return true' to make it the same as the true target which is 9, is that what I should have done? I'm not sure if that's the problem, I think it must be to do with the part where I added the memory GUID maybe.
Alchemist
#8 Old 19th Jun 2023 at 10:58 PM
Line 8 [private 0x1009] Add Memory - Template (no args)'s true target box should say 0x0009 and the false target box should also say 0x0009.

Don't edit anything in line 9's boxes. If you already have, the true target box's value should be True, and the False target box's value should be error.

You can also post the package, and I'll take a look if you can't figure it out.
Test Subject
Original Poster
#9 Old 20th Jun 2023 at 12:37 AM
I checked the lines and they all seem to be right, I think. I made sure line 9 has the right box values but it still doesn't seem to be working. I've attached the memory file and the Scarecrow scare file. By the way I tried renaming the CT-add memory filename to that of the memory filename to see if that helped but it didn't, I don't know if I should have done that or not. Anyway if you could take a look that would would be great, thank you very much for all of your help.
Attached files:
File Type: rar  scarecrowmemory.rar (3.0 KB, 4 downloads)
Alchemist
#10 Old 20th Jun 2023 at 1:36 AM
In Step 4, you're supposed to extract the BHAV called Sub - Scare, but you extracted the one called Sub - Do Scare.

The way you coded everything looks good though, so once you're editing the right BHAV, I think you'll be okay. You can just right click and delete Sub - Do Scare, then add the correct one into the package.
Test Subject
Original Poster
#11 Old 20th Jun 2023 at 2:20 AM
Ah thank you, I had I feeling I made a careless mistake haha. I'll sort that out and hopefully it will work 🙂
Test Subject
Original Poster
#12 Old 20th Jun 2023 at 5:30 PM
Yay! I'm so happy, I got it to work 😀 going on how you've explained it, I think I can now figure out how to do similar things with other objects, so thank you so much!
Alchemist
#13 Old 20th Jun 2023 at 7:53 PM
Good! I was hoping I explained the process thoroughly enough that you'd be able to apply it to other projects, so I'm glad that is the case.
Test Subject
Original Poster
#14 Old 21st Jun 2023 at 2:38 AM
Yes, it's been very useful. I've just added a memory to the womrat cage so that when a Sim stocks it, they get a memory saying they obtained a new womrat. I've got lots of other ideas in mind that I can finally do now 🙂
Back to top