Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: 666maslo666 on March 18, 2013, 05:01:59 am
-
Id like to request a sexp or a script which checks if one ship is docked to another ship.
Why not use has-docked-delay, you ask? Because when that sexp becomes true, not even Chuck Norris can make it false again. I need something which works with repeated docks and undocks and also with different ships each time it is called. It is possible to do this with has-docked delay and has-undocked-delay, but the event would be prohibitively big to check all cases.
-
Could you store the docking status as a variable? Has-docked adds one, has undocked subtracts one, it should always be either one or zero unless you're dealing with multiple dockers.
-
Could you store the docking status as a variable? Has-docked adds one, has undocked subtracts one, it should always be either one or zero unless you're dealing with multiple dockers.
Thats what I am already doing (storing a name of docked ship or <nothing> and dock count), but it does not solve any of the issues. I still need separate checks for when a docker docks once, then when he docks second time etc ("number of times they have to have docked"). And yes, ideally this should also work with multiple dockers and dockees, since I am making kind of an open world mission when the player can dock ships around freely.
-
Has-docked-delay can already handle this! The 4th argument is an integer representing the number of times the ship will have to have docked. So, what you need to do is link that 4th argument to a variable. Then, every time has-docked-delay becomes true, do a VARIABLE + 1. Then, as long as your 'when' event has multiple triggers, you can detect every time 2 ships have docked.
Now, I suppose it could be that you want to check every time a single ship is docked and that it doesn't matter what it could be docked to. That gets a little more difficult and I don't have a solution off the cuff, but if you need it, I'll think it through.
-
Has-docked-delay can already handle this! The 4th argument is an integer representing the number of times the ship will have to have docked. So, what you need to do is link that 4th argument to a variable. Then, every time has-docked-delay becomes true, do a VARIABLE + 1. Then, as long as your 'when' event has multiple triggers, you can detect every time 2 ships have docked.
Already tried this, didnt work, when it became true it stayed true no matter that variable was incremented. Ill try again, maybe I made a mistake somewhere...
Now, I suppose it could be that you want to check every time a single ship is docked and that it doesn't matter what it could be docked to. That gets a little more difficult and I don't have a solution off the cuff, but if you need it, I'll think it through.
Yes, please. It seems like a simple sexp/script to do, I was surprised it didnt exist already.