Jump to content

[Request] Harvested plants revert to 0 growth for A21


Recommended Posts

As the title says, I'd like to have a mod that causes plants you harvest to revert back to 0 growth instead of being destroyed and needs to be replanted. I tried looking up mods like this on Nexus, but the only one available is in A20 and the posts on it don't suggest it still works. Google didn't offer much help in that regard either.

 

I'm okay with a balance pass on plant harvest yields to compensate for this mechanic.

Edited by Pizzarugi (see edit history)
Link to comment
Share on other sites

9 hours ago, BFT2020 said:

Check blocks and also check a19 for examples prior to the change.  You should see examples where destroying a block changes it to a different block

You should also be able to look at wood and iron spikes, because I believe they also technically change to different blocks whenever they get damaged.

Link to comment
Share on other sites

57 minutes ago, The_Great_Sephiroth said:

Getting nowhere with dew collectors. Tell me, is it impossible to insert the "<downgradeblock>" value into a block using "<set>"? If not, that means I would likely need to make a copy of every block we need to use and add it manually in the modlets blocks.xml, which I am hoping to avoid.

 

If it doesn't have the downgradeblock property already in there, set won't work.  You would need to do something like insertAfter like this

 

example:  adding health loss after drinking murky water in Alpha 20

 

    <insertAfter xpath="/items/item[@name='drinkJarRiverWater']/effect_group[@name='Drink Tier 0']/triggered_effect[@cvar='$waterAmountAdd']">
        <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyStats" stat="Health" operation="add" value="-5"/><display_value name="foodHealthAmount" value="-5"/>
    </insertAfter>

 

 

If downgradeblock is already in there, then set can be used to change the value

 

example - Alpha 19 potato plant

 

<block name="plantedPotato3HarvestPlayer">
    <property name="Extends" value="plantedPotato3Harvest"/>
    <property name="DescriptionKey" value="plantedPotato3HarvestDesc"/>
    <property name="CustomIcon" value="plantedPotato1"/>
    <property name="CreativeMode" value="None"/>
    <drop event="Harvest" name="foodCropPotato" count="1" tag="cropHarvest"/>
    <property name="DowngradeBlock" value="plantedPotato1"/>
</block>

 

<set xpath="//block[@name='plantedPotato3HarvestPlayer']/prperty[@name='DowngradeBlock']/@value">BFTbakedPotatoPlant</set>

 

Also, capitalization is key.  If you path to downgradeblock, it won't find it even though it is in there as DowngradeBlock.

 

If you are going back to the previous state like in A19, you might also want to remove the destroy portion that has a chance of creating a seed.

Link to comment
Share on other sites

You say this after I spent time doing this for every crop.

<set xpath="/blocks/block[@name='plantedMushroom2']/property[@name='PlantGrowing.Next']/@value">DHTA_Mushroom_Stage3</set>

 

<block name="DHTA_Mushroom_Stage3">
            <property name="Extends" value="plantedMushroom3HarvestPlayer"/>
            <property name="DowngradeBlock" value="plantedMushroom1"/>
</block>

I'll probably update it to use the insert method instead, because if you use my current method, it adds a custom stage 3 and if you remove the mod all stage 3 crops go poof.

 

Actually, how do insert after a drop event?


<drop event="Destroy" name="plantedMushroom1" count="1" prob="0.5"/>

How would I specify the "insertafter" line for that?

Edited by The_Great_Sephiroth (see edit history)
Link to comment
Share on other sites

12 hours ago, The_Great_Sephiroth said:

Currently testing this but it's been an hour and the crops grow so painfully slow. Is there a console command to make crops advance to their next stage?

 

Not that I found, when I was testing a similar idea, I had to let real time pass. I let time run quickly and played sniper the entire time, but you could probably turn off the zombie AI and just leave it AFK.

Link to comment
Share on other sites

18 hours ago, The_Great_Sephiroth said:

Actually, how do insert after a drop event?

 

