Jump to content

Is there a reliable way to make a block disappear with a timer?


manux

Recommended Posts

Hi,

I'm trying to have a custom block disappear after a short time.

The only way I was able to make this work so far is by upgrading the block to an air block with UpgradeRated:

<property name="UpgradeRated.ToBlock" value="air"/>
<property name="UpgradeRated.Rate" value="0"/>

 

But UpgradeRated.Rate is random. I'd like it to disappear after like 5 seconds or so, but I always get a random time that is too long and there doesn't seem to be any way to control that. I tried with rates of 1, 2, 3, but it will just set a longer random time.

 

With the PlantGrowing class, we have a bit more control on the timer, we can set PlantGrowing.IsRandom to false, and the timer seems more reliable, but sadly when I try to use PlantGrowing with PlantGrowing.Next = "air", the game spits an error on load that it can't find the block "air". Seems like the air block is treated in special way under the hood...

 

I've also tried making a new custom air block, which visually works and doesn't give an error on load with PlantGrowing, but it leaves an invisible block there, and you can't build anything where it is, and can't destroy it. The regular air block does not do that, it just creates air.

 

Does anyone know of a better way to do this, or commands to better control the timer of UpgradeRated?

Link to comment
Share on other sites

My real goal was to have a way to put fish bait on a fishing rod without having to use a recipe. Cause using a recipe breaks the fishing gameplay loop since you have to put your fishing rod back in your toolbelt after the recipe is done.

 

I originally wanted to be able to put fish bait on the ground with the class PlaceAsBlock, and then use the class ExchangeItem with Focused_blockname_1 on the fish bait that's on the ground to switch from a regular fishing rod to a baited fishing rod.

But because of lack of ability to make the fishing bait disappear a after a short time, I ended up using another method.

 

I now have a fish bait basket that I can upgrade with fish bait to become fish bait on the ground, and then make it fallback to the empty fish bait basket after a short time. This way I can use the PlantGrowing class which gives much better control on the timer. I can use a GrowthRate of 0.1, which results in about the 5 seconds I was looking for.

 

Before all that I wanted to make the fishing rod like a ranged weapon, so that it would use fish bait as ammunition. But you don't seem to be able to mix classes, so I could't have it be a ranged weapon and also an object that uses ExchangeItem at the same time, so I had to find another way.

 

To make my fishing mod, I took some ideas (and icons) from Clockwork Orange's and Carlzilla's fishing mods, and adapted them to what I wanted.

It's not perfectly as I wanted it, but the fishing gameplay loop is now usable and fast. You can end up fishing fish, or plant fibers, or junk like shoes, clothes, trophies, etc...

Link to comment
Share on other sites

I found this works.

 

<property class="PlantGrowing">
<property name="Next" value="appleGrown" />
<property name="GrowthRate" value="180" />
<property name="FertileLevel" value="1" />
<property name="IsRandom" value="false" />
</property>

 

In this example, appleGrown is a block... specifically an apple tree. GrowthRate is in RL minutes. :)

 

UpgradeRated uses the "ticks" of the day to determine when something be upgraded.

Link to comment
Share on other sites

Yes I know, this is what I am using now. But it only works because I changed the way I looked at the problem. As mentioned in first post, PlantGrowing wont work when setting the "Next" block to "air", to try to make the block disappear

 

Thanks for confirming that PlantGrowing is in RL minutes, that was not very clear in the xml notes.

Link to comment
Share on other sites

Did you try something like this?

 

<property name="Class" value="UpgradeRated" />

<property name="UpgradeRated.ToBlock" value="air" />

<property name="UpgradeRated.Rate" value="6" />

 

Yes, that's it only way you can switch to an air block without the game spitting errors, but the timer of UpgradeRated is random and the minimum time is too long. PlantGrowing seems to be the only way to have a reliable and short timer, but sadly it does not support the air block for some reason.

Link to comment
Share on other sites

No, we did read your initial post. You said you can't upgrade to block air.

 

Guppy suggested copying the air block, so you give it a new number and a new name and use that.

 

However I believe there's an issue with upgrading to the "air" material, so I'd suggest copying the air material (in materials.xml) and making a new one (like fakeAir), THEN make a new air block also using this material and see if that works.

Link to comment
Share on other sites

No, we did read your initial post. You said you can't upgrade to block air.

 

Guppy suggested copying the air block, so you give it a new number and a new name and use that.

 

However I believe there's an issue with upgrading to the "air" material, so I'd suggest copying the air material (in materials.xml) and making a new one (like fakeAir), THEN make a new air block also using this material and see if that works.

 

Must be my bad English, my initial post contained this, which was my attempt to do what you guys are saying:

 

"I've also tried making a new custom air block, which visually works and doesn't give an error on load with PlantGrowing, but it leaves an invisible block there, and you can't build anything where it is, and can't destroy it. The regular air block does not do that, it just creates air."

 

I haven't tried making a new material, I will try that, thanks!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...