Jump to content

ModdableFarming


cecilkorik

Recommended Posts

That looks like something is wrong in a different mod (it mentions crafthelper), or possibly in your PZ installation itself. I'd recommend disabling all other mods and see if farming works okay. If that doesn't fix it, use Steam's "Verify Integrity of Game Cache" option or at worst simply reinstall PZ.

 

Are you using build31 or IWBUMS?

Link to comment
Share on other sites

That looks like something is wrong in a different mod (it mentions crafthelper), or possibly in your PZ installation itself. I'd recommend disabling all other mods and see if farming works okay. If that doesn't fix it, use Steam's "Verify Integrity of Game Cache" option or at worst simply reinstall PZ.

Are you using build31 or IWBUMS?

I'm thinking the same thing. I'll reinstall PZ to see how it changes.
Link to comment
Share on other sites

That looks like something is wrong in a different mod (it mentions crafthelper), or possibly in your PZ installation itself. I'd recommend disabling all other mods and see if farming works okay. If that doesn't fix it, use Steam's "Verify Integrity of Game Cache" option or at worst simply reinstall PZ.

Are you using build31 or IWBUMS?

I have reinstalled the game and tried the mod twice. Once with my own codes,another with the eggplant example. In both trials,I cannot plant any seed to the ground.....
Link to comment
Share on other sites

That looks like something is wrong in a different mod (it mentions crafthelper), or possibly in your PZ installation itself. I'd recommend disabling all other mods and see if farming works okay. If that doesn't fix it, use Steam's "Verify Integrity of Game Cache" option or at worst simply reinstall PZ.

Are you using build31 or IWBUMS?

Just tried the third time. In this time I didn't activate any mod (including moddable farming). The result is:I can plant seeds (strawberry and cabbage)in a clean build 31.10.
Link to comment
Share on other sites

I assume you're still seeing Stack Traces in your logfile. Those aren't good and usually can show what is wrong, unfortunately if there's a lot of them there's no easy way to tell which ones are important and which ones aren't. If you can find some way to send me your whole console.txt I might be able to figure out what's going on.

 

All I know is that it's working fine for me now, but obviously that's just one person... The whole point is to make sure it works for everybody!

Link to comment
Share on other sites

I assume you're still seeing Stack Traces in your logfile. Those aren't good and usually can show what is wrong, unfortunately if there's a lot of them there's no easy way to tell which ones are important and which ones aren't. If you can find some way to send me your whole console.txt I might be able to figure out what's going on.

 

All I know is that it's working fine for me now, but obviously that's just one person... The whole point is to make sure it works for everybody!

Problem solved.

I can plant seeds now. Thanks.

I'll try to test other features, like setting minimal water level to zero.

Link to comment
Share on other sites

 

 

Examples

 

Here is my example, an "Eggplant" in case you have an insatiable need for cooking up some Eggplant Parm in the middle of the apocalypse.

require "Farming/farming_vegetableconf"-- growPhases values:--   -2 = in bloom (not harvestable)--   -1 = seedling--   0 = growing--   1 = harvestable vegetable--   2 = harvestable vegetable + seeds--   3 = seeds only--   4 = in bloom (with harvestable vegetable)local props = farming_vegetableconf.props;local sprite_dead = farming_vegetableconf.sprite_dead;local sprite_growing = farming_vegetableconf.sprite_growing;local icons = farming_vegetableconf.icons;props["Eggplant"] = {};props["Eggplant"].regrowResetTo = nil; --reset plant to earlier growPhase when harvesting, instead of destroying plant after harvestprops["Eggplant"].seedsRequired = 1; --number of seeds required to plantprops["Eggplant"].waterLvl = 65; --minimum water required, only used for display purposes nowprops["Eggplant"].waterMins = {85, 65, 65, 65, 65, 65, 65};props["Eggplant"].waterMaxes = {nil, nil, nil, nil, nil, nil, nil};props["Eggplant"].timeToGrowMin = 8; --in daysprops["Eggplant"].timeToGrowMax = 8; --in daysprops["Eggplant"].minVeg = 3; --number harvestedprops["Eggplant"].maxVeg = 4; --number harvestedprops["Eggplant"].minVegAutorized = 5; --harvest at max skill?props["Eggplant"].maxVegAutorized = 9; --harvest at max skill?props["Eggplant"].vegetableName = "Base.Eggplant"; --this is the ID of the vegetable it provides when harvestedprops["Eggplant"].seedName = "ExampleEggplant.EggplantSeed"; --this is the ID of the seed it provides when harvested (prefix required)props["Eggplant"].seedTypeName = "EggplantSeed"; --this is the ID of the seed used to grow it (no prefix)props["Eggplant"].seedPackTypeName = nil; --leave this nil for now, I have future plans for itprops["Eggplant"].seedPackSize = 50; --unused due to nil seedpackprops["Eggplant"].seedPerVeg = 2; --seeds received when harvestingprops["Eggplant"].maxGrow = 7; --number of growing phasesprops["Eggplant"].growPhases = {-1, -1, 0, 0, 0, 1, 2};

