Jump to content
Deadeye_Rob

Regenerating Ore Nodes

Recommended Posts

Hi guys!

Im dabbling with an Exploration-based map primarily for myself but also for others to drop in whilst I’m playing.

Its a large, single tundra island which will be extremely hostile in both climate and wildlife ;).


I love the implementation of Ore Nodes and the resources obtained from mining rocks is a great quality of life addition.

I would like to make these Ore Nodes and rocks capable of respawning once destroyed from mining, thereby ensuring a renewable supply for all my settlement needs!

Ive tried various attempts of Scripting triggers such as “on Killed” “after delay” “Spawn entity (clay node)” at “get position”

sadly with no success.

can anyone help me with this? Basically I want a fresh node/rock to spawn after an in-game day in the exact place where a previous node has been mined and destroyed.

Share this post


Link to post
Share on other sites

I think after adding the scripting options for the terrain, that shouldn't be a problem, but I don't have time to create a simple script for it now.
I'll try to look into it tonight, if I can create something functional, I'll send it to you here.

 

Share this post


Link to post
Share on other sites

I think I have a working script somewhere in saved compositions....I'll look around tonight as well. Not tried to use them in a few updates though so something may have changed with the scripts.

 

Edited by spiritchaser28
  • Like 1

Share this post


Link to post
Share on other sites

Ah guys I’d really appreciate it.

 

With the use of regenerative ore nodes I could possibly disable dynamic terrain, therefore increasing performance whilst not totally locking out resource gathering.

  • Like 1

Share this post


Link to post
Share on other sites

I sent you the composition of the file for the discord, you can download it, basically only three different raw materials, two stones and clay are set, but it is possible to customize it as you wish.
if you are interested in better explaining how the script works, contact me on discord.
one hour of the game is set on the timer, you can change it to a specific hour of the game, for example to 23:00, or just change the number one to 24 and it will be checked every day but at the time you have set the beginning of the game.the activation zone is there only to define the position of the control point, whether they are located in the area of the entity or not.
entities are then spawned from the field randomly, if you want to add more types of spawned raw materials, just add another template and mark it in the label

 

  • Like 1

Share this post


Link to post
Share on other sites

be careful, it's not perfect, the zone must be completely empty to spawn new entities

Share this post


Link to post
Share on other sites

Guys, thanks very much for your help with this, it’s a great help.

Once I get a better understanding of Scripting (however long they’ll be! ;)) I’ll try to create some Self-contained-scripted Ore Deposits that are capable of respawning once being mined.

Share this post


Link to post
Share on other sites

I remember playing with the kill event on scripted entities. it doesn't seem to trigger (possibly from the script disappearing with the entity?), i use event listeners to work around this problem. I sometimes do small experiments to see what events and logics trigger properly.

  • Upvote 1

Share this post


Link to post
Share on other sites

tile kill is only used for certain types of entities, some are removed using a tile to remove or something like that, I don't know the exact translation into English. in this case, however, it is better to check a certain area at a certain time to find out which entities are in that area and which are not. then you just have to deal with the conditions.

  • Like 1

Share this post


Link to post
Share on other sites

So looking at the ore deposits themselves. They come in 3 tiers;

Pristine, Cracked, and Mined

Each tier decreases in yield before finally despawning all together. So the trick is:

How can I create a simple, self-contained script that registers the destruction/death/despawn/etc of an Ore Deposit to then respawn a fresh pristine one in its place after a certain period of time?

Mello’s script is a brilliant starting point but I would like to refine and share a new one for everyone to use. :) 

  • Like 1

Share this post


Link to post
Share on other sites

here you can set a specific game hour when the script should check whether the resources are on the map or not

1409729782_Snmkaobrazovky2021-08-28012704.jpg.507ec9d4cbf688312c41e4184c03803f.jpg

Share this post


Link to post
Share on other sites


 


1. The reference points are set for all types of raw materials. each raw material is created at a specific reference point. you can easily copy reference points, but each point must contain a main logic label and one label for the required resource.

2. time trigger 

3. Main Label

the composition does not contain raw material entities, but this is not a mistake, raw materials are created only at reference points right at the start of the game. they will only be renewed if they are fully mined- (disappear) , but do not appear immediately after extraction, but only when the time of control.

1335810800_Snmkaobrazovky2021-08-28012151.thumb.jpg.2f59bc605033bd6cab432477e1fcbc40.jpg

 

you can copy hundreds of reference points,but don't forget that everyone ALWAYS MUST HAVE TWO LABELS!

Edited by Mello1223

Share this post


Link to post
Share on other sites

@Mello1223 you made it a bit complicated ?

 

@Deadeye_Rob Since the event that starts the script is it being depleted (a minded clay deposit is created), I would do it this way:

1. Place an event listener

2. On create - entity event - entity type = mined clay deposit

Ylands_210829_185359.thumb.png.a705099bd56473432d2d6a5fb8e0591f.png

3. click "add script" to put this inside the game logic:

Spawn entity type=pristine clay deposit

Ylands_210829_191247.thumb.png.fb708fe1d441704de62c5a9f15c15e8c.png

The new pristine deposit will overlap the old mined one if you don't despawn the old one. But spawn the new one in first ?

Randomly, I was getting a bug where the animation would get stuck if I didn't have a delay at all. You can set it to whatever number you want. It is in seconds.

Optional spawn nearby but not at exactly the same spot:

Ylands_210829_191306.thumb.png.7d77eed02fdd83259d79ab3513c020a3.png

y is height, so you don't need to move that if the terrain is flat. If it isn't roughly flat, the deposit could go below ground or be floating... so keep that in mind.

 

 

Just to clarify, you would need an event listener for each type of deposit.

Edited by ocnoglittle

Share this post


Link to post
Share on other sites
2 hours ago, ocnoglittle said:

@Mello1223 you made it a bit complicated ?

 

@Deadeye_Rob Since the event that starts the script is it being depleted (a minded clay deposit is created), I would do it this way:

1. Place an event listener

2. On create - entity event - entity type = mined clay deposit

Ylands_210829_185359.thumb.png.a705099bd56473432d2d6a5fb8e0591f.png

 

 

I don't understand your script. when an ore deposit is formed, one more is  Created ???... however, the requirement was to create an ore deposit only when the ore deposit would be mined. ? ? and why complicated, when you just copy or create a reference point and add two labels of logic to it, there is nothing else to do there.???

  • Haha 1

Share this post


Link to post
Share on other sites

by the way, you know that you have created an endless node which, after an some time, will cause the game to crash. ??? ???

Share this post


Link to post
Share on other sites
8 hours ago, Mello1223 said:

by the way, you know that you have created an endless node which, after an some time, will cause the game to crash. ??? ???

Why??

Share this post


Link to post
Share on other sites
7 hours ago, Deadeye_Rob said:

Haha! I didn’t think a simple respawning rock would require so much scripting!

I swear my script is easy...

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, Mello1223 said:

an ore deposit is formed, one more is  Created

Only when a "mined" or depleted deposit is created. And I delete the original.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, ocnoglittle said:

Why??

I'm sorry, you're right, there's no endless loop, I didn't notice it on my mobile..but it still has a few mistakes. if you set a longer time, you can completely extract the ore source, then an error will occur in the script (delete entity) which can cause problems. 

Share this post


Link to post
Share on other sites

1663112106_Snmkaobrazovky2021-08-30193339.thumb.jpg.01a50aa430db1bb38c5c1416cebb90f5.jpg

but even my script is not complicated. it's a total of 5 lines including the condition. everything else is just copying for all other types of ore.

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×