Jump to content
Sign in to follow this  
snkman

countFriendly BUG?

Recommended Posts

Hey guy's,

well just made some test's with the command countFriendly, and it seems that the command has a bug....

Player side = West

Enemy side = East

Seems to work with enemy Infanterie only, enemy Tanks or Aircraft will be detected as Friendly???

if i use:

Place a soldier ( side West ) on the map ( Player )

Place a T72 on the map, called T72 ( This is side East )

Now the T72 should not be counted as Friendly to the player, becouse the T72 is East and the player is West!

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

if (player countFriendly [T72] > 0) then

{

hint "Bug!";

};

Someone can confirm this bug??

Share this post


Link to post
Share on other sites

Maybe you need to recognize the tank as enemy before, otherwise it is probably still assumed to be friendly.

Share this post


Link to post
Share on other sites

To do what T_D is suggesting, you could try placing an enemy infantry unit somewhere on the map where he won't interfere, or you can use setFriend to do it through a script.

Share this post


Link to post
Share on other sites
Maybe you need to recognize the tank as enemy before, otherwise it is probably still assumed to be friendly.

Thank's for the replays.

Well but that's not logical...

East is Enemy to West ( By Default ) so why telling a East Tank to have a West unit as enemy... crazy_o.gif

Share this post


Link to post
Share on other sites

I can only confirm this for the time period during the mission initialisation. After that (a few seconds after mission start) everything works as expected, even if (in this example) the player doesnt know anything about the T72.

Share this post


Link to post
Share on other sites
I can only confirm this for the time period during the mission initialisation. After that (a few seconds after mission start) everything works as expected, even if (in this example) the player doesnt know anything about the T72.

I get the same, for both empty vehicles and those occupied by enemy.

Share this post


Link to post
Share on other sites

I think you have to check the crew and not the vehicle !

A vehicle should be allways neutral, the side=? in the vehicle config is only used for bind crewed vehicles to a specific side.

That's imo very logical  whistle.gifwink_o.gif

Share this post


Link to post
Share on other sites

Hmm... yes sounds logical Lester but bevore i check with "countFriendly" i do

GL3_Init.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_unit = _this select 0;

if !(_unit isKindOf "Man") then {{[_x] call compile preprocessFile (GL3_Path+"GL3_Init.sqf")}} forEach (crew _unit);

[_unit] execVM (GL3_Path+"GL3_Core.sqf");

So the Crew is already checked.

Like dengibtsschon already said a few secounds after the mission is initialized the countFriendly command works like it should... So it's not working for me, becouse i do initialize all units and vehicles via a Init Event Handler, which is triggered way bevore the mission get's started.

Share this post


Link to post
Share on other sites

SNKMAN,

if I remember correctly it always (even in OFP) took up to 30 seconds before a unit and its properties was really known by the game engine. You can still observe this behaviour if you spawn an empty vehicle right in front of you. It takes anything from 1 to 30 seconds before you can enter it. It could be that your script falls victim to this.

To work around this I'd do this. If your script knows who's friend and foe (if west then east, if east then everybody smile_o.gif ) you could use the "countside" command instead. Does your script know at runtime?

Cheers,

VictorFarbau

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  

×