OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Cedaie on 21 Sep 2003, 07:22:34

Title: "Get off my team you imbecile!"
Post by: Cedaie on 21 Sep 2003, 07:22:34
Aight, I want to have a script that allows a unit in my team to join objnull (deattach from my team) depending on which unit I select via F#number (eg F2 is unit 2 as you know)

I'm thinking it's the same concept as the script/s used with the BAS MH-60s when you select units you want for them rope insertion jazz etc.

This I'll put in CTI for those times when you don't want/need a unit in your team or for putting them into Defenses and Deattaching them from your team permanently so you can build more units.

thanks.
-Cedaie.
Title: Re:"Get off my team you imbecile!"
Post by: Terox on 21 Sep 2003, 12:00:34
[Player] join grpnull
Title: Re:"Get off my team you imbecile!"
Post by: Komuna on 24 Sep 2003, 10:53:52
Hmm... The question seems a little more complicated than that.

Indeed, Unit join ObjNull will deattach the unit from a certain group.
However, what we really need is a away of deattaching the units which the player has selected in his group...

OnMapSingleClick can detect the units that are currently selected by the player, but that's not the command we want, right? ;D
Then, what i propose to you is to search for the script which is used by BAS to detect those units.

I think I didn't help you... ::)
Title: Re:"Get off my team you imbecile!"
Post by: m21man on 25 Sep 2003, 15:50:19
The BAS MH-60 script probably uses the onmapsingleclick command :P.
Title: Re:"Get off my team you imbecile!"
Post by: skreet on 26 Sep 2003, 00:09:05
I did that with addAction[]. it worked.. but not exactly like I expected..
the idea was that by selecting the unit (ex. F3) and pressing 6 ( action) and from there an action.. let's say: release from unit. problem was that when i was going to release a unit, the list showed all of the actions from my team.. if I had 3 soldiers + me, there was 3 release actions in the list.. and if i commanded him to do a wrong one, he realeased a wrong guy. there was actually a workaround for that, so that he still released himself.. but he they still had almost all of the action listed in the list.. so.. that's for that idea.
just telling you this, that you would not make the same mistake  :D
Title: Re:"Get off my team you imbecile!"
Post by: Spinor on 26 Sep 2003, 14:26:40
I can also only think of using the onMapSingleClick command to properly do this. The only downside is, the player has to click on the map to release the units. This can be used as an advantage though, as the click position might denote the destination of the released units.

Try the following (untested):

In the init.sqs, define your map click handler:
onMapSingleClick {if(_alt AND _shift AND count _units != 0) then {[_units,_pos] exec "release.sqs"; true}}

release.sqs:
;------------------------------------------
_units = _this select 0
_pos = _this select 1

_units join grpNull
(group (_units select 0)) move _pos
;-------------------------------------------

In order to release the units, the player must select them via F1-F12, then click on the map while holding the SHIFT and ALT keys down (this is a failsafe measure to avoid accidental release).

Hope this helps,
Spinor