Home   Help Search Login Register  

Author Topic: Friend or foe  (Read 3697 times)

0 Members and 1 Guest are viewing this topic.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Friend or foe
« on: 21 Jun 2007, 00:11:23 »
That is the question.

Is unit A friend or foe of unit B?

How to know?

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Friend or foe
« Reply #1 on: 21 Jun 2007, 00:27:18 »
u cud use countEnemy

unitA countEnemy [unitB] > 0

even tho i think deres a better way ???

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Friend or foe
« Reply #2 on: 21 Jun 2007, 00:30:05 »
LOL Yep, I'm waiting for that suposed "better way". But it seems to not be so obvious.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Friend or foe
« Reply #3 on: 21 Jun 2007, 00:39:08 »
deres da enemy command as in

unitA enemy (SIDE unitB)

now dat returns a true or false... works 4 whole side not 4 a unit tho

i hope i got dat 1 right... enemy command is not explained good

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Friend or foe
« Reply #4 on: 21 Jun 2007, 00:43:10 »
Seems "enemy" is just the side of renegade units, these that kill any friendly becomes renegade (enemy side).

Offline Cheetah

  • Former Staff
  • ****
Re: Friend or foe
« Reply #5 on: 21 Jun 2007, 00:45:05 »
The friendly command has almost the same description but I don't know how one could use it to determine if a unit is friend or foe.

There are numerous alternatives for this but as far as I know there is no single command which can do the job right now. Might be good to create a function for this.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Friend or foe
« Reply #6 on: 21 Jun 2007, 01:01:34 »
u cud also use da findNearestEnemy...

unitA findNearestEnemy (getpos unitB)

shud return unitB if it is

but dats probably not wat ur lookin 4 also

btw in da COMREF it says dat sideEnemy is used 4 renegades... but it doesnt say dat on da Enemy command

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Friend or foe
« Reply #7 on: 21 Jun 2007, 01:04:29 »
"enemy" seems to be the same, that is a side for enemies to all sides (renegades).

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Friend or foe
« Reply #8 on: 21 Jun 2007, 13:40:52 »
Hmm.

KnowsAbout ?

I don't know if this is any use. ???

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Friend or foe
« Reply #9 on: 21 Jun 2007, 13:45:30 »
mmmm nope, knowsabout tells you how much do you "know" a unit, but it is worthless to determine if friend or foe.

Offline Rellikki

  • Members
  • *
  • Die-hard OFP player
Re: Friend or foe
« Reply #10 on: 21 Jun 2007, 14:21:42 »
If the units A and B are on the same side, how about checking unit A's rating?
According to Biki:

Quote
Each hit in a single player game will affect the player's rating. If it goes below -2000, he will be considered an enemy, and be attacked by all units.

So you'd need to check if unit A's rating is below -2000, which happens like this (I think):

Code: [Select]
rating unit_A = -2000 : goto "enemy"
goto "friendly"

#enemy
Hint "Unit A is an enemy"
Exit

#friendly
Hint "Unit A is friendly"
Exit

Just a thought, not sure if it works.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Friend or foe
« Reply #11 on: 21 Jun 2007, 16:19:37 »
Won't work. All units have a positive rating unless they attack their own side.
urp!

Offline Blanco

  • Former Staff
  • ****
Re: Friend or foe
« Reply #12 on: 21 Jun 2007, 19:03:52 »
Quote
u cud use countEnemy

unitA countEnemy [unitB] > 0

even tho i think deres a better way Huh?

LCD OUT

Note that empty enemy vehicles return as friendly, a least in OFP. I don't know how the command behave in Arma.
« Last Edit: 21 Jun 2007, 19:05:36 by Blanco »
Search or search or search before you ask.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Friend or foe
« Reply #13 on: 21 Jun 2007, 19:06:48 »
And that is good, dont destroy what you may steal later  :D

Offline Blanco

  • Former Staff
  • ****
Re: Friend or foe
« Reply #14 on: 21 Jun 2007, 19:09:41 »
Yes, but why do they destroy the vehicle when the crew disembarks? What is the real threat here? The empty vehicle or the crew that's firing upon you?

« Last Edit: 21 Jun 2007, 19:12:44 by Blanco »
Search or search or search before you ask.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Friend or foe
« Reply #15 on: 21 Jun 2007, 19:52:03 »
who destroys em ? i had a prob w/ mision not endin cuz my gunner dont wanna destroy dese tanks  ::)

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Friend or foe
« Reply #16 on: 21 Jun 2007, 20:57:41 »
Well, once they have a target, they will keep firing at it until the target cannot fire back, and that is also the reason LCD gunner dont want to kill some enemy tanks, because they cannot fire (gun damaged or destroyed).

BACK ON TOPIC: FRIEND OR FOE?  :P

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Friend or foe
« Reply #17 on: 22 Jun 2007, 01:30:45 »
Here's a FriendOrFoe function.  See attached sample mission.