There maybe some mistake in the explanation of your example.

Take my flax for example.

require "Farming/farming_vegetableconf"
 
-- growPhases values:
--   -2 = in bloom (not harvestable)
--   -1 = seedling
--   0 = growing
--   1 = harvestable vegetable
--   2 = harvestable vegetable + seeds
--   3 = seeds only
--   4 = in bloom (with harvestable vegetable)
 
local props = farming_vegetableconf.props;
local sprite_dead = farming_vegetableconf.sprite_dead;
local sprite_growing = farming_vegetableconf.sprite_growing;
local icons = farming_vegetableconf.icons;
 
props["Flax"] = {};
props["Flax"].regrowResetTo = nil; --reset plant to earlier growPhase when harvesting, instead of destroying plant after harvest
props["Flax"].seedsRequired = 1; --number of seeds required to plant
props["Flax"].waterLvl = 65; --minimum water required, only used for display purposes now
props["Flax"].waterMins = {85, 65, 65, 65, 65, 65, 65};
props["Flax"].waterMaxes = {nil, nil, nil, nil, nil, nil, nil};
props["Flax"].timeToGrowMin = 7; --in days
props["Flax"].timeToGrowMax = 8; --in days
props["Flax"].minVeg = 3; --number harvested
props["Flax"].maxVeg = 4; --number harvested
props["Flax"].minVegAutorized = 5; --harvest at max skill?
props["Flax"].maxVegAutorized = 9; --harvest at max skill?
props["Flax"].vegetableName = "AgricultureAdvanced.Flax"; --this is the ID of the vegetable it provides when harvested
props["Flax"].seedName = "AgricultureAdvanced.FlaxSeed"; --this is the ID of the seed it provides when harvested (prefix required)
props["Flax"].seedTypeName = "FlaxSeed"; --this is the ID of the seed used to grow it (no prefix)
props["Flax"].seedPackTypeName = nil; --leave this nil for now, I have future plans for it
props["Flax"].seedPackSize = 50; --unused due to nil seedpack
props["Flax"].seedPerVeg = 2; --seeds received when harvesting
props["Flax"].maxGrow = 7; --number of growing phases
props["Flax"].growPhases = {-1, -1, 0, 0, 0, 1, 2};
props["Flax"].plantName = "Flax"; --displayed name (no translations)
 
:oops:
 
props["Flax"].timeToGrowMin = 7; --in days
props["Flax"].timeToGrowMax = 8; --in days
 
The time to grow figure may be not count in days. In my test, I harvest twice in the same area grid within 4 days. So, it maybe not calculate as 7 days.
 
:oops:
 
props["Flax"].minVeg = 3; --number harvested
props["Flax"].maxVeg = 4; --number harvested
 
In my test, I can collect 5 flax for one single harvest. It looks like one more than the max number I can harvest in the code, which is 4. Is this due to some influence of the level one farming skill?
 
:oops:
 
BTW, the textures didn't show up. 
sprite_growing["Flax"] = {
"tileThuztorFarming1_seededRedRadish",
"vegetation_farming_01_17",
"vegetation_farming_01_19",
"vegetation_farming_01_38",
"vegetation_farming_01_38",
"vegetation_farming_01_44",
"vegetation_farm_01_1"
}

 

There is only "tileThuztorFarming1_seededRedRadish"  texture showed up for the whole time until harvest (both veg and seeds).

Link to comment
Share on other sites

I assume you're still seeing Stack Traces in your logfile. Those aren't good and usually can show what is wrong, unfortunately if there's a lot of them there's no easy way to tell which ones are important and which ones aren't. If you can find some way to send me your whole console.txt I might be able to figure out what's going on.

 

All I know is that it's working fine for me now, but obviously that's just one person... The whole point is to make sure it works for everybody!

Just tried again.

The original PZ plants also have the same problem of not changing sprites. I tried broccoli for about 25 days in game; and its sprites remain the same as seedling sprites for the whole time.

Are you still updating the mod?

