Jump to content
Sign in to follow this  
giallustio

Group problem

Recommended Posts

Hi guys!

I have some problems with this functions:

BTC_Get_Group:

_pos = _this select 0;
_men = nearestObjects [_pos, ["Man"], 200];
if (count _men > 0) then
{
_group  = group (_men select 0);
};
_group

BTC_Get_WP:

_group = [position a] call BTC_Get_Group;
_wp = waypoints _group;
hint format ["%1",_wp];

This is the error in the RPT

Error in expression <_wp = waypoints B 1-1-A;>
 Error position: <1-1-A;>

Any help?

Edited by Giallustio

Share this post


Link to post
Share on other sites
_pos = _this select 0;
_men = nearestObjects [_pos, ["Man"], 200];
if (count _m[color="Red"]a[/color]n > 0) then
{
_group  = group (_men select 0);
};
_group

Share this post


Link to post
Share on other sites

_pos = _this select 0;
_men = nearestObjects [_pos, ["Man"], 200];
if (count [color="Red"]_man[/color] > 0) then
{
_group  = group (_men select 0);
};
_group

_man is undefined (should be _men), thus _group is null.

EDIT : ninja'd

Share this post


Link to post
Share on other sites

No guys, this is only a copy paste error :)

In the RPT the error is anothe one :(

PS: fixed the first post

Share this post


Link to post
Share on other sites

Counterquestion: What happens with your function, if there is a group without waypoint?

:rolleyes:

Share this post


Link to post
Share on other sites

What's returned is something like -> B 1-1-A

But if you use this value in a script returns an error.

@ProfTournesol

The error always shows up and the hint doesn't work because it's in the following line.

Share this post


Link to post
Share on other sites

have you tried defining _group

private ["_group"];

_pos = _this select 0;
_men = nearestObjects [_pos, ["Man"], 50];
if (count _men > 0) then
{
_group  = group (_men select 0);

};

_group

Share this post


Link to post
Share on other sites

Strange I get a list of waypoints if there are multiple waypoints.

If there are no waypoints you just get the default wp

if units aren't found in the area it returns the word Array.

http://www.sendspace.com/file/8gp5pj

I'm not sure what your trying to do, the script only reports the waypoints of the last unit found in the _men list.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Mmm...

Maybe it shows an error when i execute the function because i stored the name group as string and then i use the "compile" command to spawn the entire code...Could be?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×