Register Calendar Latest Topics

  Author   Comment  

Posts: 30
Reply with quote  #1 

If I make a script with two or more player ships, how is if_docked evaluated?

Right now, I'm assuming that if one player ship is docked, I'll get a true result, however, it may be that all ships have to be docked to get a true result. Or it could be that if_docked only evaluates against the first ship (ugly, but possible).

Assume one base:
1. Artemis docked, Intrepid docked: if_docked = true
2. Artemis not docked, Intrepid not docked: if_docked = false
3. Artemis docked, Intrepid not docked: if_docked = true (or false, I don't know)
4. Artemis not docked, Intrepid docked: if_docked = true (or false, I don't know)


Posts: 2,799
Reply with quote  #2 
if_docked takes an optional argument, "player_name". It is also supposed to take "player_slot", but I believe it still does not, even in 2.6. It does take "use_gm_selection", which will use the player ship selected by the GM if any, or ship 0 if not.

I BELIEVE if player_name is not specified, if_docked tests if ONLY ship 0 is docked with the station. No other ships are checked. I probably tested this myself, but I'm not 100% sure of that. So you may want to double check for yourself if you are uncertain.

So, if you give the command <if_docked/> and given the options 1-4 above, for case 3 if_docked will be true (because Artemis, the first ship, is docked) and case 4 if_docked will be false. The command "<if_docked player_name="Artemis"/> is synonymous with <if_docked/>, as long as the first ship is named "Artemis".

For the command <if_docked player_name="Intrepid"/> again, case 1&2 will be the same as above, case 3 will be false and case 4 will be true.

If you use two commands:

<if_docked player_name="Artemis"/>
<if_docked player_name="Intrepid"/>

Then you will "fall through" to the next command only if Artemis and Intrepid are BOTH docked. There is no way to test if EITHER of them is docked, except to make it two events which test for each of the two ships.

Note also that you can use <if_docked name="DS1"/> to test if a player ship (in this case, ship 0) is docked with a SPECIFIC station.

Posts: 30
Reply with quote  #3 
Thanks. I assume I can make my checks explicit this way:
<if_docked name="DS1" player_name="Artemis"/>

The documentation mentions the name attribute, but not the player_name attribute.

Posts: 2,799
Reply with quote  #4 
The documentation is a little incomplete. I attempted to correct that by posting an updated 2.4 mission scripting guide, but Thom did not include it with 2.5 or 2.6. I have checked my findings for 2.4 on the later updates, but I don't know if there may have been things I missed, or new additions.

My correction is here:

Thom really needs to get back to the player_slot attribute and get it working on all the commands it was designed for, since it was supposed to be in 2.4. But I assume there are other things on his mind.

Posts: 31
Reply with quote  #5 
My own multiplayer workaround is
if distance between PlayerShip and Spacestation =100 and speed is 0 then it is docked
Previous Topic | Next Topic

Quick Navigation:

Easily create a Forum Website with Website Toolbox.