Jump to content
Sign in to follow this  
MetXD

"IF" script help

Recommended Posts

Hi to all, i need help with a script.

These script can me unload a prisoner from my shoulder into a helicopter, checking if it is already into the chopper.

I have a problem (Becouse i really don't understand the If commend) with the script.

if (!prisoner1 in UH1H) then {detach prisoner1; prisoner1 switchmove ""; exit}
if (!prisoner2 in UH1H) then {detach prisoner2; prisoner2 switchmove ""; exit}
if (!prisoner3 in UH1H) then {detach prisoner3; prisoner3 switchmove ""; exit}

I wont exec this script once time for once prisoner. (Don't look the things after "Then".)

Where i wrong?

Share this post


Link to post
Share on other sites

I'm sorry, I don't really understand your question.

the if-part checks, if the prisoners are NOT already in the UH1H. "!" is the opposite of a statement:

if (prisoner1 in UH1H) = checks if prisoner1 is in the UH1H

if (!prisoner1 in UH1H) = checks if prisoner 1 is not in the UH1H

It would be better to put the "!" in front of a bracket, though "!(prisoner1 in UH1H)"

If your question was, how not to have one line per prisoner, put the prisoners in an array and use this: http://community.bistudio.com/wiki/forEach

Share this post


Link to post
Share on other sites

I explain my question:

1. I go near the prisoner and i get a new action on it.

2. This action start a script for taking the hostage from ground on my shoulder

This:


_this select 0 removeaction A2
_unit = _this select 1
On = False
_this select 0 switchmove "AmovPsitMstpSnonWpstDnon_ground"
~2
_this select 0 switchmove "AinjPfalMstpSnonWnonDnon_carried_Up"
_unit switchmove "AcinPknlMstpSrasWrflDnon_AcinPercMrunSrasWrflDnon"
_unit attachto[_this select 0,[0.1,0.55,0]]
_unit setdir 180
~9.5
detach _unit
_this select 0 attachto[_unit,[0.1,0.1,-0.05]]
_this select 0 setdir 180
A1 = UH1H addAction ["Rilascia", "Ostaggi\Rilascia.sqf", nil, 6, True, True, "", "(_target distance _this) < 4"]
exit
[/Code]

3. After the finish of script i get my hostage on my shoulder with the command "attachto"

4. I go to my chopper where i must put the hostage on my shoulder into the chopper like a normal player

5. I am free to take another hostage and restart from point one

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×