Link to comment
Share on other sites

It seems to be just a sprite-related issue... the plants *work* fine. You can still harvest them etc if you keep an eye on their info windows, but obviously we need to get the sprites working.

 

I am trying to figure out why they're not updating but sprites very much confuse me (like I said I am not an artist, at all!)

 

One thing I have discovered in my experiments is that the "time to grow" value is not actually in days... it is in hours, however, it represents the "time to grow" from one phase to the next, and there are 7 total growing phases, so the actual time to grow is 7 times the number of hours. I will clarify this in my instructions.

 

I am of course still working on the mod -- in fact I have many ideas for things I plan to add in the future already, but testing takes time and work has been keeping me busy. Thanks for your continued interest!

Link to comment
Share on other sites

It seems to be just a sprite-related issue... the plants *work* fine. You can still harvest them etc if you keep an eye on their info windows, but obviously we need to get the sprites working.

I am trying to figure out why they're not updating but sprites very much confuse me (like I said I am not an artist, at all!)

One thing I have discovered in my experiments is that the "time to grow" value is not actually in days... it is in hours, however, it represents the "time to grow" from one phase to the next, and there are 7 total growing phases, so the actual time to grow is 7 times the number of hours. I will clarify this in my instructions.

I am of course still working on the mod -- in fact I have many ideas for things I plan to add in the future already, but testing takes time and work has been keeping me busy. Thanks for your continued interest!

Well,I used the PZ original tiles as the sprites of the flax. Besides,the PZ original plants have the same problem,too. So I think it is not an issue about art or the format of the sprites.

Maybe some collisions between the codes used to activate the sprites?

BTW,in the PZ original farming lua file,they used two sets of sprites for each plant. I don't know why. Is that cause the sprites problem in moddable farming?

Link to comment
Share on other sites

Well I think the time to grow (ttg)figure is not counted as hours. I set the minimum ttg for the flax at 7 for testing. It turns out I harvest it after 4 days. So I think the actual number of days to grow maybe a sum of ttg,water level and disease level.

Link to comment
Share on other sites

For the sprites: Please download the new version 0.2 I just put up, it should fix the sprites and a few other problems!

 

For ttg: I think you're right that water and disease do have an effect. Possibly skill level and randomness may change the actual growth time as well.

 

However I am very confident that time to grow is set in hours, not days. It is used as the minimum time, and then disease or lack of water can make it grow slower that normal.

 

In your example, 7 hours times 7 growth stages = 7 x 7 = 49 hours of growth from seedling to fully mature. Slightly over 2 days. The additional 2 days you required before harvest on your plant were likely added by the water or disease functions. A perfectly watered, perfectly healthy plant should have been ready to harvest after 2 days and 1 hour, based on a ttg of 7.

 

It is easier to see this by setting ttg to 1, since the plant will grow fully in only 7 hours (1 hour per phase) it doesn't have much time to get any disease or get unhealthy. You have to be really quick on giving it water first though, or else it will wilt almost instantly because it grows to the second phase so fast.

Link to comment
Share on other sites

For the sprites: Please download the new version 0.2 I just put up, it should fix the sprites and a few other problems!

 

For ttg: I think you're right that water and disease do have an effect. Possibly skill level and randomness may change the actual growth time as well.

 

However I am very confident that time to grow is set in hours, not days. It is used as the minimum time, and then disease or lack of water can make it grow slower that normal.

 

In your example, 7 hours times 7 growth stages = 7 x 7 = 49 hours of growth from seedling to fully mature. Slightly over 2 days. The additional 2 days you required before harvest on your plant were likely added by the water or disease functions. A perfectly watered, perfectly healthy plant should have been ready to harvest after 2 days and 1 hour, based on a ttg of 7.

 

It is easier to see this by setting ttg to 1, since the plant will grow fully in only 7 hours (1 hour per phase) it doesn't have much time to get any disease or get unhealthy. You have to be really quick on giving it water first though, or else it will wilt almost instantly because it grows to the second phase so fast.

Just tested with flax seed and tomato seed. the sprites of tomato looks fine to me. The sprites of Flax are not fine. But it probably just showed me that I can not type "XXXX.png" as sprites' name in the lua file; or I need to packed and activate self made png photoes first.

Link to comment
Share on other sites

But it probably just showed me that I can not type "XXXX.png" as sprites' name in the lua file; or I need to packed and activate self made png photoes first.

 

 

Yeah that's quite possible... I am kind of a noob at sprites, like I said. All I know about it, is that it calls: getTexture(spritename-you-provide) to find the image. It's possible this function only looks in texture packs, I'm not clear on how it works precisely.

 

