OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: lichthuis 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!
-
To "mark" the position of the hunted:
preyPosition = position leader preyGroup; publicVariable "preyPosition"
To make the hunters move there:
hunterGroup move preyPosition
Laggy
-
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...
-
It works as I described if...
In leaders init field write:
preyGroup = group this
:)
-
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:
preyGroup = group _this;
preyPos = getpos leader preyGroup;