OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: B-2-0 on 09 Oct 2003, 11:45:38

Title: How to delete un-used chopper?
Post by: B-2-0 on 09 Oct 2003, 11:45:38
I have a squad inserting in 2 AI controlled choppers but if i decide i don't want to take all the squad it looks kinda stupid having an empty chopper fly in with the full one.

How do i delete the chopper if there is nobody in it?

I would rather do it from init.sqs or by script if possible rather than using triggers :)

Thx in advance

[Edit] I have tried ? notalive dude1 and notalive dude2 and notalive dude3 deleteunit chopper......in the init.sqs but it doesn't work
Title: Re:How to delete un-used chopper?
Post by: Tomb on 09 Oct 2003, 12:58:10
 :) name the bird:   bird1

then use a condition (don't put this in the INIT field of anyone, but in an INIT trigger)..


1.) name the group of AI morons in someguys INIT field:

           MyMorons=units group this

2.)  then use the condition:

           "alive _x" count MyMorons <1

3.)  and the activation:

            DeleteVehicle Bird1d; DeleteVehicle bird1g; deleteVehicle Bird1

See, thats the pilot, the gunner, and then the choppa herself. Crew first, then vehicle.

Try it fer size, matey! :thumbsup:


Title: Re:How to delete un-used chopper?
Post by: B-2-0 on 09 Oct 2003, 13:15:00
Great stuff Tomb, thx! ;D

But ;D

Is there a way to do it using scripts rather than triggers?

I am fighting a lag battle with this mission as it is >:(
Title: Re:How to delete un-used chopper?
Post by: Mr.BoDean on 09 Oct 2003, 20:57:10

Ya, B2 Bomber....som'n like dis:

?("alive _x" count MyMorons <1): goto "killchoppa"

goto "end"

#killchoppa

DeleteVehicle Bird1d
DeleteVehicle bird1g
deleteVehicle Bird1

#end
exit


 No guarantees, but try it out.  8)
Title: Re:How to delete un-used chopper?
Post by: Tomb on 09 Oct 2003, 21:24:35
neah changes... but where triggers use "Condition" fields, scrolls just have a "?" mark.

but ya know this, right?! thats all there is to it, m8  :)

here's the scripted version:

=============================

; count all in chopper

?(("_x in Bird1" count units GroupName) <1): deleteVehicle Bird1

; that would (if <1) activate the stuff after the colon above, and thus delete the bird if she's empty.

; But if there is a CREW flying the bird, ya better count CARGO units only!  :o
; so crew in helo must be ==2 (driver, gunner), or else the bird is not deleted.

; exit script if any soldiers are in cargo.

?!(count (crew Bird1) >2): exit

; delete bird if she only carries the pilot, gunner.

?(count (crew Bird1) <=2): delete.... etc.


====================

that should do it, m8

Title: Re:How to delete un-used chopper?
Post by: Mr.BoDean on 09 Oct 2003, 23:25:44
 :-X  :-X Oh , okay , what Tomb said then!  :o  I didn't know crew referred to anything BUT the pilot and gunner. Very odd it would include units in cargo.  :-\
Title: Re:How to delete un-used chopper?
Post by: B-2-0 on 12 Oct 2003, 17:03:57
Great stuff Tomb...thx :thumbsup: