OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Silencer on 09 Jan 2005, 21:11:04

Title: UnitClass?
Post by: Silencer 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?
Title: Re:UnitClass?
Post by: h- 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"
Title: Re:UnitClass?
Post by: Silencer on 09 Jan 2005, 22:18:03
Thank you very much! :-*
Title: Re:UnitClass?
Post by: Silencer 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"
Title: Re:UnitClass?
Post by: h- 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
Title: Re:UnitClass?
Post by: Silencer on 10 Jan 2005, 18:27:12
Thanks again  :-*