-
What do you want to achieve? I want to make a farming system (I don’t need the scripts just how could I make it Like the Idea?
-
What is the issue? I don’t know what can I do to make it
-
What solutions have you tried so far? Yes, I tried looking but found none
Again, I don’t need the scripts Just how I could make it?
I don’t recall what Islands’ farming system is like, but I’m guessing what you are after is a tile which needs to be seeded and watered until the crop (ex. wheat) has grown?
Yeah, Do you have any idea how could I create a system like that?
I don’t want the code, I just want to know How would I create an efficient way of that…
A good place to start is to divide the problem into smaller parts. Your farming system requires the following steps:
1. Seeding
2. Watering
3. Watering -- Or however many times you want it to be watered
4. Harvest
You don’t want to progress to the next stage before the previous stage is finished. Below is a code for how this may be started, this is missing a lot of the featured you will need, but this is one approach showing the lifetime of a farming tile.
A very simple and barebones start could be to do something along the following lines:
function startTile(tile)
while tile:GetAttribute("Seed") == "" do -- Replace "" for whatever your non-seeded state will be called.
task.wait(.1) -- No need to check that often. Avoid wait() loops, consider changing to an event listener.
end
while tile:GetAttribute("GrowthTimeLeft") > 0 do
local dt = task.wait(.1) -- DeltaTime
tile:SetAttribute("TimeSinceWatered", tile:GetAttribute("TimeSinceWatered") + dt)
if tile:GetAttrubute("TimeSinceWatered") > droughtTime then
print("Tile dried and died.")
tile:SetAttribute("Seed", )
return -- Abort the lifetime, no need to finish it.
end
tile:SetAttribute("GrowthTimeLeft") -= dt
end
print("Plant finished!")
end
PS: I know you said no code, but this is so far from the finished product I figured this would be fine. A good solution for this might be using object oriented programming, usually quite efficient in large quantities and easy to modify at later stages.
Thank you so much for helping me! You are a legend!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.