I'm going to use a pseudo code example of what I am trying to achieve but I cannot find the appropriate commands to do so. We are going to create and destroy actors in irregularly shaped regions.
Event - Whatever
Conditions - Whatever
Local Variables - Region A, Region B, Point P, Boolean Region Switch
While a condition is true -
Set P = Position of Unit
Actions:
If
Boolean Region Switch = True
Then
Set Region A = Region Circle of radius 10 around point P
Pick each integer from 1 to 10 and Create an Actor at random point in region A - B.
Delete all actors in region B - A.
Set Boolean Region Switch = False
Else
Set Region B Circle of radius 10 around point P
Pick each integer from 1 to 10 and create Actor at random point in region B-A
Delete all actors in region A-B.
Set Boolean Region = True
There is a picture below of what I'm trying to do. Pretend that the Actors that are being created and destroyed are trees.
So at 0 seconds the bottom Blue circle named Region A has 10 trees created at random locations within it.
At 5 seconds The Black circle named region B is created. 10 trees are then created in the Pink and Green Region, which is the same as Region B - Region A. In the black region (do not confuse with black circle), which is region A - Region B, all trees in the black region are removed from the game.
At 10 seconds the new Blue circle named Region A' is created and in the brown region A' - B, 10 trees are created. However in the pink and red region B - A', all trees are destroyed. This process continues forever.
When creating trees, use a Repeat 10 Times loop. In each instance, use a Repeat Forever loop. Within each instance of THAT, move a point variable to a random point within Region A (or B). Then use an If Then Else function with a condition checking if the point variable is in Region B (or A.) If false, create a tree, followed by the Break function (to stop the Repeat Forever loop.)
This won't work with destroying trees since you can't check if a region contains an actor (the function doesn't exist.) What you can do is use the Add Circle to Region function to create a negative region over Region B for Region A, setting the radius to the same size as Region B, then destroy all actors within Region A. You will have to redefine the variable "Region A" for each iteration of tree destruction.
To be consistent, you might want to use the negative region method for creating trees as well. It might also be a bit more efficient. It will just take a little tinkering to get it to work the way you want.
Alternatively, you could use units instead of actors, since it's easier to check the position of a unit than the position of an actor. Another method still is to use a lot of point variables, setting those to the position where you create each tree. While you can't check if an actor is within a region, there is a function to check if a point is within a region.
I'll leave it to you which method or combination thereof works best for your map.
I know you mentioned you can't check if a region contains an actor, but can't you also just send an death/destroy actor message to a tree like actor in a region and somehow subtract the other regions?
I used the unit suggestion I'll attach a couple of pictures of the result.
I used a mobile skybox (attach model to unit) with some fog and rain effects and was able to create a densely populated forest/foilage on the VISBLE map only. The trees/shrubs spawn at a distance that is DOUBLE the camera farclip and anything outside the double farclip range gets deleted.
If I were to create a static forest/foilage settings of this density on a 256x256 map it would crash. So I have the advantage of extreme density at the expense of having them removed if the player runs too far out of sight of them and having them respawned in random locations when he approaches that region again.
btw, you can hide unit life bars by unchecking some boxes in the unit's actor. You can also check "unselectable" and "untargetable" under the unit's flags to make the trees simulate doodads.
btw, you can hide unit life bars by unchecking some boxes in the unit's actor. You can also check "unselectable" and "untargetable" under the unit's flags to make the trees simulate doodads.
I know, that was a sample of those triggers only, I didn't put any work into that at all, even the title of the map is "Dense Doodad Proliferation Tester"
I'm going to use a pseudo code example of what I am trying to achieve but I cannot find the appropriate commands to do so. We are going to create and destroy actors in irregularly shaped regions.
Event - Whatever
Conditions - Whatever
Local Variables - Region A, Region B, Point P, Boolean Region Switch
While a condition is true -
Set P = Position of Unit
Actions:
If
Boolean Region Switch = True
Then
Set Region A = Region Circle of radius 10 around point P
Pick each integer from 1 to 10 and Create an Actor at random point in region A - B.
Delete all actors in region B - A.
Set Boolean Region Switch = False
Else
Set Region B Circle of radius 10 around point P
Pick each integer from 1 to 10 and create Actor at random point in region B-A
Delete all actors in region A-B.
Set Boolean Region = True
Wait 5 seconds
---------------------------------------------------------------------------------------------------------------------------------
There is a picture below of what I'm trying to do. Pretend that the Actors that are being created and destroyed are trees.
So at 0 seconds the bottom Blue circle named Region A has 10 trees created at random locations within it.
At 5 seconds The Black circle named region B is created. 10 trees are then created in the Pink and Green Region, which is the same as Region B - Region A. In the black region (do not confuse with black circle), which is region A - Region B, all trees in the black region are removed from the game.
At 10 seconds the new Blue circle named Region A' is created and in the brown region A' - B, 10 trees are created. However in the pink and red region B - A', all trees are destroyed. This process continues forever.
When creating trees, use a Repeat 10 Times loop. In each instance, use a Repeat Forever loop. Within each instance of THAT, move a point variable to a random point within Region A (or B). Then use an If Then Else function with a condition checking if the point variable is in Region B (or A.) If false, create a tree, followed by the Break function (to stop the Repeat Forever loop.)
This won't work with destroying trees since you can't check if a region contains an actor (the function doesn't exist.) What you can do is use the Add Circle to Region function to create a negative region over Region B for Region A, setting the radius to the same size as Region B, then destroy all actors within Region A. You will have to redefine the variable "Region A" for each iteration of tree destruction.
To be consistent, you might want to use the negative region method for creating trees as well. It might also be a bit more efficient. It will just take a little tinkering to get it to work the way you want.
Alternatively, you could use units instead of actors, since it's easier to check the position of a unit than the position of an actor. Another method still is to use a lot of point variables, setting those to the position where you create each tree. While you can't check if an actor is within a region, there is a function to check if a point is within a region.
I'll leave it to you which method or combination thereof works best for your map.
I know you mentioned you can't check if a region contains an actor, but can't you also just send an death/destroy actor message to a tree like actor in a region and somehow subtract the other regions?
I used the unit suggestion I'll attach a couple of pictures of the result.
I used a mobile skybox (attach model to unit) with some fog and rain effects and was able to create a densely populated forest/foilage on the VISBLE map only. The trees/shrubs spawn at a distance that is DOUBLE the camera farclip and anything outside the double farclip range gets deleted.
If I were to create a static forest/foilage settings of this density on a 256x256 map it would crash. So I have the advantage of extreme density at the expense of having them removed if the player runs too far out of sight of them and having them respawned in random locations when he approaches that region again.
@EdwardSolomon: Go
Cool stuff!
btw, you can hide unit life bars by unchecking some boxes in the unit's actor. You can also check "unselectable" and "untargetable" under the unit's flags to make the trees simulate doodads.
Quote from BasharTeg:
@EdwardSolomon: Go
Cool stuff!
btw, you can hide unit life bars by unchecking some boxes in the unit's actor. You can also check "unselectable" and "untargetable" under the unit's flags to make the trees simulate doodads.
I know, that was a sample of those triggers only, I didn't put any work into that at all, even the title of the map is "Dense Doodad Proliferation Tester"