Deadeye_Rob 908 Posted August 26, 2021 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
Mello1223 591 Posted August 26, 2021 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
spiritchaser28 920 Posted August 26, 2021 (edited) 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 August 26, 2021 by spiritchaser28 1 Share this post Link to post Share on other sites
Deadeye_Rob 908 Posted August 26, 2021 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. 1 Share this post Link to post Share on other sites
Mello1223 591 Posted August 26, 2021 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 1 Share this post Link to post Share on other sites
Mello1223 591 Posted August 26, 2021 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
Mello1223 591 Posted August 26, 2021 RESPAWN RESOURCES.zip 1 Share this post Link to post Share on other sites
Deadeye_Rob 908 Posted August 27, 2021 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
JonathanHunt 47 Posted August 27, 2021 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. 1 Share this post Link to post Share on other sites
Mello1223 591 Posted August 27, 2021 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. 1 Share this post Link to post Share on other sites
Deadeye_Rob 908 Posted August 27, 2021 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. 1 Share this post Link to post Share on other sites
Mello1223 591 Posted August 27, 2021 RESOURCES UPDATE.zip Share this post Link to post Share on other sites
Mello1223 591 Posted August 27, 2021 here you can set a specific game hour when the script should check whether the resources are on the map or not Share this post Link to post Share on other sites
Mello1223 591 Posted August 27, 2021 (edited) 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. you can copy hundreds of reference points,but don't forget that everyone ALWAYS MUST HAVE TWO LABELS! Edited August 27, 2021 by Mello1223 Share this post Link to post Share on other sites
ocnoglittle 760 Posted August 30, 2021 (edited) @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 3. click "add script" to put this inside the game logic: Spawn entity type=pristine clay deposit 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: 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 August 30, 2021 by ocnoglittle Share this post Link to post Share on other sites
Mello1223 591 Posted August 30, 2021 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 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.??? 1 Share this post Link to post Share on other sites
Mello1223 591 Posted August 30, 2021 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
Deadeye_Rob 908 Posted August 30, 2021 Haha! I didn’t think a simple respawning rock would require so much scripting! 1 1 Share this post Link to post Share on other sites
ocnoglittle 760 Posted August 30, 2021 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
ocnoglittle 760 Posted August 30, 2021 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... 1 Share this post Link to post Share on other sites
ocnoglittle 760 Posted August 30, 2021 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. 1 Share this post Link to post Share on other sites
Mello1223 591 Posted August 30, 2021 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
Mello1223 591 Posted August 30, 2021 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