Home   Help Search Login Register  

Author Topic: Is a unit AI?  (Read 1967 times)

0 Members and 1 Guest are viewing this topic.

Offline angusjm

  • Contributing Member
  • **
    • Virtual SAS
Is a unit AI?
« on: 09 Aug 2005, 20:01:27 »
I'm looking for a simple way to tell if a unit is AI or not.

It has to work in multiplayer so:
? _unit == player
is not good enough.

Nor is the deletevehicle test, because I dont want the unit deleted if it is AI.

Is there any simple test?

Thanks,
angusjm

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Is a unit AI?
« Reply #1 on: 09 Aug 2005, 21:37:59 »
AI unit is local on server. Thus giving us the option to ask
?local _unit: unit is either playing on server machine, or is AI

To take this further you can add
?local _unit && _unit != player: unit is not player and is on server, so it must be AI

I came to this very quickly. I may be totally off, but it seems logical doesn't it?  :)


Quote
Nor is the deletevehicle test, because I dont want the unit deleted if it is AI.
What on earth is a deletevehicle test?! And do I even dare what will happen if you delete a player unit  :o
Not all is lost.

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:Is a unit AI?
« Reply #2 on: 09 Aug 2005, 22:38:06 »
Quote
What on earth is a deletevehicle test?! And do I even dare what will happen if you delete a player unit :o
my guess (based on what he said) is that the deletevehicle command doesn't work on players, so if you wanted to "test" whether or not a unit was a player, you could try to delete him and see what happens :o :D ;D
« Last Edit: 09 Aug 2005, 22:40:20 by .pablo. »

DBR_ONIX

  • Guest
Re:Is a unit AI?
« Reply #3 on: 10 Aug 2005, 01:35:00 »
That's like shooting someone to see if their alive, if they should, chances are their alive.. ::)
Anyway
_ai = (player == _this select 0)

_ai will be true if the unit is a real person, false if the unit is an AI (I think at this time I could be wrong :P)
- Ben

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Is a unit AI?
« Reply #4 on: 10 Aug 2005, 16:28:48 »
is it one specific unit that you need to check
or is it more than 1

and why do u need to do this, there maybe a better way or a simpler solution

perhaps do the following

lets say the units name is W1

INIT.sqs
Quote
tx_IamAi = true
if(player == W1)then{tx_IamAi = false; Publicvariable "tx_IamAi"}


therefore if you use
?(tx_IamAi): add your code here
the code will only be run if W1 is an ai

hope thats simple enough
« Last Edit: 11 Aug 2005, 01:06:48 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline benreeper

  • Members
  • *
  • I'm a llama!
Re:Is a unit AI?
« Reply #5 on: 13 Aug 2005, 05:46:41 »
Aren't AI units in a clients group non-local and non-player?  How would you check for them?
--Ben

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Is a unit AI?
« Reply #6 on: 13 Aug 2005, 13:51:13 »
Aren't AI units in a clients group non-local and non-player?  How would you check for them?
--Ben

tx_IamAi = true
if(player == W1)then{tx_IamAi = false; Publicvariable "tx_IamAi"}


will only change the boolean tx_IamAi to false, if the player unit is W1 on any client

if w1 is in the players group but not the actual players unit, it will remain false


on an additional note, a pause (~2) would probably be required to give the clients enough time to transmit/receive the boolean pv before any conditional code is run on the tx_IamAi variable
« Last Edit: 13 Aug 2005, 13:51:32 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

ShowID

  • Guest
Re:Is a unit AI?
« Reply #7 on: 13 Aug 2005, 14:36:08 »
Yes that would work.  I'm going to try it out.  A pause of 2s would be reasonable in the context - if the crew of a helicopter addon are AI then the CAS script will be activated.

Thanks for your contributions.

ShowID
« Last Edit: 13 Aug 2005, 14:36:28 by ShowID »