How to call script when ship is destroyed

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
Dragonfire
---- E L I T E ----
---- E L I T E ----
Posts: 503
Joined: Sat Jun 11, 2011 7:46 pm

How to call script when ship is destroyed

Post by Dragonfire »

Hi all, I decided to take up the Dark Sky Enterprises mission after all.

I need to call a script when a specific ship (a Black Wyvern) is destroyed by the player. This script should simply raise a mission variable of the number of Black Wyverns destroyed total, and of a mission variable of the number of BWs destroyed in this stage of the mission.

How exactly do I do that?
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: How to call script when ship is destroyed

Post by Mauiby de Fug »

Call the shipDied event handler from the Black Wyvern's ship script.

You'll find the wiki javascript reference pages very useful...
Dragonfire
---- E L I T E ----
---- E L I T E ----
Posts: 503
Joined: Sat Jun 11, 2011 7:46 pm

Re: How to call script when ship is destroyed

Post by Dragonfire »

Thank you. Yup, I've been hunting through those. Not easy to trudge through everything at this point, but I'll become more familiar with it in time.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: How to call script when ship is destroyed

Post by Mauiby de Fug »

Don't worry. When I get around to doing bits of scripting or looking through other peoples' scripts, I always have them open as a reference. I usually know where to look and what I'm looking for, but I don't recall specific details about things. You get more familiar with them the more you do.
Post Reply