I also am trying to figure out how to add custom sprites right now myself, I will let you know if I figure out how to do it.

Link to comment
Share on other sites

But it probably just showed me that I can not type "XXXX.png" as sprites' name in the lua file; or I need to packed and activate self made png photoes first.

Yeah that's quite possible... I am kind of a noob at sprites, like I said. All I know about it, is that it calls: getTexture(spritename-you-provide) to find the image. It's possible this function only looks in texture packs, I'm not clear on how it works precisely.

I also am trying to figure out how to add custom sprites right now myself, I will let you know if I figure out how to do it.

Eh....there is a problem met by one of my friends. He found that there might be a limit on the number of custom seeds' types. The number is 5,from his test result. The sixth one won't show up. He cannot get the sixth kind of custom seeds from any container or crafting.
Link to comment
Share on other sites

 

Eh....there is a problem met by one of my friends. He found that there might be a limit on the number of custom seeds' types. The number is 5,from his test result. The sixth one won't show up. He cannot get the sixth kind of custom seeds from any container or crafting.

 

 

That's probably something wrong either with his save game, or with his mod, or with how is mod is setting up the distributions tables. It is possible there is a typo or something somewhere in that sixth seed that makes it not show up.

 

I have added 17 custom seeds to the item list and to the distributions tables in my mod and it's working fine for me. All 17 of the new seeds are available in my game, no problems at all. They all come in bags, and they can be planted and grow.

 

Is he making sure to start a new game when he is looking for the #6th seed he has added? The distribution only happens when you create a new game, or when you move to a new area. If you add new seeds to an existing game, they will not start to show up until you move a looong way away from anywhere you've already been, as far as I can tell.

Link to comment
Share on other sites

 

 

Eh....there is a problem met by one of my friends. He found that there might be a limit on the number of custom seeds' types. The number is 5,from his test result. The sixth one won't show up. He cannot get the sixth kind of custom seeds from any container or crafting.

 

 

That's probably something wrong either with his save game, or with his mod, or with how is mod is setting up the distributions tables. It is possible there is a typo or something somewhere in that sixth seed that makes it not show up.

 

I have added 17 custom seeds to the item list and to the distributions tables in my mod and it's working fine for me. All 17 of the new seeds are available in my game, no problems at all. They all come in bags, and they can be planted and grow.

 

Is he making sure to start a new game when he is looking for the #6th seed he has added? The distribution only happens when you create a new game, or when you move to a new area. If you add new seeds to an existing game, they will not start to show up until you move a looong way away from anywhere you've already been, as far as I can tell.

Well, we figure that out with our code master  :evil: . It's probably a problem of his computer's internal memory distribution.

Link to comment
Share on other sites

 

But it probably just showed me that I can not type "XXXX.png" as sprites' name in the lua file; or I need to packed and activate self made png photoes first.

 

 

Yeah that's quite possible... I am kind of a noob at sprites, like I said. All I know about it, is that it calls: getTexture(spritename-you-provide) to find the image. It's possible this function only looks in texture packs, I'm not clear on how it works precisely.

 

I also am trying to figure out how to add custom sprites right now myself, I will let you know if I figure out how to do it.

 

I have successfully added new sprites into moddable farming.

It just need to follow the procedures provided by Suomiboi:

 

how to do a tile definition file (.tiles)
1. In tilezed, go to tools -> tile properties
2. From the pop up File -> New (name the file. I use TILESETTEST)
3. Click on the blue + sign in the top middle of the pop up window
4. Choose the tilesets you want to add/define
5. Once chosen, specify each tile by clicking on it and changing the parameters on the right side of the screen accordingly. Ie. enable IsFloor and disable IsIndoor if your making a floor tile that's outside.
6. Save
7. Close the window
 
how to do a packed texture file (.pack)
8. Copy your tileset(s) to a new folder. (No matter where, just create a new folder somewhere and copy the files there)
9. In tilezed go to tools->.pack files -> Create .pack file
10. Click on the blue + sign on the mid left of the pop up
11. Find the folder where you copied the tilesets and choose it
12. Name the pack file (for this I use NAME.pack) Remember lower and upper case letters make a difference so don't make a name like l33TNo0OBs.pack or you're going to have a bad time.
13. You can specify where the .pack will be created from the ... icon (defaults to tools/tilezed)
14. Press OK
 
