I made this script from an old script I had, and it compiles with no problems, but when I add one in the game and the server restarts I get the following error. I hope this is an easy fix because I actually made that box have pages, (the one I started with did not) and I figured out how to put in a background. I was proud until this error popped up. :-(
Post automatically merged:

Can someone tell me how to fix this please?
 

Attachments

  • seedboxerror.png
    seedboxerror.png
    41.4 KB · Views: 21
  • FarmersSeedBox.cs
    221.3 KB · Views: 16
On Line 1705: change the 0 to a 2
This reflects the case numbers that come after your Serialize method on Lines: 1816 and 1818
Post automatically merged:

if 2 crashes the server then change it to 1.... but I think you need the 2... either way one of these resolutions should work.
 
you try to read 103 lines, you write 101

so you try to read
m_SweetPotatoSeed = reader.ReadInt();
m_MiniCoffeeSeed = reader.ReadInt();

but you never saved them in the first place
Post automatically merged:

Also I think for the next step you should also look into Dictionarys in this case you kind of could go the route of Dictionary<Type, int> for example and possibly in combination with a private static HashSet<Type> to make a list of all the Items you want to be able to be stored.

So the Dictionary would contain all the values for each Type, while the HashSet would be the List of Types that would be storable
 
Last edited:
Thank you both for your input, I changed line 1705 to a 1 as the 2 didn't work. I also added the sweet potato and coffee to the write and it worked great. Thank you thank you thank you. Pyro, the only way I can make scripts is if I find an old one that is kinda what I want then I can muddle through changing it. That's why this was a HUGE project for me, this seed box. While I understand the dictionary thing and think that would definitely be better, I have no idea how to go about doing that. :) I have to figure out now why it says my chili pepper seed won't work, I used the yellow pepper seed to make the chili pepper seed and it works. I'm kerfuffled. Onward and Upward, I really appreciate the help you two gave me!! Thanks again.
 
Back