Home   Help Search Login Register  

Author Topic: UnitClass?  (Read 464 times)

0 Members and 1 Guest are viewing this topic.

Silencer

  • Guest
UnitClass?
« on: 09 Jan 2005, 21:11:04 »
I want this in my script:

? (Unittype = air) : goto "AIR"
goto "GROUND"

How can i detect if the unit is a chopper or plane and not a jeep or truck?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:UnitClass?
« Reply #1 on: 09 Jan 2005, 21:32:20 »
How exactly are you running your script??

Anyway, here's simple example:

Code: [Select]
_unit = this select 0

? "Air" countType [_unit] > 0: goto "air"
goto "ground"
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Silencer

  • Guest
Re:UnitClass?
« Reply #2 on: 09 Jan 2005, 22:18:03 »
Thank you very much! :-*

Silencer

  • Guest
Re:UnitClass?
« Reply #3 on: 10 Jan 2005, 00:51:45 »
mmm it is not working :(

I am running one script on different vehicles.
If the vehicle is a ground vehicle than the script must go to "GROUND"
If the vehicle is an air vehicle than the script must go to "AIR"

So I want something like this, but working:

? ( _Vehicle = air ): goto "AIR"
goto "GROUND"

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:UnitClass?
« Reply #4 on: 10 Jan 2005, 12:38:42 »
That example of mine does just what you ask...
And it works...

That example should be executed like this:
[vehiclename] exec "blah.sqs"...

Here's an example just for debugging so you see that it works:
Code: [Select]
_vehicle = _this select 0
; check if vehicle is in base class "Air", if so, goto label #air
? ("Air" countType [_vehicle]) > 0: goto "air"

; if not, goto label #ground
goto "ground"

#air
hint "air"
exit

#ground
hint "ground"
exit
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Silencer

  • Guest
Re:UnitClass?
« Reply #5 on: 10 Jan 2005, 18:27:12 »
Thanks again  :-*