Jump to content
Sign in to follow this  
nullsystems

Pilot, chopper problem - if / while

Recommended Posts

**UPDATE**

Hi all

I have this complicated if else thing going on and I cant figure it out fully, can someone please advise me on what I have so far?

Heres the deal:

Two dialogs are requested at different times.

1: If within 4 meters & heli1 = empty { addAction for dialog1 & do not show action for dialog2}

2: If you are now the pilot of heli1 { addAction for dialog2  & removeAction for dialog1}

3: If you are not within 4 meters or you are not the pilot { removeAction for dialog1 and 2 }

Heres what I got so far:

#radius

@ player distance heli1 < 4

?!alive heli1 : heli1 removeaction _act;exit

?isEngineOn heli1 : heli1 removeaction _act;exit

_act = heli1 addAction ["Enter KeyCode","RecruitAT.sqf"]

@ !isNull driver heli1

heli1 removeaction _act

@ player == driver heli1

heli1 removeaction _act

_act1 = heli1 addAction ["Chopper Panel","chopperpanel.sqf"]

@ player distance heli1 > 4 || player !driver heli1

?!alive heli1 : heli1 removeaction _act;exit

heli1 removeaction _act

heli1 removeaction _act1

goto "radius"

Error shows up: @ player distance heli1 > 4 || player !driver heli1

Says expected bool at the || markers.

Also, in multiplayer ( which is what its designed for )...the panel 2 comes up for anyone in the chopper.

(code taken from another source in BI forums, thank you )

This is of course executed from the init line of the heli1.

Can someone please help a little further, my brain died lol

Thank you in advance thumbs-up.gif

Share this post


Link to post
Share on other sites

You're in dire need of some ()'s.

Always use them, even if you don't think you need them, or if it doesn't error. It keeps things nicely organized.

For instance:

@ ( (player distance heli1 > 4) || (player !driver heli1) )

The interpreter will start with the innermost parenthesis and work outwards. Think of anything inside the () Like this:

((long expression) || (long expression)) =  ( x || y )  =  (z)

Now the interpreter knows exactly what you mean. Remember the computer is dumb, it just does what you tell it to. smile_o.gif

Share this post


Link to post
Share on other sites

How'd that work for you? Any luck?

I'm planning on creating a scenario like you have set up to test out some alternate options for ya.

Share this post


Link to post
Share on other sites

I finally got it figured out with the (). But I can add them in later.

Thank you for your rational and patiant response!

I have the dialog working perfect now wink_o.gif

Thank you !

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  

×