Sign in to follow this  
FreeSpirit

Character Affecting Plant Growth Rate

Recommended Posts

FreeSpirit    3

As the title says, I was wondering if it's possible to make a character that has the ability to affect the growth rate of plants such as berries/farms/etc. within a certain range but only affect the client (or host if the host is using that character).

 

I tried making a mod to test out a few things (before seeing if it can be implemented into a character) like changing things such as "GLOBAL.TUNING.BERRY_REGROW_TIME" but it seems to affect all players if the host has it enabled.

 

Any possible help?

Share this post


Link to post
Share on other sites
DerpTime    1

All the Lua is really flexable.
And if you based it on the way Auras work and proximity
Its probly possible....

...BUT, I think that may be something that would have to be on bushes rather than the character.
and that might be the problem.

Also since it a direct effect on the plants its might be better if it was host side.
dont worry about Host vs Client. it being Host side will not make it suddely effect all character.
...unless you wite it that way.

 but only affect the client (or host if the host is using that character).

 


Also Take a look at the prefab of this character
http://steamcommunity.com/sharedfiles/filedetails/?id=373847037

local master_postinit = function(inst)	TUNING.SEEDS_GROW_TIME = 4*TUNING.SEEDS_GROW_TIME/6	TUNING.FARM1_GROW_BONUS = TUNING.FARM1_GROW_BONUS/2	TUNING.FARM2_GROW_BONUS = TUNING.FARM1_GROW_BONUS/2	TUNING.FARM3_GROW_BONUS = TUNING.FARM1_GROW_BONUS/2	TUNING.POOP_FERTILIZE = TUNING.POOP_FERTILIZE*1.5	TUNING.POOP_SOILCYCLES = TUNING.POOP_SOILCYCLES*1.5	TUNING.GUANO_FERTILIZE = TUNING.GUANO_FERTILIZE*1.5	TUNING.GUANO_SOILCYCLES = TUNING.GUANO_SOILCYCLES*1.5end

What happens here is when 'SHE' uses or biulds or fertilizes the effect is hightened.

Stuff she plants take 33% less time.
when she fertilizes a plant the efect is 50% greater.
Not sure what "FARM1_GROW_BONUS" is but im sure you can find out in the tuning.lua


Sounds intresting.
Good luck!

Share this post


Link to post
Share on other sites
DarkXero    2892

@DerpTime, no, that code what it does is the following:

 

When a Coraline prefab gets initialized, the master_postinit gets ran to create the prefab, and modifies the tuning table values.

Each Coraline that joins will make the values shorter, given the recursive definition there.

 

This effect is not wanted.

 

@FreeSpirit, what do you mean by plant growth?

When your character runs near a bush, berries pop, or if it stands near a bush, berries will pop up in 2 days instead of 3?

 

Also, what is the complete list of things affected by this?

Because farms have the grower component, and bushes the pickable one.

Share this post


Link to post
Share on other sites
DerpTime    1

When a Coraline prefab gets initialized, the master_postinit gets ran to create the prefab, and modifies the tuning table values.

Each Coraline that joins will make the values shorter, given the recursive definition there.

 

This effect is not wanted.

Dark is probly right. Im still new at this.

@DarkXero

Ok but if that true is it the 'inst.' or instance that holds stuff unique to the character?

would it be posible to ingect the edited valuse on ineraction form the character

in to the farms instance?

Maybe with the valuse in the farms

"inst.components.grower.growrate = rates[level]" ?

Share this post


Link to post
Share on other sites
DarkXero    2892

@DerpTime, the inst inside the master_postinit refers to the entity created.

The only things "unique" to the character are the components that get assigned on entity generation.

 

It is possible to modify the farm/player interaction to modify the grower component of the farm inst entity. By modifying the actions related to fertilizing, for example, in actions.lua and making a special case for your character prefab.

 

It is also possible to make a special aura for the character (a function that looks for nearby entities), that interacts with nearby entities, looks if they can be grown into something (they have a pickable component, like the berrybushes, or a grower component, like the farms).

Share this post


Link to post
Share on other sites
FreeSpirit    3

@DerpTime, no, that code what it does is the following:

 

When a Coraline prefab gets initialized, the master_postinit gets ran to create the prefab, and modifies the tuning table values.