<drop event="Destroy" name="plantedMushroom1" count="1" prob="0.5"/>

 

How would I specify the "insertafter" line for that?

 

This is how I would write it:


 

<insertAfter xpath="//block[@name='plantedMushroom3Harvest']/drop[@event='Destroy']">

<property name="DowngradeBlock" value="plantedMushroom1"/>

</insertAfter>

<remove xpath="//block[@name='plantedMushroom3Harvest']/drop[@event='Destroy']"/>

 

So insert first the new code, and then the remove line to remove the seed drop code

Link to comment
Share on other sites

7 minutes ago, The_Great_Sephiroth said:

Thanks, but I figured it out. It works and I will be uploading to Nexus Mods this afternoon. I already verified that everything works and believe it will give the OP what he wants.

 

I figured you did based on your other posts stating you were already testing your mod, but figured I would still answer it in case someone searches and finds this thread.

Link to comment
Share on other sites

21 minutes ago, The_Great_Sephiroth said:

Thanks, but I figured it out. It works and I will be uploading to Nexus Mods this afternoon. I already verified that everything works and believe it will give the OP what he wants.

Awesome! I look forward to trying it out.

Link to comment
Share on other sites

On 8/1/2023 at 9:03 AM, The_Great_Sephiroth said:

Currently testing this but it's been an hour and the crops grow so painfully slow. Is there a console command to make crops advance to their next stage?

 

Not a console command AFAIK, but I would usually lower the GrowthRate to speed up the stages in testing, and then turn it back to vanilla values when I was done (and leave myself a note beside it as to what the original/test value was).

<property name="GrowthRate" value="60" />	    <!-- was 0.4 for testing -->

 

GrowthRate seems to be about 1 equals 1 minute real time, but the docs also say weird stuff can happen if you set it at 1. Also, haven't done this in A21 yet, but it's worked in the last 3 alphas or so.

Link to comment
Share on other sites

Notes on the crop master block say not to set it below 2.

 

Update:

Okay, I'm stuck again. Before I release the modlet I want to reduce the chance seeds will spawn but not eliminate it. If crops never produce seeds you're confined in how much you can grow. However, I want the seed chance down to around 10%~20%. This means I need to modify the following line.


<drop event="Destroy" name="plantedMushroom1" count="1" prob="0.5"/>

I am not sure how to change the 0.5 to 0.2.


<set xpath="/blocks/block[@name='plantedMushroom3HarvestPlayer']/drop[@event='Destroy'][@name='prob']/@value">0.2</set>

This fails. How do I set the probability lower? I can go brute-force and simply remove the line and add another in my way, but I believe "set" is the proper way to do this.

Edited by The_Great_Sephiroth (see edit history)
Link to comment
Share on other sites

9 hours ago, The_Great_Sephiroth said:

Notes on the crop master block say not to set it below 2.

 

Update:

Okay, I'm stuck again. Before I release the modlet I want to reduce the chance seeds will spawn but not eliminate it. If crops never produce seeds you're confined in how much you can grow. However, I want the seed chance down to around 10%~20%. This means I need to modify the following line.

 

<drop event="Destroy" name="plantedMushroom1" count="1" prob="0.5"/>

 

I am not sure how to change the 0.5 to 0.2.

 

<set xpath="/blocks/block[@name='plantedMushroom3HarvestPlayer']/drop[@event='Destroy'][@name='prob']/@value">0.2</set>

 

This fails. How do I set the probability lower? I can go brute-force and simply remove the line and add another in my way, but I believe "set" is the proper way to do this.

 

If the block only has one destroy event line in it:

 

<set xpath="/blocks/block[@name='plantedMushroom3HarvestPlayer']/drop[@event='Destroy']/@prob">0.2</set>

If the block has multiple destroy event lines in it:

 

<set xpath="/blocks/block[@name='plantedMushroom3HarvestPlayer']/drop[@event='Destroy' and @name='plantedMushroom1']/@prob">0.2</set>

 

Edited by BFT2020 (see edit history)
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...