Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Detecting Multiple Unit Movement
Detecting Multiple Unit Movement
Feb 18 2008, 9:21 pm
By: Cardanis  

Feb 18 2008, 9:21 pm Cardanis Post #1



Okay, so I'm trying to create a turn based style of combat map, and I have a few issues.

First of all, there are squads, or groups of units, located under locations in order to keep them in order. In the movement phase, it gives one neutral ai controlled "squad" to you, in order to move, and centres a larger location over it, representing the distance they can move. WHat I want to do, is when any unit of the squad gets outside of that radius, it gives control back to the ai. This would be easy to do with one unit, using "if player brings unit to larger location, but not smaller" but with groups of units, that doesnt work, because there will always be some in the smaller one. Can anybody think of some way that I can get this to work, short of making a trigger for each possible unit size? Is there a way around this? Or is there some way I can cut a whole out of a location? lol, help would be greatly appreciated.



None.

Feb 18 2008, 10:11 pm who Post #2



first do a cycle which centers a location on a unit, creates a burrowed unit, and gives the unit to another player, and preserve it, so there is a burrowed unit under every unit

then give all the units back to the player so he can move them

then have another cycle during the time the player can move the units, this time centering the small location and the large location on a burrowed unit, giving it to another player, and preserving. this way you can detect each unit that moves with this second cycle

if you want the movement range to be larger for different units, then just make the aforementioned cycles use different units and different sized locations



None.

Feb 18 2008, 10:34 pm Cardanis Post #3



I think I get what you're saying, but for the entire squad, each unit is the same, like, say, 12 samir durans. Wont the move location keep focussing on just one of those? And im still having trouble understanding your concept. I want the whole squad to stop moving, if one goes outside the original boundary.



None.

Feb 18 2008, 11:10 pm who Post #4



how it works is you center the location on, for example, samir duran owned by P1
then you create the burrowed unit, and give the samir duran to P2
so when you continue this cycle it will go through all of the units because they are given to P2 1 by 1. (you give them back to P1 afterwards by checking if P1 brings any samir durans to the squad location).

so are you saying that you want the players to select all the units in the squad, then stop them all when they have moved? In that case, you could just use the system i mentioned in my earlier post, but give all the units in the squad to another player after one unit has moved.

After the burrowed units are created, the loop continually checks if units have moved from each, by centering/giving the burrowed units.



None.

Feb 18 2008, 11:33 pm Cardanis Post #5



Okay, I get it, the only thing is, how to detect to see if they've moved outside of the radius? Like, i could say "give them all back" with the conditions "Player brings unit otuside of movement radius (anywhere) and player DOESNT bring in the radius (so we know hes left it) but that doesnt work, because the player could leave one unit in the radius, and move the rest around outside. . . .wait, I think I get it. You mean centre the radius on each zergling, and swapping the comp, so i can cylce through it? And if say, a different burrowed unit, that started at the centre, being the anchor point, isnt in any of those cycled ranges, then it stops the movement and gives control over?



None.

Feb 18 2008, 11:35 pm Falkoner Post #6



Since you have the same unit, and they are all ground units, you can't use the center location properly, but since they are all ground units, and therefore cannot stack, so you will have a tiny location for each one, when I say tiny, I mean a 1x1 PIXEL location, so each one has their own individual location, then with Hyper Triggers, constantly recenter the location on the Duran inside of itself, now you have each one with it's own location always following it.

Now, have a large location that can cover all of them with a bit of space to spare, just so they have some ability to spread out, but you at least have to have enough space for it to cover all the Durans at once, now, have a Death Counter, and then have the big location center on each of the ghost's tiny locations individually, then have a trigger with the condition that there is at least 12 Durans in the big location, then add 1 death to the Death Counter, and cycle through all the Durans, adding 1 death to the Death Counter if there's 12 Durans in the big location when it goes around each Duran.