Each Coraline that joins will make the values shorter, given the recursive definition there.

 

This effect is not wanted.

 

@FreeSpirit, what do you mean by plant growth?

When your character runs near a bush, berries pop, or if it stands near a bush, berries will pop up in 2 days instead of 3?

 

Also, what is the complete list of things affected by this?

Because farms have the grower component, and bushes the pickable one.

 

Something like that. Think of it as how rain gives a bonus to plant growth and makes takes them less time to grow. I want the character to give off like an "aura" that gives a bonus to plants near it within a certain range, much like having "night vision" where you can change how large the circle of light can be but have a circle of effect that affect plants in this case.

 

I was also contemplating on having this character also have the ability to negate the effect of replanting stuff, making for example replanted berry bushes still act as if they haven't been replanted through the use a custom item only it can make.

Edited by FreeSpirit

Share this post


Link to post
Share on other sites
DarkXero    2892

@FreeSpirit,

Rain only makes crops from farms grow faster.

It doesn't affect berry bushes.

Rain is necessary for mushrooms to grow back.

 

"Plants" is ambiguous, because they grow differently.

Berry bushes don't need light to replenish berries.

Farms do need light to grow the crop.

 

So, which plants are you talking about?

Share this post


Link to post
Share on other sites
FreeSpirit    3

@FreeSpirit,

Rain only makes crops from farms grow faster.

It doesn't affect berry bushes.

Rain is necessary for mushrooms to grow back.

 

"Plants" is ambiguous, because they grow differently.

Berry bushes don't need light to replenish berries.

Farms do need light to grow the crop.

 

So, which plants are you talking about?

 

I was referring saying how when you have night vision, you spawn a light that has a radius of how far the light illuminates. For the ability I want this character to have, I want to have the effect be in a radius of space around it than say have it affect the entire world (like say within 30 feet from your character).

 

As for "plants", I am just pointing to all things that grow over time, that being: Grass, Saplings, Reeds, etc.

 

For example, if I want a few of things to grow twice as fast, I could put it as:

GLOBAL.TUNING.BERRY_REGROW_TIME = (GLOBAL.TUNING.BERRY_REGROW_TIME * 0.5)GLOBAL.TUNING.GRASS_REGROW_TIME = (GLOBAL.TUNING.GRASS_REGROW_TIME * 0.5)GLOBAL.TUNING.SAPLING_REGROW_TIME = (GLOBAL.TUNING.SAPLING_REGROW_TIME * 0.5)GLOBAL.TUNING.REEDS_REGROW_TIME = (GLOBAL.TUNING.REEDS_REGROW_TIME * 0.5)GLOBAL.TUNING.FLOWER_SPAWN_TIME = (GLOBAL.TUNING.FLOWER_SPAWN_TIME * 0.5)

I want this as an ability for a character that only affect "plants" around it within a set distance near it, and not the entire world.

Edited by FreeSpirit

Share this post


Link to post
Share on other sites
DarkXero    2892
	inst:DoPeriodicTask(20, function()		local x, y, z = inst.Transform:GetWorldPosition()		local ents = TheSim:FindEntities(x, y, z, 20, nil, {"player", "FX", "NOCLICK", "DECOR", "INLIMBO"}, nil)		if #ents > 0 then			for k, v in pairs(ents) do				if (v.prefab == "berrybush") or (v.prefab == "berrybush2") or (v.prefab == "grass") or (v.prefab == "sapling") or (v.prefab == "reeds") then					v.components.pickable:LongUpdate(20)				end			end		end	end)	inst:DoPeriodicTask(160, function()		local x, y, z = inst.Transform:GetWorldPosition()		x = x + math.random(31) - 16		z = z + math.random(31) - 16		local flower = SpawnPrefab("flower")		flower.Transform:SetPosition(x, y, z)	end)

Every 20 seconds, character checks for most entities on screen and updates 20 seconds on their timers, effectively doubling the times.

 

The character also spawns a flower near him every 1/3 of a day.

TUNING.FLOWER_SPAWN_TIME affects the flowerspawner component, a component that schedules flowers spawning near players on rainy days, pointless to touch it. Another alternative would be to make it so that if the character is near flowers, they multiply.

 

This doesn't affect farm crops.

Share this post


Link to post
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
Sign in to follow this