I'm doing some kind of survival map "just for the lulz" and I have an issue with something related to positioning drop pods (and nydus worms) at random on a safe spot. Basically, what I did (which works) is something like:
While (droppodisplaced == FALSE)
Set droppodtarget == (random point in playable map area)
If (droppodtarget and pointwhereunitsmustconverge are connected by pathing == TRUE) AND (number of units in region (droppodtarget, 3.0) == 0)
Then (Create a drop-pod and all that stuff), (set droppodisplaced == TRUE)
Else (wait 0.25 seconds)
This trigger actually works, BUT sometimes the drop-pod is placed on a cliff side so the units inside are dropped randomly on either one height of the cliff or the other. Basically some of them will get stuck on top of a building while the others will head towards the point where they should all converge. It's even more obvious when I use this method for summoning a nydus worm, sometimes the nydus worm just spawns then immediately dies because he was being summoned right next to a doodad with footprint, or because it is placed partially under a cliff.
So my question is:
Is there a way to make the drop-pod (or nydus worm) be placed ONLY away from any doodad and/or cliff, to prevent this issue? I'd like to avoid having to place a list of points on the map to choose from, I'd rather keep the randomness but make sure the unit is spawned on a "clean" spot. Any idea?
I think there's a function for testing if a unit can be placed properly somewhere, I think it's Order Is Valid where you give it the order of building a Nydus Worm and the target point, if there's enough room for a Nydus Worm at the target point it'll return True.
Hmm, looks pretty useful... I just checked, there is "unit is valid" and "order is valid"... The thing is I don't really know how I should use them. "Order is valid" does not help here since no building is ordered to create/train the unit. My nydus worm is created directly after I checked its placement, but I think I can't really use "unit is valid" so soon, when the unit doesn't even exist and is not stored in a variable yet. So I guess it's still all about "unit is valid", but what should I do with it?
I attached a picture of my current trigger just in case it helps. There is no event for the trigger because it's only executed via another trigger (basically a switch selecting a mission type at random, one of these missions is about nydus worms being spawned on multiple locations and you need to destroy them).
I just tried the dummy trick, it doesn't seem to be enough. Actually the trigger runs fine, but the nydus worms and/or drop-pods are just placed the same way as they used to... Which means drop-pods often end up next to a cliff side, thus spawning units on both the top level of the cliff and the bottom level. I don't know how nydus worms react to doodads yet because it didn't happen while testing, but I assume if it happens it won't prevent it from being destroyed either. Looks like I'll have to find a better way, or maybe I'm just completely misusing the "unit is valid" condition...
I'm still looking for a way to solve this... I still haven't found anything to really prevent a building from being placed next (if not on) cliff sides when its position is chosen randomly.
Might have found what your looking for but its a bit convoluted. There is the ability to check the condition if an imaginary like crosses a cliff edge. Set it up in a loop so that a random point is picked, checks is a lines crosses a cliff each 45 degrees 8 times (say 3 distance from the random point), and if there is no cliff drop the point or reloop and pick another random point. Hope it helps
Thanks Hobbidude, it works perfectly fine! I just tried and there is no more worm or drop-pod spawned on cliffs. I basically added 8 conditions "Line crosses cliff" in my current trigger to make sure there is nothing around the placement point, just as you suggested. A distance of 3 is perfect for a nydus worm, 2 should be enough for a drop-pod. The next step now is to find a way to prevent worms from being spawned on doodads... I'll probably just have to check for any actor around (since doodads are listed as actors) in addition to the long list of conditions.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm doing some kind of survival map "just for the lulz" and I have an issue with something related to positioning drop pods (and nydus worms) at random on a safe spot. Basically, what I did (which works) is something like:
While (droppodisplaced == FALSE)
Set droppodtarget == (random point in playable map area)
If (droppodtarget and pointwhereunitsmustconverge are connected by pathing == TRUE) AND (number of units in region (droppodtarget, 3.0) == 0)
Then (Create a drop-pod and all that stuff), (set droppodisplaced == TRUE)
Else (wait 0.25 seconds)
This trigger actually works, BUT sometimes the drop-pod is placed on a cliff side so the units inside are dropped randomly on either one height of the cliff or the other. Basically some of them will get stuck on top of a building while the others will head towards the point where they should all converge. It's even more obvious when I use this method for summoning a nydus worm, sometimes the nydus worm just spawns then immediately dies because he was being summoned right next to a doodad with footprint, or because it is placed partially under a cliff.
So my question is: Is there a way to make the drop-pod (or nydus worm) be placed ONLY away from any doodad and/or cliff, to prevent this issue? I'd like to avoid having to place a list of points on the map to choose from, I'd rather keep the randomness but make sure the unit is spawned on a "clean" spot. Any idea?
@ZealNaga: Go
I think there's a function for testing if a unit can be placed properly somewhere, I think it's Order Is Valid where you give it the order of building a Nydus Worm and the target point, if there's enough room for a Nydus Worm at the target point it'll return True.
@zorbotron: Go
Hmm, looks pretty useful... I just checked, there is "unit is valid" and "order is valid"... The thing is I don't really know how I should use them. "Order is valid" does not help here since no building is ordered to create/train the unit. My nydus worm is created directly after I checked its placement, but I think I can't really use "unit is valid" so soon, when the unit doesn't even exist and is not stored in a variable yet. So I guess it's still all about "unit is valid", but what should I do with it?
I attached a picture of my current trigger just in case it helps. There is no event for the trigger because it's only executed via another trigger (basically a switch selecting a mission type at random, one of these missions is about nydus worms being spawned on multiple locations and you need to destroy them).
@ZealNaga: Go
I'm sure you can use a dummy invincible Nydus Network and use it to test if the order would be valid.
I just tried the dummy trick, it doesn't seem to be enough. Actually the trigger runs fine, but the nydus worms and/or drop-pods are just placed the same way as they used to... Which means drop-pods often end up next to a cliff side, thus spawning units on both the top level of the cliff and the bottom level. I don't know how nydus worms react to doodads yet because it didn't happen while testing, but I assume if it happens it won't prevent it from being destroyed either. Looks like I'll have to find a better way, or maybe I'm just completely misusing the "unit is valid" condition...
BUMP
I'm still looking for a way to solve this... I still haven't found anything to really prevent a building from being placed next (if not on) cliff sides when its position is chosen randomly.
Might have found what your looking for but its a bit convoluted. There is the ability to check the condition if an imaginary like crosses a cliff edge. Set it up in a loop so that a random point is picked, checks is a lines crosses a cliff each 45 degrees 8 times (say 3 distance from the random point), and if there is no cliff drop the point or reloop and pick another random point. Hope it helps
@hobbidude: Go
Thanks Hobbidude, it works perfectly fine! I just tried and there is no more worm or drop-pod spawned on cliffs. I basically added 8 conditions "Line crosses cliff" in my current trigger to make sure there is nothing around the placement point, just as you suggested. A distance of 3 is perfect for a nydus worm, 2 should be enough for a drop-pod. The next step now is to find a way to prevent worms from being spawned on doodads... I'll probably just have to check for any actor around (since doodads are listed as actors) in addition to the long list of conditions.