Advertisement

Author Topic: Position of group leader  (Read 687 times)

0 Members and 1 Guest are viewing this topic.

Offline lichthuis

  • Members
  • *
Position of group leader
« on: 18 May 2009, 21:28:05 »
Hi there,

I'm creating a mission for ArmA based on the "Hunting Chris Ryan" series, broadcasted by BBC and Discovery channel in the past. Chris, known from the SAS unit Bravo Two Zero during the Gulf War, has to complete some objectives while a hunter force tries to track him down.

Since I want this mission to work as a co-op mission too, I would like to find out how to retrieve the position of a group or group leader. With these coordinates I can let the so called 'Hunter Force' follow their path.

I did try the search function, but 'group' and 'position' are too common search words, so no solution found...

Maybe you guys know some similar missions or useful scripts for my mission. I'll be interested in that info too...

Thanks in advance!

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Position of group leader
« Reply #1 on: 18 May 2009, 21:55:36 »
To "mark" the position of the hunted:

preyPosition = position leader preyGroup; publicVariable "preyPosition"


To make the hunters move there:

hunterGroup move preyPosition

Laggy
« Last Edit: 18 May 2009, 21:58:01 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline lichthuis

  • Members
  • *
Re: Position of group leader
« Reply #2 on: 18 May 2009, 22:03:59 »
Thank you for your quick reply!  :good:

I will try this option. I was close to this solution, but used underscores between leader and groupname, like leader_groupName.

Edit:
mmm... Still no luck.
I grouped the player and the second unit by typing in the player's init box:
preyGroup = units group this;

In a script, called via Radio Alpha for testing, I wrote:

preyPosition = position leader preyGroup;
publicVariable "preyPosition";
hunterGroup move preyPosition;
exit;

In the mission preview there appears an error message saying: 'preyPosition = position leader preyGroup|#|; Error leader: Type Array, expected Object,Group

I also tried:
preyPosition = position leader group preyGroup; -> no luck
preyPosition = position (leader preyGroup); -> no luck
preyPosition = position leader group player; -> works, but what if no player should be hunted?

EDIT 2:

OK, solved it!

preyPosition = position leader (preyGroup select 0);

Don't know why, but this works fine for now...
« Last Edit: 19 May 2009, 13:14:10 by lichthuis »

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Position of group leader
« Reply #3 on: 19 May 2009, 20:48:41 »
It works as I described if...

In leaders init field write:
preyGroup = group this

 :)
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Rommel92

  • Members
  • *
Re: Position of group leader
« Reply #4 on: 21 May 2009, 03:34:25 »
preyPosition = position leader (preyGroup select 0);

Don't know why, but this works fine for now...


Haha, nice playing around there.

What you've done is instead of returning the group (preyGroup), its a list/array of all the units in that group. To make it work you've chose the first member in that array (preyGroup select 0) then gotten the position of his/her leader; which inevitably would be the same as:

Code: [Select]
preyGroup = group _this;
preyPos = getpos leader preyGroup;