Bridge Commander Central

BC Forums => BC Scripting => Topic started by: Morgan on January 03, 2010, 03:09:43 AM

Title: Torpedo Question
Post by: Morgan on January 03, 2010, 03:09:43 AM
Okay so I know how to make a torpedo that disables shields but I was wondering if it was possible to expand upon that and make so that it would only succeed a certain amount of times (say it has 1/4 chance of working instead of 100%).  If it's possible how would I go about doing that?  I'm re-hardpointing a type 11 shuttle to include the tachyon bursts seen in Insurrection and want it to be as realistic as possible.
Title: Re: Torpedo Question
Post by: anazonda on January 03, 2010, 04:36:05 AM
For one I'd say this belongs in scripting.

While I have no clue how to do what you want, I figure that you perhaps have to make a seperate system that does what you want.

Torpedoes, as I understand it, only generates colores, flares and damage, and contain such systems as if it can penetrate shields, like the phased torpedoes.

Correct me if im wrong... wich I probably am.
Title: Re: Torpedo Question
Post by: KrrKs on January 03, 2010, 09:41:06 AM
AFAIK Defiants Abandon Ship script includes some kind of getRandonNuber function (or was that a python build in?) anyway, you could look in there on how to wrise/use it
Title: Re: Torpedo Question
Post by: USS Frontier on January 06, 2010, 09:58:39 PM
Code: [Select]
import App

fChance = 25.0  #chance probability value in %
if App.g_kSystemWrapper.GetRandomNumber(100) <= fChance:
        #Check successfull, do what you want to do...

That's a simple way in BC to check a chance (0 to 100% probability).
Inside the IF, substitute that comment with what your code does when it's successfull.
The fChance variable is kinda obvious: the chance of being successfull. You mentioned to have say 1/4 chance, that = 25%, therefore fChance = 25.0
Title: Re: Torpedo Question
Post by: Morgan on January 07, 2010, 03:38:33 PM
I'll give that a try, thanks Frontier!
Title: Re: Torpedo Question
Post by: Rob Archer on January 08, 2010, 09:53:00 AM
you'll need an event handler in the torpedo script for when the torpedo is fired too