How to add the files into a mod structure. I assume that you've created an otherwise working folder structure
15. Create a textures folder to your mod: Zomboid/mods/MyMod/media/texturepacks/
16. Copy the .pack file to that folder
17. Copy the .tiles file to Zomboid/mods/MyMod/media
18. Open your mod.info file (Zomboid/mods/MyMod/)
19. Add these two lines:
pack=NAME
tiledef=TILESETTEST ###
20. replace the ### with a number from 100-8000 (check if other published mods are using the same number and announce what number you're using in your map thread)
:oops:  :oops:  :oops:
BTW, I have set the waterMins to "{nil, nil, nil, nil, nil, nil, nil}". But the crop's info still says that the crop is thirsty and I can water it as usual.
Should I change the code to "0,0,0,0,0,0,0"? Or the waterMins cannot be set to zero?
Link to comment
Share on other sites

Good luck! If you continue to have trouble let me know and I might be able to take a look. I'm sloooowly starting to get more familiar with PZ modding now. :) I have never used lua before this lol

The sprites of normal growing stages work perfectly. But the sprites of dead plants won't show up. How do the sprites worked in your test?
Link to comment
Share on other sites

BTW,would you edit the mod to allow the plants to be plant with zero water level in the future updates?I tried to set minwaterlvl to 0 for all growing stages of my pickle "plant" in the current version, but it doesn't perfectly work. The plant info showed a yellow healthy status for it. And the plant will die (receding) if I didn't water the pickle for 2 or 4 days (I set the ttg to about 7 days).

Link to comment
Share on other sites

Good luck! If you continue to have trouble let me know and I might be able to take a look. I'm sloooowly starting to get more familiar with PZ modding now. :) I have never used lua before this lol

I have just checked Moddable Farming's lua files. There is one thing I don't quite understand.

I found the following codes in farming_vegetableconf.lua:

 

-- checks one value expected to be low (Min), and another water value expected to be high (Lvl) to see how far they deviate

-- if low value is indeed lower as expected, all is good and function returns 0
-- if the value is slightly higher, the positive difference is returned (plant continues to grow, but is delayed)
-- if the value is significantly higher, -1 is returned (plant no longer grows)
-- if the value is very greatly higher, -2 is returned (plant is supposed to die, but doesn't seem to)
farming_vegetableconf.calcWater = function(waterMin, waterLvl)
if waterLvl and waterMin then
-- 1 test, our water lvl is > of our waterMin, it's ok, your plant can grow !
if waterLvl >= waterMin then
return 0;
-- 2 test, our waterLvl is less than 10% less than waterMin, your plant can grow but with more hours (ex : lvlMin 70, you have 65 -> your plant grow + 10 hours)
elseif waterLvl >= math.floor(waterMin /  1.10) then
return waterMin - waterLvl;
-- 3 test, our waterLvl is > 30% less than required waterLvl, your plant can't grow, and the next growing state will be in 5 hours
elseif waterLvl >= math.floor(waterMin /  1.30) then
return -1;
-- if the waterLvl is the plant < 30% less than requiredLvl, the plant will be dead !
else
return -2;
end
else -- if we're here, it's because of waterMax, we gonna return 0, it's ok, we don't need waterMax for now :)
return 0;
end
end

In these codes, it shows that the plant will dry and dead if the water level is 30% lower than the minimum water level.

So, what is the point for the following codes in basicFarming.lua?

 

-- check the stat to make them ok (if water < 0 we set it to 0 for example)

-- if health < 0 the plant is dead (dry)
function basicFarming.checkStat(plant)
if plant.state ~= "plow" and plant.nbOfGrow > 1 then
if plant.waterLvl <= 0 then
basicFarming.dryThis(plant)
elseif plant.waterLvl > 100 then
plant.waterLvl = 100
end
if plant.health <= 0 then
basicFarming.dryThis(plant)
end
end
if plant.waterLvl < 0 then
plant.waterLvl = 0
end
if plant.health < 0 then
plant.health = 0
elseif plant.health > 100 then
plant.health = 100
end
end

Is there a chance that the plant can survive even if their water level is 30% (or more than 30%) lower than the minimum water level?

Link to comment
Share on other sites

I think the problem is... 30% of "0" minimum water level is still 0, so when you have 0 water level the plant will always die no matter what. I will look into whether it's possible to change this, but I don't want to change the functionality of the default farming very much if I can help it and unfortunately that's how the default farming is set up.

 

Perhaps like you suggested initially it might be better to be able to set minimum water level to "nil" and disable all water checking that way. I think I like that option better and I will see if I can add that in the next version, but it will probably take some time.

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...