Now, this is the part where you detect if they are bunched or not, if there is at least 1 death in the Death Counter, then you know that at least 1 of the Durans had the other 11 around it, so they are close, but if it's at 0, then they aren't close, you can increase the amount of deaths required for them to be close, and that will make them have to be closer for the trigger not to detect it, if there's at least 1, then simply reset the Death Counter and do it again.

Finally, if the Death Counter is 0, then you use the Move trigger and move all of the Durans to a location they cannot be moved to, I would then order them to one of the tiny locations, so they gather together again.

Tell me if you have no idea what I am talking about.

Someone, your method wouldn't work because the player would lose selection of his units every time it cycled.



None.

Feb 18 2008, 11:48 pm Cardanis Post #7



See, I think I understand what you mean, but theres another problem. The way my map works, you choose what squads and stuff you want, essentially composing your own army. So, there's no way to predertimine the squad size or type while in the map editor. Why wouldn't someone's way work? it'd be cycling the burrowed unit underneath, not the unit itself.



None.

Feb 19 2008, 12:00 am Falkoner Post #8



Yes, but he is giving the unit at certain points, causing it to be deselected.
You can adjust the amount needed depending on what they buy perhaps, maybe use a trigger duplicator and have some sort of limit, but it's extremely location consuming.

Post has been edited 2 time(s), last time on Feb 19 2008, 12:11 am by Falkoner.



None.

Feb 19 2008, 12:19 am Cardanis Post #9



Okay, thankyou. Also, is there any explanation as to how the players past 8 work? Can I use 12 (neutral) for anything? and what about Player 13?



None.

Feb 19 2008, 1:18 am Falkoner Post #10



There was an old topic made about them, so I'll link you to that instead of explaining it.

Also, I think the easiest method you should do for this map is to just have a leader for each player, and have the location be on the leader, so they need to be near the leader.



None.

Feb 19 2008, 1:34 am who Post #11



btw, i was giving a burrowed unit UNDER the unit, so it would not deselect



None.

Feb 19 2008, 1:49 am Falkoner Post #12



Yes, but you give the Duran every time he moves.



None.

Feb 19 2008, 4:42 am pneumatic Post #13



Falkoner's idea about having a squad leader is a good one.

As for detecting when units leave the location, there's a way to do it. It will take a fair amount of triggers, but operationwise, it's very efficient.

In addition to your location-centering triggers (whatever method you choose), have a brief detection period at the beginning of the player's movement phase where you count the number of units he has. You should have one of these triggers for every possible number of units he might have in his squad. For example, if the minimum number of units he might have in a squad is 4, and the maximum number is 12, then you'd want a trigger that detects that he has 4, a trigger that detects he has 5, and so on, all the way up to 12. Then, during the movement phase itself, if he's lacking one unit in the small location then you know it must have moved outside and you can then give control back to the AI.

This is of course based on the turn-based nature of the map, and it's assuming that none of your units can be attacked during the movement phase.

They can be killed off by triggers, though, that's fine -- if you use a trigger to kill off 1 unit, just make sure you subtract 1 from the death count that remembers the number of units. If you kill 2, subtract 2, etc.

Here's the detection method:

C:
It is the start of the turn phase.
It is detected that Current player's squad consists of X number of units.
A:
Modify Deaths for current player: Set to X for WHATEVER.
Preserve trigger.

C:
It is the movement phase.
Current player has suffered exactly X deaths of WHATEVER.
Current player brings at most X - 1 units to SMALL LOCATION.
Give control back to AI.
Preserve trigger.

As for the detection phase, you could use a death count or switch or whatever to indicate that the game is currently in detection mode.

And if units DO get killed, the method will still work. You can detect that, for example:

C:
Death count for WHATEVER is 12.
Current player brings exactly 11 units to SMALL LOCATION.
Current player brings exactly 11 units to LARGE LOCATION.
A:
Modify death count for WHATEVER: Subtract 1.
Preserve trigger.

Again, you'd have to do one of these triggers for every possible number of killed units, per every possible unit squad size, but you're just making lots of triggers, instead of using bulky burrowed zergling systems which can cause slowed, blocky movement and lag. And you're also using only 2 locations.

If you use SCMDraft2's Trigedit, you can use a text editor to duplicate triggers and edit them easily. That might be useful for something like this.

Post has been edited 4 time(s), last time on Feb 19 2008, 4:57 am by razorsnail.



None.

Feb 19 2008, 9:18 am NudeRaider Post #14

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

I haven't read everything in detail, so maybe I overread something why this wouldn't work:
EDIT: Oh, I just read that the squad should stop as soon as ANY unit gets out of range. Seriously this is neither realistic, nor is it practical. I'd go with a leader that does all range detection.

When creating the squad, first place only 1 unit, the "squad leader". Place a 1x1 pixel location on him, then create the other squad members (presumably same unit type, but possibly others too).

When it's movement phase you have some options:
a) Move them via a pointer (e.g. obs)
b) Or move the squad away and move only the leader
c) Move the regular squad members to their leader sometimes

For a) you would have a burrowed ling following the leader which detects the movement range
The squad could always be ordered to the obs. As soon as the ling is out of the range detecting location stop the ordering and move all units to the squad leader (including himself = stop order).

For b) move all units of the squad to a temp location then move the leader back and give it to the player. As soon as the leader gets out of the range detection location give it to the comp, move it onto himself and move all other units back to him.

For c) the player gets to control all of the units and the leader has again a ling following him. Now the problem would be that the units would spread out because of poor group management of sc (or by a stupid player), so teleport all units owned by the player to the leader every say 3 seconds. The player would have to reorder them every 3s though, which could be a pain when trying to walk long distances and/or with many squad members.
As usual, when the ling is outside the range detection location give all units to comp and teleport them to the squad leader for stop order.

The good thing is that the leader is always the center of everything thus making range detection easy. But for the same reason group movement may be difficult. However depending on your priorities one of the solutions should work.

About the Comp Players:
Player 9-12 can be ordered, given, and teleported, so no problem there.
P9-11 will follow attackers around, but P12 is completely passive.
When trying to apply actions to P9-12 you must make sure that the respective trigger is owned by an active player 1-8. Like this:

Player 1
C: P12 brings at most 0 ling to 'range'
A: Give all units to P12
A: Move all units of P12 to ling

I don't know how P13+ can be used.

Post has been edited 1 time(s), last time on Feb 19 2008, 9:25 am by NudeRaider.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-5-20. : 3:08 pm]
Sylph-Of-Space -- woah! nice! thank you!
[2024-5-20. : 4:05 am]
O)FaRTy1billion[MM] -- the setting exists, it's just hidden in a weird place
[2024-5-20. : 4:04 am]
O)FaRTy1billion[MM] -- instead change "Microtile Overlay" to "Impassable"
[2024-5-20. : 4:04 am]
O)FaRTy1billion[MM] -- er, wait, idk why i was looking for height
[2024-5-20. : 4:03 am]
O)FaRTy1billion[MM] -- below the minimap should be a thing that says "Overlay Settings" with a little + button in the corner, press the + to expand it, uncheck Use Defaults, then change "Tile Overlay" to "Height"
[2024-5-20. : 3:57 am]
Sylph-Of-Space -- Unless I'm dum (possible)
[2024-5-20. : 3:57 am]
Sylph-Of-Space -- It would be so so so nice if SCMDraft had some kind of dedicated "walkability" view for the tilesets.
[2024-5-20. : 3:53 am]
Sylph-Of-Space -- :'( dont cry for me cat-gentina
[2024-5-19. : 9:18 pm]
Ultraviolet -- 🔪🐈
[2024-5-19. : 12:34 pm]
NudeRaider -- curiosity kills the cat!
Please log in to shout.


Members Online: 4gabriellac453gg9, Roy, 7lydiac6385fN4