- Joined
- Jul 22, 2021
- Messages
- 81
Hello,
Recently, I was trying to create and implement a system that simulates an "animal life cycle in the forest". It basically went like this:
1. At 6 am, units from the Day_Animals group spawn (unpaused & unhidden) at their Den region
2. Then they are randomly sent to various "patrol points", like PP1 -> PP4 -> PP2, etc. The unit should be sent to any randomly picked point upon his arrival, but I did a version where the sequence was always the same.
3. At 5:30 pm daytime units go to their den location, when they enter the region they're hidden & paused until 6 am.
4. At 6 pm units from the Night_Animals group were out of their own Den region and should follow essentially the same routine as daytime animals.
5. At 5:30 pm nighttime units go to their den location, when they enter the region they're hidden & paused until the night comes.
6. The cycle repeats.
But I stumbled upon all sorts of weird bugs, like units from a given group didn't react to commands, they didn't hide/pause, etc. I'm kinda clueless about these issues.
Basically, what I'm asking for are answers with tips for most efficient, bug-free scripts/triggers or any tips based on my description. I will later try to recreate this system since I clearly did something wrong. I'm using Lua script language for my map (but I'm a newbie when it comes to Lua still). I even asked LLM tools for the script for my system but it didn't really worked as you can imagine.
When I get home, I can post you the triggers I've created that didn't work for me.
Thank you for reading through!
Recently, I was trying to create and implement a system that simulates an "animal life cycle in the forest". It basically went like this:
1. At 6 am, units from the Day_Animals group spawn (unpaused & unhidden) at their Den region
2. Then they are randomly sent to various "patrol points", like PP1 -> PP4 -> PP2, etc. The unit should be sent to any randomly picked point upon his arrival, but I did a version where the sequence was always the same.
3. At 5:30 pm daytime units go to their den location, when they enter the region they're hidden & paused until 6 am.
4. At 6 pm units from the Night_Animals group were out of their own Den region and should follow essentially the same routine as daytime animals.
5. At 5:30 pm nighttime units go to their den location, when they enter the region they're hidden & paused until the night comes.
6. The cycle repeats.
- I also took into consideration that animals might not get to their den for various reasons, so they were automatically moved to their respective den regions, hiddeen & paused - about 15 mins before the next "shift".
- There is also an issue when a unit is attacked during their "patrol routine" they should stop their own patrol and fight combat, and if the combat is no longer occuring (timer checking 5 sec time if unit is attacked or sth?) then the unit goes back to their patrol.
- Another thing is that when any unit died, then a new unit is created at the den & added to the group when the next day/night cycle starts. Possibly a new unit type is spawned then.
But I stumbled upon all sorts of weird bugs, like units from a given group didn't react to commands, they didn't hide/pause, etc. I'm kinda clueless about these issues.
Basically, what I'm asking for are answers with tips for most efficient, bug-free scripts/triggers or any tips based on my description. I will later try to recreate this system since I clearly did something wrong. I'm using Lua script language for my map (but I'm a newbie when it comes to Lua still). I even asked LLM tools for the script for my system but it didn't really worked as you can imagine.
When I get home, I can post you the triggers I've created that didn't work for me.
Thank you for reading through!
























