Jump to content

Pilot and copilot tranferable commands


RedDaemons
 Share

You are about to reply to a thread that has been inactive for 3676 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi, friends!

First of all, I have to say a big thank you for all help I have here. This is very important to me.

I am still scripting my own helicopter flight system and I am proud to say that, beyond a lot of cool and interesting features (including flying very well), I already finished the basic avatar controls: owner mode, group mode, guest mode, lock/unlock mode, eject copilot and/or passengers.

At this time, I am learning how I can script the copilot mode, transfering to a copilot the control of the aircraft. I really do not know how to start. I am not asking for a code, because I want to script by myself. But, if someone can help me with the logic, helping to clear my ideas how to think this feature. 

I found this post http://community.secondlife.com/t5/LSL-Scripting/The-KEY-to-Avatars/m-p/1402061#M9036  and it seems to have a good logic describing the relation between pilot and copilot in the same aircraft.

Can someone confirm if the logic is right?

- The copilot seat get the UUID of the pilot, renaming the copilot with this UUID in order to allow the copilot do send comands and take permissions to control the aircraft, like being the pilot UUID.

or

- There are any other way to allow pilot and copilot to control with their own UUID

Thank you for any information.

Link to comment
Share on other sites

That logic is fine, but it probably doesn't apply directly to your situation.  I suspect that you are controlling your helicopter with commands to a control event, which means that whichever avatar is handling the controls has to have granted PERMISSION_TAKE_CONTROLS.  You can't grant permissions to more than one avatar at a time from a single script.  If you want to have two people each be able to fly the helicopter, therefore, you'll have to have two scripts. The copilot's script wouldn't need to have much more than the code to request permissions and the control event to handle them. Anything else connected to the aircraft could be managed from the pilot's script, so that you don't get competing dialogs, cross-talking listeners, and colliding sit targets. 

Link to comment
Share on other sites

Rolig

hummm, interesting! I was not thinking by this point of view. Yes, two scripts make all sense. I can release the permissions of the pilot, transfering it to copilot. A new script will take permissions for the avatar identified as copilot. I can do the same to recover the control to pilot. By this way, I can write a single control script for both, just controlling who is using, flagging correctly pilot and copilot, releasing and taking control of the keys! Nice point of view! Thank you so much.

Link to comment
Share on other sites

Well, if you don't want the pilot and co-pilot to be able to control the aircraft at the same time, you can do it with a single script. Just put a big red button on the dashboard of the helicopter and use it as a switch ...

touch_start (integer num){    if (llGetLinkName(llDetectedLinkNumber(0)) == "Big Red Button")    {        llRequestPermissions(llDetectedKey(0), PERMISSION_TAKE_CONTROLS);    }}

 You only need to have two scripts if BOTH people need to have controls at the same time.  That's what I assumed you were trying to do.

 

 

  • Like 1
Link to comment
Share on other sites

No, no. I do not want the both controlling at the same time.

I want to change who is controlling, but only one can control.

But thinking on your code, I will have to create another way, because I do not want the copilot click in anywhere to get the control. Pilot must type in chat "copilot" or click in a menu or hud and transfer the control to copilot. So, I have to know "who is the copilot" to grant control. I know how to do it now :-D

Thank you.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3676 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...