Page 1 of 1

Can a script cancel a launch?

Posted: Tue Mar 28, 2017 6:33 am
by byronarn
Let's say I want a event to happen when the player goes to launch, and this event prevents the player from launching. Is there a way to do this?

For example a player is ready to launch, but right before he does, station security surrounds his ship and closes the hanger door before taking him into custody. Can this be scripted?

I was thinking it would go in the shipWillLaunchFromStation event handler. I just don't know a method that would cancel the launch.

Code: Select all

this.shipWillLaunchFromStation = function(station)
{
     // Your code here
}

Re: Can a script cancel a launch?

Posted: Tue Mar 28, 2017 9:31 am
by Norby
I do not know a cancel method, just a workaround which land back to the station immediately after launch. For example:

Code: Select all

this.shipLaunchedFromStation = function(station) {
  if(player.ship.fuel < 7) {
    station.dockPlayer();
    player.consoleMessage("Buy fuel before launch!", 10);
  }
}
Unfortunately dockPlayer do nothing in shipWillLaunchFromStation, which could be a way to cancel launch in time before the tunnel effect.

If you choose this workaround then also need a check if docking fees is installed and turn it off, like temporary rename the worldScripts["Docking Fees"].shipDockedWithStation function.

Re: Can a script cancel a launch?

Posted: Tue Mar 28, 2017 6:18 pm
by byronarn
Norby wrote: Tue Mar 28, 2017 9:31 am
I do not know a cancel method, just a workaround which land back to the station immediately after launch. For example:

Code: Select all

this.shipLaunchedFromStation = function(station) {
  if(player.ship.fuel < 7) {
    station.dockPlayer();
    player.consoleMessage("Buy fuel before launch!", 10);
  }
}
Unfortunately dockPlayer do nothing in shipWillLaunchFromStation, which could be a way to cancel launch in time before the tunnel effect.

If you choose this workaround then also need a check if docking fees is installed and turn it off, like temporary rename the worldScripts["Docking Fees"].shipDockedWithStation function.
Tank you. I'll play around with it. :-)