Jump to content

Sowing new seed type


Nils

Recommended Posts

Sorry for the two threads at once but they aren't strictly related.

 

I'm adding some new plant/seed types in my mod. I've created the plant and the seeds. I'm able to insert both onto my character. I can eat the plant, make recipes with it. All that works. The only problem I'm having is that I don't know how to get the Sow Seed menu to recognize my new plant types. I'm also not sure how to tell it what art to use when planted and during the growth cycles.

 

Any help is appreciated.

Link to comment
Share on other sites

Sorry, looks like I spoke too soon. You definitely have me in the right direction, vitaminlost, so thanks, but now after creating a new entry all of the entries on the Sow Seed are gone, presumably because I crashed the entire farming menu.

 

Stack Trace reads:

 

function: doFarmingMenu -- file: ISFarmingMenu.lua line #117 (where my new entry is)

attempted index: seedsRequired of non-table: null

 

I assume the problem is I didn't specify how many seeds my new plant takes but I didn't see the option to specify it elsewhere in the script. (Although I did see and add to the haveSeed function).

 

Edit: Found the farming_vegetableconf file. Looks like I need to add entries here too? Dabbling now.

Link to comment
Share on other sites

vitaminlost, you've been such a great help! Unfortunately I'm not 100% there.

 

The menu is fixed and I can plant! Unfortunately the plant has no image. I used the tomato images for defaults. The tomato icon shows up when I get Info on the plant, but the plant itself is invisible.

Link to comment
Share on other sites

Thanks again for all of your help, vitaminlost. I'm not sure how I missed the growPlant function, but I found it thanks to you. (Although mine sits at line 307 and the getText seems to be replaced with a string. Maybe we're on different builds?)

 

In any case, the plant is now visible!

 

But!

 

Now the info panel, which was working before, is broken. The tomato icon still appears, but all of the text is missing and I get a stack trace:

function: render -- file: ISFarmingInfo.lua line #58Object tried to call nil in render

I've checked the ISFarmingInfo but I don't see any new definitions that need to be made in there.

 

After double checking the other files to make sure I didn't have a simple typo or missing something else obvious but without actually changing anything I reloaded and got a new stack trace when checking the info panel:

function: createChildren -- file: ISFarmingWindow.lua line #27

Obviously I've still missed something. Help me vitaminlost, you're my only hope! 

Link to comment
Share on other sites

Looks like my problem has evolved again. There was a small update today (~200k) that changed my problem. Before, I was getting an info panel with an icon but no text. Now, when I click on info, no window appears at all.

post-10799-0-84678200-1395556413_thumb.j

Link to comment
Share on other sites

I'm running build 25 so that's at least a little bit of the problem.

 

vitaminlost, I would love it if you could fix my scripts for me, but I would love it more if you could tell me what I'm missing so I can fix it myself in the future. You know, teach a man to fish and all that.

 

Here's a zip of what I have so far:

Edit: files old, link removed.

Link to comment
Share on other sites

Oh...build25...

it will not work in my PC.

guessed the process.

 

 -------------------------------------

game start up

default file read

your MOD file read
         default ISFarmingMenu file  >>  overwrite  >>  your MOD ISFarmingMenu file(+cannabis's category)
         *you can sowing cannabis seed

but
default basicFarming file(non cannabis's category)
                          &                                                              

default farming_vegetableconf file(non cannabis's category)

 

so

non table null  >>  broken info

 

---------------------------------------

I...think so

you should add the code in your MOD folder.

your MOD basicFarming file(+cannabis's category)

                          &

your MOD farming_vegetableconf file(+cannabis's category)

Link to comment
Share on other sites

For guessing the process, you've done a great job.

 

I actually do have the basicFarming and farming_vegetableconf file included in the mod, but they're in the server  folder, not the client, because they got moved over in build 25. Just to try it, I put all three files in the client folder, but I'm still getting errors.

 

When I get a chance I'll switch to an older build and see if that's my problem.

 

Thanks again for all your help.

post-10799-0-04072200-1395680404_thumb.j

Link to comment
Share on other sites

I'm sorry but I guess I missed your point.
I found your FARMING MOD( basicfariming &farming_vegetableconf file)

build25 plants data seems to be manage by ISPlant file.
and Management of object has a new.
 
 
If you want to test for the time being.
ISFarminginfo file
	-- title of the plant    if false and isClient() then        self:drawTextCentre(self.plant.typeOfSeed, 120, 25, title_rgb["r"], title_rgb["g"], title_rgb["b"], 1, UIFont.Normal);    else        if self.plant:getObject() then            self:drawTextCentre(self.plant:getObject():getObjectName(), 120, 25, title_rgb["r"], title_rgb["g"], title_rgb["b"], 1, UIFont.Normal);        else            self:drawTextCentre("Dead " .. self.plant.typeOfSeed, 120, 25, title_rgb["r"], title_rgb["g"], title_rgb["b"], 1, UIFont.Normal);        end    end

I think the need for modification of this part.

Link to comment
Share on other sites

Well, vitaminlost, it looks like you were basically right this whole time. I think my problem was using outdated lua files. I started over, copying the latest lua files from build 25c, and then going in and adding new plant entries whenever I saw them. You already pointed them out but for the sake of putting it in one place, those files are:

 

client/Farming/ISUI/ISFarmingMenu.lua

server/Farming/basicFarming.lua

server/Farming/farming_vegetableconf.lua

shared/Translate/EN/Farming_EN.txt

 

Loaded the mod up and everything works great. I can plant, water, see info. No errors! Now, as soon as we can add plant textures, my mod will be complete. Thank you again for answering all of my questions!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...