The function handles the fact that we have 4 unit sides (east, west, guerrila, civilian), and the fact that civilian/guerilla units are either friend or foe to others based on the Mission Designer picking one of the following:

- Guerillas friendly to west      (i.e., RACS friendly to BLUFOR)
- Guerillas friendly to east       (i.e., RACS friendly to OPFOR)
- Guerillas friendly to nobody   (i.e., RACS friendly to Nobody)
- Guerillas friendly to all         (i.e., RACS friendly to All sides)

Since I don't know of an ARMA function that will tell me which option the Mission Designer chose, we will have to pass in a variable indicating the chosen option.  (Please tell me if there is a way to look this up!).

A sample mission is attached that allows you test all combinations of unit sides and "guerilla friendly to ..." combinations.

Note:  This function has NOT been tested on vehicles yet.

And Here's the function code:
 
Code: [Select]
// *****************************************************
// ** friendOrFoe.sqf
// **
// ** Returns "Friend" or "Foe" for relationship of unit A to unit B.
// **
// ** Example call:   _fof = [unitA, unitB, guerillaStatus] call friendOrFoe;
// **
// ** guerillaStatus must be one of four values depending on who guerillas (aka Independent, aka Resistance)
// ** are defined as friendly to in mission editor:
// **
// ** "GFE" - Guerillas friendly to East
// ** "GFW" - Guerillas friendly to West
// ** "GFN" - Guerillas friendly to Nobody
// ** "GFA" - Guerillas friendly to All Sides (everybody)
// **
// ** Note that Civs are always friendly with Guerillas, and are treated same as Guerillas
// ** when compared to East or West.
// *****************************************************

_unitA    = _this select 0;
_unitB    = _this select 1;
_guerillaStatus = _this select 2;

_sideA = side _unitA;
_sideB = side _unitB;
_friendOrFoe = "";

//player sidechat format ["_sideA is %1, _sideB is %2",_sideA, _sideB];

// For guerilla or civ units, set side variables to East or West depending on
// _guerillaStatus input.

if ((_sideA == resistance or _sideA == civilian) and _guerillaStatus == "GFE") then
{
   _sideA = EAST;
};
if ((_sideA == resistance or _sideA == civilian) and _guerillaStatus == "GFW") then
{
   _sideA = WEST;
};

if ((_sideB == resistance or _sideB == civilian) and _guerillaStatus == "GFE") then
{
   _sideB = EAST;
};
if ((_sideB == resistance or _sideB == civilian) and _guerillaStatus == "GFW") then
{
   _sideB = WEST;
};

// If units on same side, or units a combination of civilian and resistance, then return Friend.
if ((_sideA == _sideB) or (_sideA == civilian and _sideB == resistance) or (_sideA == resistance and _sideB == civilian)) then

  _friendOrFoe = "Friend";
}
else
{
  // If Guerilla Friendly to ALL, and either unit is a civilian or resistance, then return Friend.
  if (_guerillaStatus == "GFA" and (_sideA == civilian or _sideA == resistance or _sideB == civilian or _sideB == resistance)) then
  {
     _friendOrFoe = "Friend";
  }
  else
  {
    // ELSE, return Foe.
    _friendOrFoe = "Foe";
  };
};
_friendOrFoe
« Last Edit: 22 Jun 2007, 01:32:44 by johnnyboy »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Friend or foe
« Reply #18 on: 22 Jun 2007, 01:39:30 »
hehe you are cheating having guerillaStatus as a parameter of the script. ;)

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Friend or foe
« Reply #19 on: 22 Jun 2007, 01:44:00 »
Quote
hehe you are cheating having guerillaStatus as a parameter of the script

As Dirty Harry once said:  "A man's got to know his limitations..."  :)

But its a reasonable solution, since once chosen by Mission Designer, guerillaStatus cannot be changed during game run-time, therefore designer can use this function, and specify the correct guerillaStatus, and depend on it to work!

Edit:  If anybody thinks this is useful enough, I'll submit it over at the Editing/Scripting Beta Testing forum.  Let me know.
« Last Edit: 22 Jun 2007, 01:46:56 by johnnyboy »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Cheetah

  • Former Staff
  • ****
Re: Friend or foe
« Reply #20 on: 22 Jun 2007, 02:10:49 »
I suggest that you submit it, you never know if someone is going to need such a script in the future. Easier to find in the resource beta.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Friend or foe
« Reply #21 on: 22 Jun 2007, 02:15:10 »
u can actually make a quick check inside da function 2 check who resistance is friendly 2... u can create a trigger and use da countenemy command :D

[edit] btw u actually can change resistances side (nd ny oder side) during gameplay... use da setFriend command

LCD OUT

« Last Edit: 22 Jun 2007, 15:32:15 by LCD »
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta