Home   Help Search Login Register  

Author Topic: Get nearest group in "Infantry1" list  (Read 452 times)

0 Members and 1 Guest are viewing this topic.

mikkelfh

  • Guest
Get nearest group in "Infantry1" list
« on: 13 Jun 2004, 22:41:35 »
I click the map...
I want to select the infantry group closest to the click position...

I manually assign some groups to various lists named infantry1/infantry2...
If nearest group is not on "Infantry1" list, next-nearest group is checked...

Why two lists (infantry1 & infantry2)?
I don't want to select members of groups on the "infantry2" list...

I believe the list thing can be done with ThisList, but dunno how...
Is this possible? In multiplayer? If so, HOW?

It's for a kind of Spinor's Command Engine MP Super-Light version...
« Last Edit: 13 Jun 2004, 23:21:38 by mikkelfh »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Get nearest group in "Infantry1" list
« Reply #1 on: 14 Jun 2004, 13:53:41 »
thislist is a trigger command:  "thislist" is the array of units in the trigger area that would fire the trigger.   For example, all the east units in an "east present" trigger.   (Or an east not present one, actually.)

There are two ways to identify the position of a group:  either use the position of the group leader as a proxy for the group's position (getPos leader grp1); or discover the positions of all the group members and use trigonometry to combine them into an "average" position.    In this case you could perhaps use the position of the nearest soldier as a proxy.

Once you have the position, you can use the distance command to measure the distance between it and the click.    You'll probably have to put a GL at each position to give you something to measure.    Notice that the click will (I think) be at sea level not ground level, so you may have to be careful.  

If you have manually assigned groups then your array of groups is the one that you want it to be:   infantry2 don't come into this at all.     In other words, you don't need to check if the infantry group is in 1 or 2, just excercise the script on 1 only.

Sadly I'm not enough of a scripter to take this much further, but I hope that helps.     I don't know much about MP either, except that scripts are a little tricky.  I suspect in this case you would run the script on the server only and only broadcast the result.


Plenty of reviewed ArmA missions for you to play